Hoodow-bitly-api 0.0.1 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,8 @@
1
+ == 0.1.0 2009-07-07
2
+
3
+ * Covering all api methods
4
+
5
+
1
6
  == 0.0.1 2009-07-05
2
7
 
3
- * 1 major enhancement:
4
- * Initial release
8
+ * Initial release
@@ -14,14 +14,14 @@ Small library to access bitly api
14
14
 
15
15
  == INSTALL:
16
16
 
17
- gem sources -a http://gems.github.com
18
- gem install Hoodow-bitly-api
17
+ gem sources -a http://gems.github.com
18
+ gem install Hoodow-bitly-api
19
19
 
20
20
  == LICENSE:
21
21
 
22
22
  (The MIT License)
23
23
 
24
- Copyright (c) 2009 FIXME full name
24
+ Copyright (c) 2009 Ole Riesenberg
25
25
 
26
26
  Permission is hereby granted, free of charge, to any person obtaining
27
27
  a copy of this software and associated documentation files (the
data/Rakefile CHANGED
@@ -1,5 +1,5 @@
1
1
  require 'rubygems' unless ENV['NO_RUBYGEMS']
2
- %w[rake rake/clean fileutils hoe newgem rubigen].each { |f| require f }
2
+ %w[rake rake/clean fileutils newgem rubigen].each { |f| require f }
3
3
  require File.dirname(__FILE__) + '/lib/bitly-api'
4
4
 
5
5
  # Generate all the Rake tasks
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{bitly-api}
5
- s.version = "0.0.1"
5
+ s.version = "0.1.0"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Ole Riesenberg"]
9
- s.date = %q{2009-07-05}
9
+ s.date = %q{2009-07-09}
10
10
  s.description = %q{Small library to access bitly api}
11
11
  s.email = ["or@oleriesenberg.com"]
12
12
  s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.rdoc"]
@@ -8,5 +8,5 @@ require 'json'
8
8
  require 'bitly-api/bitly-api'
9
9
 
10
10
  module BitlyApi
11
- VERSION = '0.0.1'
11
+ VERSION = '0.1.0'
12
12
  end
@@ -20,16 +20,35 @@ module BitlyApi
20
20
  http_response = open(build_url("shorten", "longUrl=#{long_url}")).read
21
21
  data = JSON.parse(http_response)
22
22
  raise BitlyError.new(data["errorMessage"]) unless data["statusCode"] == "OK"
23
- results = data["results"][long_url]
24
- results
23
+ data["results"][long_url]
25
24
  end
26
25
 
27
26
  def expand(short_url)
28
27
  http_response = open(build_url("expand", "shortUrl=#{short_url}")).read
29
28
  data = JSON.parse(http_response)
30
29
  raise BitlyError.new(data["errorMessage"]) unless data["statusCode"] == "OK"
31
- results = data["results"][short_url]
32
- results
30
+ data["results"][short_url]
31
+ end
32
+
33
+ def info(short_url)
34
+ http_response = open(build_url("info", "shortUrl=#{short_url}")).read
35
+ data = JSON.parse(http_response)
36
+ raise BitlyError.new(data["errorMessage"]) unless data["statusCode"] == "OK"
37
+ data["results"][short_url.split(/\//)[-1]]
38
+ end
39
+
40
+ def stats(short_url)
41
+ http_response = open(build_url("stats", "shortUrl=#{short_url}")).read
42
+ data = JSON.parse(http_response)
43
+ raise BitlyError.new(data["errorMessage"]) unless data["statusCode"] == "OK"
44
+ data["results"]
45
+ end
46
+
47
+ def errors
48
+ http_response = open("http://api.bit.ly/errors?version=#{api_version}&login=#{login}&apiKey=#{api_key}").read
49
+ data = JSON.parse(http_response)
50
+ raise BitlyError.new(data["errorMessage"]) unless data["statusCode"] == "OK"
51
+ data["results"]
33
52
  end
34
53
 
35
54
  private
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Hoodow-bitly-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ole Riesenberg
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-07-05 00:00:00 -07:00
12
+ date: 2009-07-09 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency