bitly 0.6.0 → 0.6.1
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.
- data/History.txt +6 -0
- data/Rakefile +1 -1
- data/bitly.gemspec +6 -7
- data/lib/bitly/v3/oauth.rb +3 -2
- data/lib/bitly/v3/user.rb +9 -0
- data/lib/bitly/version.rb +1 -1
- metadata +10 -8
data/History.txt
CHANGED
data/Rakefile
CHANGED
|
@@ -8,6 +8,6 @@ Echoe.new('bitly', Bitly::VERSION) do |p|
|
|
|
8
8
|
p.url = "http://github.com/philnash/bitly"
|
|
9
9
|
p.author = "Phil Nash"
|
|
10
10
|
p.email = "philnash@gmail.com"
|
|
11
|
-
p.extra_deps = [['crack', '>= 0.1.4'], ['httparty', '>= 0.5.2'], ['oauth2', '>= 0']]
|
|
11
|
+
p.extra_deps = [['crack', '>= 0.1.4'], ['httparty', '>= 0.5.2'], ['oauth2', '>= 0.1.1']]
|
|
12
12
|
p.development_dependencies = []
|
|
13
13
|
end
|
data/bitly.gemspec
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Gem::Specification.new do |s|
|
|
4
4
|
s.name = %q{bitly}
|
|
5
|
-
s.version = "0.6.
|
|
5
|
+
s.version = "0.6.1"
|
|
6
6
|
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
|
8
8
|
s.authors = ["Phil Nash"]
|
|
9
|
-
s.date = %q{2011-01-
|
|
9
|
+
s.date = %q{2011-01-12}
|
|
10
10
|
s.description = %q{Use the bit.ly API to shorten or expand URLs}
|
|
11
11
|
s.email = %q{philnash@gmail.com}
|
|
12
12
|
s.extra_rdoc_files = ["README.txt", "lib/bitly.rb", "lib/bitly/client.rb", "lib/bitly/url.rb", "lib/bitly/utils.rb", "lib/bitly/v3.rb", "lib/bitly/v3/bitly.rb", "lib/bitly/v3/client.rb", "lib/bitly/v3/country.rb", "lib/bitly/v3/day.rb", "lib/bitly/v3/missing_url.rb", "lib/bitly/v3/oauth.rb", "lib/bitly/v3/realtime_link.rb", "lib/bitly/v3/referrer.rb", "lib/bitly/v3/url.rb", "lib/bitly/v3/user.rb", "lib/bitly/version.rb"]
|
|
@@ -15,26 +15,25 @@ Gem::Specification.new do |s|
|
|
|
15
15
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Bitly", "--main", "README.txt"]
|
|
16
16
|
s.require_paths = ["lib"]
|
|
17
17
|
s.rubyforge_project = %q{bitly}
|
|
18
|
-
s.rubygems_version = %q{1.
|
|
18
|
+
s.rubygems_version = %q{1.4.1}
|
|
19
19
|
s.summary = %q{Use the bit.ly API to shorten or expand URLs}
|
|
20
20
|
s.test_files = ["test/bitly/test_client.rb", "test/bitly/test_url.rb", "test/bitly/test_utils.rb", "test/test_helper.rb"]
|
|
21
21
|
|
|
22
22
|
if s.respond_to? :specification_version then
|
|
23
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
|
24
23
|
s.specification_version = 3
|
|
25
24
|
|
|
26
25
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
|
27
26
|
s.add_runtime_dependency(%q<crack>, [">= 0.1.4"])
|
|
28
27
|
s.add_runtime_dependency(%q<httparty>, [">= 0.5.2"])
|
|
29
|
-
s.add_runtime_dependency(%q<oauth2>, [">= 0"])
|
|
28
|
+
s.add_runtime_dependency(%q<oauth2>, [">= 0.1.1"])
|
|
30
29
|
else
|
|
31
30
|
s.add_dependency(%q<crack>, [">= 0.1.4"])
|
|
32
31
|
s.add_dependency(%q<httparty>, [">= 0.5.2"])
|
|
33
|
-
s.add_dependency(%q<oauth2>, [">= 0"])
|
|
32
|
+
s.add_dependency(%q<oauth2>, [">= 0.1.1"])
|
|
34
33
|
end
|
|
35
34
|
else
|
|
36
35
|
s.add_dependency(%q<crack>, [">= 0.1.4"])
|
|
37
36
|
s.add_dependency(%q<httparty>, [">= 0.5.2"])
|
|
38
|
-
s.add_dependency(%q<oauth2>, [">= 0"])
|
|
37
|
+
s.add_dependency(%q<oauth2>, [">= 0.1.1"])
|
|
39
38
|
end
|
|
40
39
|
end
|
data/lib/bitly/v3/oauth.rb
CHANGED
|
@@ -25,8 +25,9 @@ module Bitly
|
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
# If you already have a user token, this method gets the access token
|
|
28
|
-
def get_access_token_from_token(token)
|
|
29
|
-
|
|
28
|
+
def get_access_token_from_token(token, params={})
|
|
29
|
+
params = params.inject({}) { |options, (key, value)| options[key.to_s] = value; options }
|
|
30
|
+
@access_token ||= ::OAuth2::AccessToken.new(client, token, nil, nil, params)
|
|
30
31
|
end
|
|
31
32
|
end
|
|
32
33
|
end
|
data/lib/bitly/v3/user.rb
CHANGED
|
@@ -16,8 +16,12 @@ module Bitly
|
|
|
16
16
|
#
|
|
17
17
|
# u=Bitly::V3::User.new(o.access_token)
|
|
18
18
|
class User
|
|
19
|
+
attr_accessor :login, :api_key
|
|
20
|
+
|
|
19
21
|
def initialize(access_token)
|
|
20
22
|
@access_token = access_token
|
|
23
|
+
@login = access_token['login'] || access_token['username']
|
|
24
|
+
@api_key = access_token['apiKey'] || access_token['api_key']
|
|
21
25
|
end
|
|
22
26
|
|
|
23
27
|
# OAuth 2 endpoint that provides a list of top referrers (up to 500 per
|
|
@@ -71,6 +75,11 @@ module Bitly
|
|
|
71
75
|
get_clicks(opts)
|
|
72
76
|
@total_clicks
|
|
73
77
|
end
|
|
78
|
+
|
|
79
|
+
# Returns a Bitly Client using the credentials of the user.
|
|
80
|
+
def client
|
|
81
|
+
@client ||= Bitly::V3::Client.new(login, api_key)
|
|
82
|
+
end
|
|
74
83
|
|
|
75
84
|
private
|
|
76
85
|
|
data/lib/bitly/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bitly
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
5
|
-
prerelease:
|
|
4
|
+
hash: 5
|
|
5
|
+
prerelease:
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 6
|
|
9
|
-
-
|
|
10
|
-
version: 0.6.
|
|
9
|
+
- 1
|
|
10
|
+
version: 0.6.1
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Phil Nash
|
|
@@ -15,7 +15,7 @@ autorequire:
|
|
|
15
15
|
bindir: bin
|
|
16
16
|
cert_chain: []
|
|
17
17
|
|
|
18
|
-
date: 2011-01-
|
|
18
|
+
date: 2011-01-12 00:00:00 +00:00
|
|
19
19
|
default_executable:
|
|
20
20
|
dependencies:
|
|
21
21
|
- !ruby/object:Gem::Dependency
|
|
@@ -58,10 +58,12 @@ dependencies:
|
|
|
58
58
|
requirements:
|
|
59
59
|
- - ">="
|
|
60
60
|
- !ruby/object:Gem::Version
|
|
61
|
-
hash:
|
|
61
|
+
hash: 25
|
|
62
62
|
segments:
|
|
63
63
|
- 0
|
|
64
|
-
|
|
64
|
+
- 1
|
|
65
|
+
- 1
|
|
66
|
+
version: 0.1.1
|
|
65
67
|
type: :runtime
|
|
66
68
|
version_requirements: *id003
|
|
67
69
|
description: Use the bit.ly API to shorten or expand URLs
|
|
@@ -158,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
158
160
|
requirements: []
|
|
159
161
|
|
|
160
162
|
rubyforge_project: bitly
|
|
161
|
-
rubygems_version: 1.
|
|
163
|
+
rubygems_version: 1.4.1
|
|
162
164
|
signing_key:
|
|
163
165
|
specification_version: 3
|
|
164
166
|
summary: Use the bit.ly API to shorten or expand URLs
|