capgun 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 82e106ab5dc96fbf729c5fb2be0085182453ba08
4
- data.tar.gz: 7fcd3e5c56d578f657955b1db15479be4d2b49d0
3
+ metadata.gz: 7f74acbe256464f4efa3abc3c550a015b6ca0649
4
+ data.tar.gz: fe33d870aed631cf7a76c84d812801f7c2d51c50
5
5
  SHA512:
6
- metadata.gz: 6ccf5ce211216c28371ee2693fe1cd839a10c4c65a7409da35b1a5118840f26212d39b7fbdda599e8aa8112ae2a3261bf7f493331683a8fc799e40c633b4f1d3
7
- data.tar.gz: db3a2ea709c339c7314b72aadecdaa29439739b45893427851b76b6a7b89746144ca3a20af4c31e495b3b62839f24e55f3d5f878a4daaeca9a0798dd0b616b6c
6
+ metadata.gz: 00fd593ed5aeccd6b9a11554db76f14c2088dca053d645f9e61d2ae5066be29e8446e1001e1a2ac8fa9094994ecac1bae944f1c10be17499228c3fa01a61e6ae
7
+ data.tar.gz: 1db80b897b5c43b9ff8647bdec83f0b0c51dccac9692e3abd2b84199b8cfff6d43fa0fb5b91797792810bfaf5048f54e8369324dbaa07ec166f2a0f1695a6ede
@@ -1,43 +1,51 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- capgun (0.1.2)
5
- activesupport (>= 2.3.9, < 4)
6
- faraday (~> 0.8)
7
- json
8
- multi_json (~> 1.3)
4
+ capgun (0.2.0)
5
+ activesupport
6
+ faraday
7
+ multi_json
9
8
 
10
9
  GEM
11
10
  remote: https://rubygems.org/
12
11
  specs:
13
- activesupport (3.2.13)
14
- i18n (= 0.6.1)
15
- multi_json (~> 1.0)
16
- addressable (2.2.8)
17
- crack (0.3.1)
18
- diff-lcs (1.1.3)
12
+ activesupport (4.0.0)
13
+ i18n (~> 0.6, >= 0.6.4)
14
+ minitest (~> 4.2)
15
+ multi_json (~> 1.3)
16
+ thread_safe (~> 0.1)
17
+ tzinfo (~> 0.3.37)
18
+ addressable (2.3.5)
19
+ atomic (1.1.10)
20
+ crack (0.4.0)
21
+ safe_yaml (~> 0.9.0)
22
+ diff-lcs (1.2.4)
19
23
  faraday (0.8.7)
20
24
  multipart-post (~> 1.1)
21
- i18n (0.6.1)
22
- json (1.8.0)
23
- multi_json (1.3.5)
25
+ i18n (0.6.4)
26
+ minitest (4.7.5)
27
+ multi_json (1.7.7)
24
28
  multipart-post (1.2.0)
25
- rake (0.9.2.2)
26
- rspec (2.9.0)
27
- rspec-core (~> 2.9.0)
28
- rspec-expectations (~> 2.9.0)
29
- rspec-mocks (~> 2.9.0)
30
- rspec-core (2.9.0)
31
- rspec-expectations (2.9.1)
32
- diff-lcs (~> 1.1.3)
33
- rspec-mocks (2.9.0)
34
- simplecov (0.6.4)
29
+ rake (10.1.0)
30
+ rspec (2.13.0)
31
+ rspec-core (~> 2.13.0)
32
+ rspec-expectations (~> 2.13.0)
33
+ rspec-mocks (~> 2.13.0)
34
+ rspec-core (2.13.1)
35
+ rspec-expectations (2.13.0)
36
+ diff-lcs (>= 1.1.3, < 2.0)
37
+ rspec-mocks (2.13.1)
38
+ safe_yaml (0.9.3)
39
+ simplecov (0.7.1)
35
40
  multi_json (~> 1.0)
36
- simplecov-html (~> 0.5.3)
37
- simplecov-html (0.5.3)
38
- webmock (1.8.7)
41
+ simplecov-html (~> 0.7.1)
42
+ simplecov-html (0.7.1)
43
+ thread_safe (0.1.0)
44
+ atomic
45
+ tzinfo (0.3.37)
46
+ webmock (1.12.2)
39
47
  addressable (>= 2.2.7)
40
- crack (>= 0.1.7)
48
+ crack (>= 0.3.2)
41
49
  yard (0.8.6.1)
42
50
 
43
51
  PLATFORMS
data/HISTORY.md CHANGED
@@ -1,6 +1,10 @@
1
1
  HISTORY
2
2
  =======
3
3
 
4
+ 0.2.0 - June 27th, 2013
5
+ --------------------------------------------------------------------------------
6
+ * using multi_json gem
7
+
4
8
  0.1.2 - June 11th, 2013
5
9
  --------------------------------------------------------------------------------
6
10
  * loosen capgun deps on json gem
@@ -3,10 +3,9 @@ require "capgun/version"
3
3
 
4
4
  Gem::Specification.new do |gem|
5
5
 
6
- gem.add_dependency 'activesupport', ['>= 2.3.9', '< 4']
7
- gem.add_dependency 'faraday', '~> 0.8'
8
- gem.add_dependency 'json'
9
- gem.add_dependency 'multi_json', '~> 1.3'
6
+ gem.add_dependency 'activesupport'
7
+ gem.add_dependency 'faraday'
8
+ gem.add_dependency 'multi_json'
10
9
 
11
10
  gem.add_development_dependency "rake"
12
11
  gem.add_development_dependency "rspec"
@@ -1,5 +1,4 @@
1
- require 'json'
2
- require 'json/pure'
1
+ require 'multi_json'
3
2
  require 'ostruct'
4
3
  require 'capgun/base'
5
4
  require 'capgun/account'
@@ -23,7 +23,7 @@ module Capgun
23
23
  request.url(path, params)
24
24
  when :post
25
25
  request.path = path
26
- request.body = params.to_json unless params.empty?
26
+ request.body = MultiJson.dump(params) unless params.empty?
27
27
  end
28
28
  end
29
29
  options[:raw] ? response : response.body
@@ -8,12 +8,12 @@ module Capgun
8
8
 
9
9
  # @return [Integer]
10
10
  def self.minor
11
- 1
11
+ 2
12
12
  end
13
13
 
14
14
  # @return [Integer]
15
15
  def self.patch
16
- 2
16
+ 0
17
17
  end
18
18
 
19
19
  # @return [String, NilClass]
@@ -11,7 +11,7 @@ describe Capgun::Client do
11
11
  specify "not allowed to get estimates without authorization" do
12
12
  stub_request(:post, "https://api.capgun.io/v1/orders/estimate.json").
13
13
  with(:body => "{\"url\":\"http://example.com/test\"}",
14
- :headers => {'Accept'=>'application/json', 'Authorization'=>'', 'User-Agent'=>'Capgun.io Ruby Gem 0.1.2'}).
14
+ :headers => {'Accept'=>'application/json', 'Authorization'=>'', 'User-Agent'=>'Capgun.io Ruby Gem 0.2.0'}).
15
15
  to_return(:status => 401, :body => fixture("unauthorized.json"), :headers => {})
16
16
 
17
17
  lambda { Capgun.estimate("http://example.com/test") }.should raise_error(Capgun::Error::Unauthorized, "Unauthorized")
@@ -20,7 +20,7 @@ describe Capgun::Client do
20
20
  specify "no urls are submitted for capture" do
21
21
  stub_request(:post, "https://api.capgun.io/v1/orders.json").
22
22
  with(:body => "{\"url\":\"http://example.com/test\"}",
23
- :headers => {'Accept'=>'application/json', 'Authorization'=>'', 'User-Agent'=>'Capgun.io Ruby Gem 0.1.2'}).
23
+ :headers => {'Accept'=>'application/json', 'Authorization'=>'', 'User-Agent'=>'Capgun.io Ruby Gem 0.2.0'}).
24
24
  to_return(:status => 401, :body => fixture("unauthorized.json"), :headers => {})
25
25
 
26
26
  lambda { Capgun.capture("http://example.com/test") }.should raise_error(Capgun::Error::Unauthorized, "Unauthorized")
@@ -28,7 +28,7 @@ describe Capgun::Client do
28
28
 
29
29
  specify "not allowed to view on order without authorization" do
30
30
  stub_request(:get, "https://api.capgun.io/v1/orders/4fd20a1288f560177600000a.json").
31
- with(:headers => {'Accept'=>'application/json', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'', 'User-Agent'=>'Capgun.io Ruby Gem 0.1.2'}).
31
+ with(:headers => {'Accept'=>'application/json', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'', 'User-Agent'=>'Capgun.io Ruby Gem 0.2.0'}).
32
32
  to_return(:status => 401, :body => fixture("unauthorized.json"), :headers => {})
33
33
 
34
34
  lambda { Capgun.order("4fd20a1288f560177600000a") }.should raise_error(Capgun::Error::Unauthorized, "Unauthorized")
@@ -36,7 +36,7 @@ describe Capgun::Client do
36
36
 
37
37
  specify "not allowed to view job status without authorization" do
38
38
  stub_request(:get, "https://api.capgun.io/v1/jobs/4fd20a1288f5601776000012.json").
39
- with(:headers => {'Accept'=>'application/json', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'', 'User-Agent'=>'Capgun.io Ruby Gem 0.1.2'}).
39
+ with(:headers => {'Accept'=>'application/json', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'', 'User-Agent'=>'Capgun.io Ruby Gem 0.2.0'}).
40
40
  to_return(:status => 401, :body => fixture('unauthorized.json'), :headers => {})
41
41
 
42
42
  lambda { Capgun.status("4fd20a1288f5601776000012") }.should raise_error(Capgun::Error::Unauthorized, "Unauthorized")
@@ -44,7 +44,7 @@ describe Capgun::Client do
44
44
 
45
45
  specify "not allowed to view account" do
46
46
  stub_request(:get, "https://api.capgun.io/v1/account.json").
47
- with(:headers => {'Accept'=>'application/json', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'', 'User-Agent'=>'Capgun.io Ruby Gem 0.1.2'}).
47
+ with(:headers => {'Accept'=>'application/json', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'', 'User-Agent'=>'Capgun.io Ruby Gem 0.2.0'}).
48
48
  to_return(:status => 401, :body => fixture('unauthorized.json'), :headers => {})
49
49
 
50
50
  lambda { Capgun.account }.should raise_error(Capgun::Error::Unauthorized, "Unauthorized")
@@ -67,7 +67,7 @@ describe Capgun::Client do
67
67
  specify "get an estimate to capture a url" do
68
68
  stub_request(:post, "https://api.capgun.io/v1/orders/estimate.json").
69
69
  with(:body => "{\"url\":\"http://example.com/test\"}",
70
- :headers => {'Accept'=>'application/json', 'Authorization'=>'test', 'User-Agent'=>'Capgun.io Ruby Gem 0.1.2'}).
70
+ :headers => {'Accept'=>'application/json', 'Authorization'=>'test', 'User-Agent'=>'Capgun.io Ruby Gem 0.2.0'}).
71
71
  to_return(:status => 200, :body => fixture("estimate.json"), :headers => {})
72
72
 
73
73
  estimate = Capgun.estimate("http://example.com/test")
@@ -77,7 +77,7 @@ describe Capgun::Client do
77
77
  specify "estimate with options in a block" do
78
78
  stub_request(:post, "https://api.capgun.io/v1/orders/estimate.json").
79
79
  with(:body => '{"viewport":"1024x2048","packages":["images","viewport"],"url":"http://example.com/test"}',
80
- :headers => {'Accept'=>'application/json', 'Authorization'=>'test', 'User-Agent'=>'Capgun.io Ruby Gem 0.1.2'}).
80
+ :headers => {'Accept'=>'application/json', 'Authorization'=>'test', 'User-Agent'=>'Capgun.io Ruby Gem 0.2.0'}).
81
81
  to_return(:status => 200, :body => fixture("estimate-with-options.json"), :headers => {})
82
82
 
83
83
  estimate = Capgun.estimate("http://example.com/test", :viewport => "200x100") do |options|
@@ -90,7 +90,7 @@ describe Capgun::Client do
90
90
  specify "urls are submitted for capture" do
91
91
  stub_request(:post, "https://api.capgun.io/v1/orders.json").
92
92
  with(:body => "{\"url\":\"http://example.com/test\"}",
93
- :headers => {'Accept'=>'application/json', 'Authorization'=>'test', 'User-Agent'=>'Capgun.io Ruby Gem 0.1.2'}).
93
+ :headers => {'Accept'=>'application/json', 'Authorization'=>'test', 'User-Agent'=>'Capgun.io Ruby Gem 0.2.0'}).
94
94
  to_return(:status => 200, :body => fixture("order.json"), :headers => {})
95
95
 
96
96
  order = Capgun.capture("http://example.com/test")
@@ -101,7 +101,7 @@ describe Capgun::Client do
101
101
  specify "capture with options can be in a block" do
102
102
  stub_request(:post, "https://api.capgun.io/v1/orders.json").
103
103
  with(:body => '{"packages":["images","viewport"],"viewport":"1024x2048","url":"http://example.com/test"}',
104
- :headers => {'Accept'=>'application/json', 'Authorization'=>'test', 'User-Agent'=>'Capgun.io Ruby Gem 0.1.2'}).
104
+ :headers => {'Accept'=>'application/json', 'Authorization'=>'test', 'User-Agent'=>'Capgun.io Ruby Gem 0.2.0'}).
105
105
  to_return(:status => 200, :body => fixture("order-with-options.json"), :headers => {})
106
106
 
107
107
  order = Capgun.capture("http://example.com/test", :packages => [ :images, :viewport ], :viewport => "1024x2048")
@@ -114,7 +114,7 @@ describe Capgun::Client do
114
114
  specify "capture with options can be in a block" do
115
115
  stub_request(:post, "https://api.capgun.io/v1/orders.json").
116
116
  with(:body => '{"viewport":"1024x2048","packages":["images","viewport"],"url":"http://example.com/test"}',
117
- :headers => {'Accept'=>'application/json', 'Authorization'=>'test', 'User-Agent'=>'Capgun.io Ruby Gem 0.1.2'}).
117
+ :headers => {'Accept'=>'application/json', 'Authorization'=>'test', 'User-Agent'=>'Capgun.io Ruby Gem 0.2.0'}).
118
118
  to_return(:status => 200, :body => fixture("order-with-options.json"), :headers => {})
119
119
 
120
120
  order = Capgun.capture("http://example.com/test", :viewport => "200x100") do |options|
@@ -129,7 +129,7 @@ describe Capgun::Client do
129
129
 
130
130
  specify "showing a capture order" do
131
131
  stub_request(:get, "https://api.capgun.io/v1/orders/4fd20a1288f560177600000a.json").
132
- with(:headers => {'Accept'=>'application/json', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'test', 'User-Agent'=>'Capgun.io Ruby Gem 0.1.2'}).
132
+ with(:headers => {'Accept'=>'application/json', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'test', 'User-Agent'=>'Capgun.io Ruby Gem 0.2.0'}).
133
133
  to_return(:status => 200, :body => fixture("order.json"), :headers => {})
134
134
 
135
135
  order = Capgun.order("4fd20a1288f560177600000a")
@@ -139,7 +139,7 @@ describe Capgun::Client do
139
139
 
140
140
  specify "capture jobs have a status" do
141
141
  stub_request(:get, "https://api.capgun.io/v1/jobs/4fd20a1288f5601776000012.json").
142
- with(:headers => {'Accept'=>'application/json', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'test', 'User-Agent'=>'Capgun.io Ruby Gem 0.1.2'}).
142
+ with(:headers => {'Accept'=>'application/json', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'test', 'User-Agent'=>'Capgun.io Ruby Gem 0.2.0'}).
143
143
  to_return(:status => 200, :body => fixture('job.json'), :headers => {})
144
144
 
145
145
 
@@ -150,7 +150,7 @@ describe Capgun::Client do
150
150
 
151
151
  specify "account can be retrieved" do
152
152
  stub_request(:get, "https://api.capgun.io/v1/account.json").
153
- with(:headers => {'Accept'=>'application/json', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'test', 'User-Agent'=>'Capgun.io Ruby Gem 0.1.2'}).
153
+ with(:headers => {'Accept'=>'application/json', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'test', 'User-Agent'=>'Capgun.io Ruby Gem 0.2.0'}).
154
154
  to_return(:status => 200, :body => fixture('account.json'), :headers => {})
155
155
 
156
156
  account = Capgun.account
@@ -24,7 +24,7 @@ describe Capgun::Config do
24
24
  :endpoint => "http://example.com/api",
25
25
  :gateway => nil,
26
26
  :proxy => nil,
