bitly-oauth 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,6 @@
1
+ pkg
2
+ doc
3
+ coverage/*
4
+ .bundle/*
5
+ *.sw[nomp]
6
+ .rake_tasks
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.2
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source :rubygems
2
+
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,41 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ bitly-oauth (0.2.1)
5
+ httparty
6
+ oauth2
7
+
8
+ GEM
9
+ remote: http://rubygems.org/
10
+ specs:
11
+ addressable (2.2.6)
12
+ fakeweb (1.3.0)
13
+ faraday (0.7.6)
14
+ addressable (~> 2.2)
15
+ multipart-post (~> 1.1)
16
+ rack (~> 1.1)
17
+ httparty (0.8.1)
18
+ multi_json
19
+ multi_xml
20
+ metaclass (0.0.1)
21
+ mocha (0.10.3)
22
+ metaclass (~> 0.0.1)
23
+ multi_json (1.0.4)
24
+ multi_xml (0.4.1)
25
+ multipart-post (1.1.4)
26
+ oauth2 (0.5.2)
27
+ faraday (~> 0.7)
28
+ multi_json (~> 1.0)
29
+ rack (1.4.0)
30
+ rake (0.9.2.2)
31
+ shoulda (2.11.3)
32
+
33
+ PLATFORMS
34
+ ruby
35
+
36
+ DEPENDENCIES
37
+ bitly-oauth!
38
+ fakeweb
39
+ mocha
40
+ rake
41
+ shoulda
data/README.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # bitly-oauth
2
2
 
3
+ ## STATUS
4
+
5
+ [![Build Status](https://secure.travis-ci.org/jonstorer/bitly-oauth.png)](http://travis-ci.org/jonstorer/bitly-oauth)
6
+
3
7
  ## DESCRIPTION:
4
8
 
5
9
  A Ruby API for [http://bit.ly](http://bit.ly)
data/Rakefile CHANGED
@@ -1,27 +1,8 @@
1
- require 'rubygems'
2
- require 'rake'
3
- require 'jeweler'
4
-
5
- Jeweler::Tasks.new do |gem|
6
- gem.name = "bitly-oauth"
7
- gem.summary = "A ruby wrapper for the bit.ly API"
8
- gem.description = <<-DESCRIPTION
9
- A ruby wrapper for version 3 of the bit.ly API
10
- Supports OAuth authentication
11
- DESCRIPTION
12
- gem.email = "jonathon.scott.storer@gmail.com"
13
- gem.homepage = "http://github.com/jonstorer/bitly-oauth"
14
- gem.authors = ["jonstorer"]
15
- gem.add_dependency 'httparty', ">= 0.7.6"
16
- gem.add_dependency 'oauth2', '>= 0.1.1'
17
- gem.add_development_dependency "shoulda", ">= 0"
18
- gem.add_development_dependency "jeweler", ">= 1.4.0"
19
- gem.add_development_dependency "rcov", ">= 0"
20
- gem.add_development_dependency "mocha", ">= 0.10.0"
21
- gem.add_development_dependency "fakeweb", ">= 1.2.8"
22
- # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
23
- end
1
+ #!/usr/bin/env rake
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "bitly_oauth/version"
24
4
 
5
+ require "bundler/gem_tasks"
25
6
  require 'rake/testtask'
26
7
  Rake::TestTask.new(:test) do |test|
27
8
  test.libs << 'lib' << 'test'
@@ -29,14 +10,14 @@ Rake::TestTask.new(:test) do |test|
29
10
  test.verbose = true
30
11
  end
31
12
 
32
- task :default => :test
33
-
34
13
  require 'rake/rdoctask'
35
14
  Rake::RDocTask.new do |rdoc|
36
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
15
+ version = BitlyOAuth::VERSION
37
16
 
38
17
  rdoc.rdoc_dir = 'rdoc'
39
18
  rdoc.title = "bitly-oauth #{version}"
40
19
  rdoc.rdoc_files.include('README*')
41
20
  rdoc.rdoc_files.include('lib/**/*.rb')
42
21
  end
22
+
23
+ task :default => [:test]
@@ -0,0 +1,25 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "bitly_oauth/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "bitly-oauth"
7
+ s.version = BitlyOAuth::VERSION
8
+ s.authors = ["jonstorer"]
9
+ s.email = ["jonathon.scott.storer@gmail.com"]
10
+ s.homepage = "http://github.com/jonstorer/bitly-oauth"
11
+ s.summary = "Ruby wrapper for the Bitly V3 API with OAuth authentication."
12
+ s.description = "A ruby wrapper for version 3 of the bit.ly API\nSupports OAuth authentication\n"
13
+ s.rubygems_version = "1.8.10"
14
+ s.files = `git ls-files`.split("\n")
15
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
+ s.require_paths = ["lib"]
18
+
19
+ s.add_runtime_dependency('httparty')
20
+ s.add_runtime_dependency('oauth2')
21
+ s.add_development_dependency('shoulda')
22
+ s.add_development_dependency('rake')
23
+ s.add_development_dependency('mocha')
24
+ s.add_development_dependency('fakeweb')
25
+ end
@@ -11,7 +11,7 @@ module BitlyOAuth
11
11
  end
12
12
 
13
13
  def authorize_url(redirect_url)
14
- client.auth_code.authorize_url(:redirect_uri => redirect_url).gsub(/api-ssl.bit.ly/,'bitly.com')
14
+ client.auth_code.authorize_url(:redirect_uri => redirect_url)
15
15
  end
16
16
 
17
17
  def get_access_token_from_code(code, redirect_url)
@@ -135,7 +135,13 @@ module BitlyOAuth
135
135
  end
136
136
 
137
137
  def client
138
- @client ||= ::OAuth2::Client.new(@client_id, @client_secret, :site => BASE_URL, :token_url => '/oauth/access_token')
138
+ @client ||= begin
139
+ ::OAuth2::Client.new(@client_id,
140
+ @client_secret,
141
+ :site => BASE_URL,
142
+ :authorize_url => 'https://bitly.com/oauth/authorize',
143
+ :token_url => '/oauth/access_token')
144
+ end
139
145
  end
140
146
 
141
147
  def access_token
@@ -0,0 +1,3 @@
1
+ module BitlyOAuth
2
+ VERSION = "0.2.1"
3
+ end
@@ -673,7 +673,7 @@ class TestClient < Test::Unit::TestCase
673
673
  end
674
674
  should "return a Time for the day" do
675
675
  assert_instance_of Time, @urls[0].clicks_by_day[0].day_start
676
- assert_equal Time.parse('2010/11/23'), @urls[0].clicks_by_day[0].day_start
676
+ assert_equal Time.parse('2010-11-23 05:00:00 +0000'), @urls[0].clicks_by_day[0].day_start
677
677
  end
678
678
  should 'return the number of clicks for that day' do
679
679
  assert_equal 1, @urls[0].clicks_by_day[0].clicks
data/test/test_helper.rb CHANGED
@@ -1,9 +1,7 @@
1
- require 'rubygems'
2
1
  require 'test/unit'
3
2
  require 'shoulda'
4
3
  require 'mocha'
5
4
  require 'fakeweb'
6
- require 'ruby-debug'
7
5
 
8
6
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
9
7
  $LOAD_PATH.unshift(File.dirname(__FILE__))
@@ -16,7 +16,7 @@ class TestDay < Test::Unit::TestCase
16
16
  end
17
17
  should "set day to a time object when initialising" do
18
18
  day = BitlyOAuth::Day.new('day_start' => 1290488400)
19
- assert_equal Time.parse('2010/11/23'), day.day_start
19
+ assert_equal Time.parse('2010-11-23 05:00:00 +0000'), day.day_start
20
20
  end
21
21
  end
22
22
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bitly-oauth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,33 +9,33 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-22 00:00:00.000000000Z
12
+ date: 2012-01-24 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty
16
- requirement: &70144093311940 !ruby/object:Gem::Requirement
16
+ requirement: &70117703752660 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
- version: 0.7.6
21
+ version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70144093311940
24
+ version_requirements: *70117703752660
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: oauth2
27
- requirement: &70144093311400 !ruby/object:Gem::Requirement
27
+ requirement: &70117703752200 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
31
31
  - !ruby/object:Gem::Version
32
- version: 0.1.1
32
+ version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70144093311400
35
+ version_requirements: *70117703752200
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: shoulda
38
- requirement: &70144093310880 !ruby/object:Gem::Requirement
38
+ requirement: &70117703751720 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,21 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70144093310880
47
- - !ruby/object:Gem::Dependency
48
- name: jeweler
49
- requirement: &70144093310300 !ruby/object:Gem::Requirement
50
- none: false
51
- requirements:
52
- - - ! '>='
53
- - !ruby/object:Gem::Version
54
- version: 1.4.0
55
- type: :development
56
- prerelease: false
57
- version_requirements: *70144093310300
46
+ version_requirements: *70117703751720
58
47
  - !ruby/object:Gem::Dependency
59
- name: rcov
60
- requirement: &70144093309660 !ruby/object:Gem::Requirement
48
+ name: rake
49
+ requirement: &70117703751300 !ruby/object:Gem::Requirement
61
50
  none: false
62
51
  requirements:
63
52
  - - ! '>='
@@ -65,48 +54,50 @@ dependencies:
65
54
  version: '0'
66
55
  type: :development
67
56
  prerelease: false
68
- version_requirements: *70144093309660
57
+ version_requirements: *70117703751300
69
58
  - !ruby/object:Gem::Dependency
70
59
  name: mocha
71
- requirement: &70144093307840 !ruby/object:Gem::Requirement
60
+ requirement: &70117703750860 !ruby/object:Gem::Requirement
72
61
  none: false
73
62
  requirements:
74
63
  - - ! '>='
75
64
  - !ruby/object:Gem::Version
76
- version: 0.10.0
65
+ version: '0'
77
66
  type: :development
78
67
  prerelease: false
79
- version_requirements: *70144093307840
68
+ version_requirements: *70117703750860
80
69
  - !ruby/object:Gem::Dependency
81
70
  name: fakeweb
82
- requirement: &70144093307360 !ruby/object:Gem::Requirement
71
+ requirement: &70117703750400 !ruby/object:Gem::Requirement
83
72
  none: false
84
73
  requirements:
85
74
  - - ! '>='
86
75
  - !ruby/object:Gem::Version
87
- version: 1.2.8
76
+ version: '0'
88
77
  type: :development
89
78
  prerelease: false
90
- version_requirements: *70144093307360
79
+ version_requirements: *70117703750400
91
80
  description: ! 'A ruby wrapper for version 3 of the bit.ly API
92
81
 
93
82
  Supports OAuth authentication
94
83
 
95
84
  '
96
- email: jonathon.scott.storer@gmail.com
85
+ email:
86
+ - jonathon.scott.storer@gmail.com
97
87
  executables: []
98
88
  extensions: []
99
- extra_rdoc_files:
100
- - LICENSE
101
- - README.md
102
- - README.rdoc
89
+ extra_rdoc_files: []
103
90
  files:
91
+ - .gitignore
92
+ - .travis.yml
93
+ - Gemfile
94
+ - Gemfile.lock
104
95
  - History.txt
105
96
  - LICENSE
106
97
  - README.md
107
98
  - README.rdoc
108
99
  - Rakefile
109
- - VERSION
100
+ - bitly-oauth.gemspec
110
101
  - lib/bitly_oauth.rb
111
102
  - lib/bitly_oauth/access_token.rb
112
103
  - lib/bitly_oauth/client.rb
@@ -122,6 +113,7 @@ files:
122
113
  - lib/bitly_oauth/response.rb
123
114
  - lib/bitly_oauth/url.rb
124
115
  - lib/bitly_oauth/user.rb
116
+ - lib/bitly_oauth/version.rb
125
117
  - test/fixtures/9uX1TE.json
126
118
  - test/fixtures/9uX1TEclicks.json
127
119
  - test/fixtures/9uX1TEclicks2.json
@@ -200,16 +192,88 @@ required_ruby_version: !ruby/object:Gem::Requirement
200
192
  - - ! '>='
201
193
  - !ruby/object:Gem::Version
202
194
  version: '0'
195
+ segments:
196
+ - 0
197
+ hash: -3882379535477319837
203
198
  required_rubygems_version: !ruby/object:Gem::Requirement