27
- :user_agent => "Capgun.io Ruby Gem 0.1.2"
27
+ :user_agent => "Capgun.io Ruby Gem 0.2.0"
28
28
  }
29
29
  end
30
30
  end
@@ -4,7 +4,7 @@ describe "Capgun::Version" do
4
4
 
5
5
  describe '.to_s' do
6
6
  specify "represents current library version" do
7
- Capgun::Version.to_s.should == "0.1.2"
7
+ Capgun::Version.to_s.should == "0.2.0"
8
8
  end
9
9
  end
10
10
 
@@ -19,7 +19,7 @@ describe Faraday::Response do
19
19
  context "when HTTP status is #{status}" do
20
20
  before do
21
21
  stub_request(:get, "https://api.capgun.io/v1/jobs/abc123.json").
22
- with(:headers => {'Accept'=>'application/json', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'', 'User-Agent'=>'Capgun.io Ruby Gem 0.1.2'}).
22
+ with(:headers => {'Accept'=>'application/json', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'', 'User-Agent'=>'Capgun.io Ruby Gem 0.2.0'}).
23
23
  to_return(:status => status, :body => "", :headers => {})
24
24
  end
25
25
 
@@ -35,7 +35,7 @@ describe Faraday::Response do
35
35
  before do
36
36
  body_message = '{"'+body+'":"test"}' unless body.nil?
37
37
  stub_request(:get, "https://api.capgun.io/v1/jobs/abc123.json").
38
- with(:headers => {'Accept'=>'application/json', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'', 'User-Agent'=>'Capgun.io Ruby Gem 0.1.2'}).
38
+ with(:headers => {'Accept'=>'application/json', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'', 'User-Agent'=>'Capgun.io Ruby Gem 0.2.0'}).
39
39
  to_return(:status => status, :body => body_message, :headers => {})
40
40
  end
41
41
 
@@ -54,7 +54,7 @@ describe Faraday::Response do
54
54
  before do
55
55
 
56
56
  stub_request(:get, "https://api.capgun.io/v1/jobs/abc123.json").
57
- with(:headers => {'Accept'=>'application/json', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'', 'User-Agent'=>'Capgun.io Ruby Gem 0.1.2'}).
57
+ with(:headers => {'Accept'=>'application/json', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'', 'User-Agent'=>'Capgun.io Ruby Gem 0.2.0'}).
58
58
  to_return(:status => 404, :body => fixture('notfound.json'), :headers => {})
59
59
  end
60
60
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capgun
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Mondragon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-12 00:00:00.000000000 Z
11
+ date: 2013-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,36 +16,16 @@ dependencies:
16
16
  requirements:
17
17
  - - '>='
18
18
  - !ruby/object:Gem::Version
19
- version: 2.3.9
20
- - - <
21
- - !ruby/object:Gem::Version
22
- version: '4'
19
+ version: '0'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
24
  - - '>='
28
25
  - !ruby/object:Gem::Version
29
- version: 2.3.9
30
- - - <
31
- - !ruby/object:Gem::Version
32
- version: '4'
26
+ version: '0'
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: faraday
35
- requirement: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - ~>
38
- - !ruby/object:Gem::Version
39
- version: '0.8'
40
- type: :runtime
41
- prerelease: false
42
- version_requirements: !ruby/object:Gem::Requirement
43
- requirements:
44
- - - ~>
45
- - !ruby/object:Gem::Version
46
- version: '0.8'
47
- - !ruby/object:Gem::Dependency
48
- name: json
49
29
  requirement: !ruby/object:Gem::Requirement
50
30
  requirements:
51
31
  - - '>='
@@ -62,16 +42,16 @@ dependencies:
62
42
  name: multi_json
63
43
  requirement: !ruby/object:Gem::Requirement
64
44
  requirements:
65
- - - ~>
45
+ - - '>='
66
46
  - !ruby/object:Gem::Version
67
- version: '1.3'
47
+ version: '0'
68
48
  type: :runtime
69
49
  prerelease: false
70
50
  version_requirements: !ruby/object:Gem::Requirement
71
51
  requirements:
72
- - - ~>
52
+ - - '>='
73
53
  - !ruby/object:Gem::Version
74
- version: '1.3'
54
+ version: '0'
75
55
  - !ruby/object:Gem::Dependency
76
56
  name: rake
77
57
  requirement: !ruby/object:Gem::Requirement