204
199
  none: false
205
200
  requirements:
206
201
  - - ! '>='
207
202
  - !ruby/object:Gem::Version
208
203
  version: '0'
204
+ segments:
205
+ - 0
206
+ hash: -3882379535477319837
209
207
  requirements: []
210
208
  rubyforge_project:
211
209
  rubygems_version: 1.8.10
212
210
  signing_key:
213
211
  specification_version: 3
214
- summary: A ruby wrapper for the bit.ly API
215
- test_files: []
212
+ summary: Ruby wrapper for the Bitly V3 API with OAuth authentication.
213
+ test_files:
214
+ - test/fixtures/9uX1TE.json
215
+ - test/fixtures/9uX1TEclicks.json
216
+ - test/fixtures/9uX1TEclicks2.json
217
+ - test/fixtures/9uX1TEinfo.json
218
+ - test/fixtures/9uX1TEinfo2.json
219
+ - test/fixtures/auth_fail.json
220
+ - test/fixtures/auth_success.json
221
+ - test/fixtures/betaworks.json
222
+ - test/fixtures/betaworks2.json
223
+ - test/fixtures/betaworks_jmp.json
224
+ - test/fixtures/betaworks_other_user.json
225
+ - test/fixtures/bitly9uX1TE.json
226
+ - test/fixtures/bitly_pro_domain.json
227
+ - test/fixtures/clicks_by_day.json
228
+ - test/fixtures/clicks_by_day1.json
229
+ - test/fixtures/clicks_by_day2.json
230
+ - test/fixtures/clicks_by_minute1_url.json
231
+ - test/fixtures/clicks_by_minute2_url.json
232
+ - test/fixtures/clicks_by_minute_hash.json
233
+ - test/fixtures/clicks_by_minute_hashes.json
234
+ - test/fixtures/country_hash.json
235
+ - test/fixtures/country_hash2.json
236
+ - test/fixtures/country_url.json
237
+ - test/fixtures/failure.json
238
+ - test/fixtures/invalid_bitly_pro_domain.json
239
+ - test/fixtures/invalid_credentials.json
240
+ - test/fixtures/invalid_domain.json
241
+ - test/fixtures/invalid_user.json
242
+ - test/fixtures/invalid_x_api_key.json
243
+ - test/fixtures/lookup_multiple_url.json
244
+ - test/fixtures/lookup_not_real_url.json
245
+ - test/fixtures/lookup_single_url.json
246
+ - test/fixtures/missing_hash.json
247
+ - test/fixtures/multiple_info.json
248
+ - test/fixtures/multiple_url_click.json
249
+ - test/fixtures/multiple_urls.json
250
+ - test/fixtures/not_bitly_pro_domain.json
251
+ - test/fixtures/not_found_info.json
252
+ - test/fixtures/referrer_hash.json
253
+ - test/fixtures/referrer_hash2.json
254
+ - test/fixtures/referrer_url.json
255
+ - test/fixtures/success.json
256
+ - test/fixtures/url_info.json
257
+ - test/fixtures/user_clicks.json
258
+ - test/fixtures/user_countries.json
259
+ - test/fixtures/user_realtime_links.json
260
+ - test/fixtures/user_referrers.json
261
+ - test/fixtures/valid_user.json
262
+ - test/integration/strategy/old_test_api_key.rb
263
+ - test/integration/test_client.rb
264
+ - test/integration/test_user.rb
265
+ - test/test_helper.rb
266
+ - test/unit/core_ext/test_hash.rb
267
+ - test/unit/core_ext/test_string.rb
268
+ - test/unit/test_bitly_oauth.rb
269
+ - test/unit/test_client.rb
270
+ - test/unit/test_country.rb
271
+ - test/unit/test_day.rb
272
+ - test/unit/test_error.rb
273
+ - test/unit/test_missing.rb
274
+ - test/unit/test_realtime_link.rb
275
+ - test/unit/test_referrer.rb
276
+ - test/unit/test_referring_domain.rb
277
+ - test/unit/test_response.rb
278
+ - test/unit/test_url.rb
279
+ - test/unit/test_user.rb
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.2.0