bootic_client 0.0.11 → 0.0.12

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: b0fe4d2179d68484e7f21e30403d998eb4ae3e8d
4
- data.tar.gz: 6fdb516289750547db392d3c7028ec28b2cf4fe3
3
+ metadata.gz: 3ffc22cb79a7dd6547c654277f79f4378430bb40
4
+ data.tar.gz: dc0359cafd1b9f3725eea8a91a7119d868e513c0
5
5
  SHA512:
6
- metadata.gz: 9093feed798a80679903c1c1d1a47d8b5118fd17ae1cf17f622257a91e3f462fd2087eeaae2aade8a5fa47ea664b9c311ce50b8c4d5dc69e9f80adb7f9adaf99
7
- data.tar.gz: 1d5058a3d702c82084cf94686165156a518abb929990be3711676c2a467067f0bcf7473600ead9a05e46a945be8fe558448407f92ac3195bc0ffca5d44a90a1a
6
+ metadata.gz: 3b39b0bdc1ec0e14397b7edbbac05476f14865656eedbb40b64d44879cf6f4ab94ec6a8dc51f748a234c3873b4876a830dcc8c4e4d49305ba2f3c4b1ed36b45f
7
+ data.tar.gz: 68e20485190e6717dbb2557bc32d7c0cb8a0f4092780bf77fcb8aaa100809c847f2ac46b6228a99b01a02e8d36405a46fe520f6b2628bc3b110801f5eef353dd
data/CHANGELOG.md CHANGED
@@ -1,11 +1,19 @@
1
1
  # Change Log
2
2
 
3
- ## [v0.0.9](https://github.com/bootic/bootic_client.rb/tree/v0.0.9) (2015-05-01)
3
+ ## [v0.0.11](https://github.com/bootic/bootic_client.rb/tree/v0.0.11) (2015-10-28)
4
+ [Full Changelog](https://github.com/bootic/bootic_client.rb/compare/v0.0.10...v0.0.11)
5
+
6
+ ## [v0.0.10](https://github.com/bootic/bootic_client.rb/tree/v0.0.10) (2015-09-24)
7
+ [Full Changelog](https://github.com/bootic/bootic_client.rb/compare/v0.0.9...v0.0.10)
8
+
9
+ **Merged pull requests:**
4
10
 
11
+ - Relation\#parameters lists available parameter names for templated URLs. [\#3](https://github.com/bootic/bootic_client.rb/pull/3) ([ismasan](https://github.com/ismasan))
12
+
13
+ ## [v0.0.9](https://github.com/bootic/bootic_client.rb/tree/v0.0.9) (2015-05-01)
5
14
  [Full Changelog](https://github.com/bootic/bootic_client.rb/compare/v0.0.8...v0.0.9)
6
15
 
7
16
  ## [v0.0.8](https://github.com/bootic/bootic_client.rb/tree/v0.0.8) (2015-04-06)
8
-
9
17
  [Full Changelog](https://github.com/bootic/bootic_client.rb/compare/v0.0.7...v0.0.8)
10
18
 
11
19
  **Merged pull requests:**
@@ -13,11 +21,9 @@
13
21
  - Basic auth strategy [\#2](https://github.com/bootic/bootic_client.rb/pull/2) ([ismasan](https://github.com/ismasan))
14
22
 
15
23
  ## [v0.0.7](https://github.com/bootic/bootic_client.rb/tree/v0.0.7) (2015-03-07)
16
-
17
24
  [Full Changelog](https://github.com/bootic/bootic_client.rb/compare/v0.0.6...v0.0.7)
18
25
 
19
26
  ## [v0.0.6](https://github.com/bootic/bootic_client.rb/tree/v0.0.6) (2015-01-29)
20
-
21
27
  [Full Changelog](https://github.com/bootic/bootic_client.rb/compare/v0.0.5...v0.0.6)
22
28
 
23
29
  **Merged pull requests:**
@@ -25,23 +31,18 @@
25
31
  - Enumerable list entities [\#1](https://github.com/bootic/bootic_client.rb/pull/1) ([ismasan](https://github.com/ismasan))
26
32
 
27
33
  ## [v0.0.5](https://github.com/bootic/bootic_client.rb/tree/v0.0.5) (2014-07-27)
28
-
29
34
  [Full Changelog](https://github.com/bootic/bootic_client.rb/compare/v0.0.4...v0.0.5)
30
35
 
31
36
  ## [v0.0.4](https://github.com/bootic/bootic_client.rb/tree/v0.0.4) (2014-07-13)
32
-
33
37
  [Full Changelog](https://github.com/bootic/bootic_client.rb/compare/v0.0.3...v0.0.4)
34
38
 
35
39
  ## [v0.0.3](https://github.com/bootic/bootic_client.rb/tree/v0.0.3) (2014-06-21)
36
-
37
40
  [Full Changelog](https://github.com/bootic/bootic_client.rb/compare/v0.0.2...v0.0.3)
38
41
 
39
42
  ## [v0.0.2](https://github.com/bootic/bootic_client.rb/tree/v0.0.2) (2014-06-17)
40
-
41
43
  [Full Changelog](https://github.com/bootic/bootic_client.rb/compare/v0.0.1...v0.0.2)
42
44
 
43
45
  ## [v0.0.1](https://github.com/bootic/bootic_client.rb/tree/v0.0.1) (2014-06-15)
44
46
 
45
47
 
46
-
47
48
  \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.add_dependency "faraday", '~> 0.9'
22
22
  spec.add_dependency "uri_template", '~> 0.7'
23
23
  spec.add_dependency "faraday_middleware", '~> 0.9'
24
- spec.add_dependency "faraday-http-cache", '0.4.2'
24
+ spec.add_dependency "faraday-http-cache", '1.2.2'
25
25
  spec.add_dependency "net-http-persistent", '~> 2.9'
26
26
  spec.add_dependency "oauth2", "~> 1"
27
27
 
@@ -21,14 +21,15 @@ module BooticClient
21
21
  iss: config.client_id,
22
22
  prn: client.options[:access_token],
23
23
  aud: 'api',
24
- exp: exp
24
+ exp: exp,
25
+ scope: ''
25
26
  )
26
27
 
27
28
  access_token.token
28
29
  end
29
30
 
30
31
  def auth
31
- @auth ||= OAuth2::Client.new(nil, nil, site: config.auth_host)
32
+ @auth ||= OAuth2::Client.new('', '', site: config.auth_host)
32
33
  end
33
34
  end
34
35
 
@@ -1,3 +1,3 @@
1
1
  module BooticClient
2
- VERSION = "0.0.11"
2
+ VERSION = "0.0.12"
3
3
  end
@@ -22,7 +22,7 @@ describe 'BooticClient::Strategies::Authorized' do
22
22
  to_return(status: status, :body => JSON.dump(body))
23
23
  end
24
24
 
25
- def stub_auth(expired_token, status, body)
25
+ def stub_auth(expired_token, status, body, client_id: '', client_secret: '', scope: '')
26
26
  now = Time.now
27
27
  Time.stub(:now).and_return now
28
28
 
@@ -30,10 +30,10 @@ describe 'BooticClient::Strategies::Authorized' do
30
30
  with(body: {
31
31
  "assertion" => jwt_assertion(expired_token, now),
32
32
  "assertion_type" => "urn:ietf:params:oauth:grant-type:jwt-bearer",
33
- "client_id" => "",
34
- "client_secret" => "",
33
+ "client_id" => client_id,
34
+ "client_secret" => client_secret,
35
35
  "grant_type" => "assertion",
36
- "scope"=>""
36
+ "scope"=>scope
37
37
  },
38
38
  headers: {
39
39
  'Content-Type'=>'application/x-www-form-urlencoded'
data/spec/client_spec.rb CHANGED
@@ -12,10 +12,11 @@ describe BooticClient::Client do
12
12
  }
13
13
  let(:response_headers) {
14
14
  {
15
- 'Content-Type' => 'application/json',
15
+ 'Content-Type' => 'application/json',
16
16
  'Last-Modified' => 'Sat, 07 Jun 2014 12:10:33 GMT',
17
17
  'ETag' => '0937dafce10db7b7d405667f9576d26d',
18
- 'Cache-Control' => 'max-age=0, private, must-revalidate'
18
+ 'Cache-Control' => 'max-age=0, private, must-revalidate',
19
+ 'Vary' => 'Acept-Encoding,Authorization'
19
20
  }
20
21
  }
21
22
  let(:root_data) {
@@ -28,6 +29,37 @@ describe BooticClient::Client do
28
29
  }
29
30
 
30
31
  describe '#get' do
32
+ def assert_successful_response(response)
33
+ expect(response).to be_kind_of(Faraday::Response)
34
+ expect(response.status).to eql(200)
35
+ response.body.tap do |b|
36
+ expect(b['_links']['shops']).to eql({'href' => 'https://api.bootic.net/v1/products'})
37
+ end
38
+ end
39
+
40
+ context 'switching cache key as per Vary header' do
41
+ let!(:req) {
42
+ stub_request(:get, root_url)
43
+ .to_return(status: 200, body: JSON.dump(root_data), headers: response_headers.merge('Cache-Control' => 'max-age=100'))
44
+ }
45
+
46
+ before do
47
+ client.get(root_url, {}, request_headers.merge('Authorization' => 'Bearer aaa'))
48
+ end
49
+
50
+ it 'is cached when using the same authorization' do
51
+ resp = client.get(root_url, {}, request_headers.merge('Authorization' => 'Bearer aaa'))
52
+ expect(req).to have_been_requested.once
53
+ assert_successful_response resp
54
+ end
55
+
56
+ it 'is not cached when using a different authorization' do
57
+ resp = client.get(root_url, {}, request_headers.merge('Authorization' => 'Bearer bbb'))
58
+ expect(req).to have_been_requested.twice
59
+ assert_successful_response resp
60
+ end
61
+
62
+ end
31
63
 
32
64
  context 'fresh' do
33
65
  before do
@@ -38,11 +70,7 @@ describe BooticClient::Client do
38
70
  let!(:response) { client.get(root_url, {}, request_headers) }
39
71
 
40
72
  it 'returns parsed Faraday response' do
41
- expect(response).to be_kind_of(Faraday::Response)
42
- expect(response.status).to eql(200)
43
- response.body.tap do |b|
44
- expect(b['_links']['shops']).to eql({'href' => 'https://api.bootic.net/v1/products'})
45
- end
73
+ assert_successful_response response
46
74
  end
47
75
 
48
76
  context 'and then cached' do
@@ -53,13 +81,10 @@ describe BooticClient::Client do
53
81
  end
54
82
 
55
83
  it 'returns cached response' do
56
- r = client.get(root_url, {}, request_headers)
84
+ resp = client.get(root_url, {}, request_headers)
57
85
  expect(@cached_request).to have_been_requested
58
86
 
59
- expect(r.status).to eql(200)
60
- r.body.tap do |b|
61
- expect(b['_links']['shops']).to eql({'href' => 'https://api.bootic.net/v1/products'})
62
- end
87
+ assert_successful_response resp
63
88
  end
64
89
  end
65
90
 
@@ -71,15 +96,13 @@ describe BooticClient::Client do
71
96
  end
72
97
 
73
98
  it 'returns cached response' do
74
- r = client.get(root_url, {}, request_headers)
99
+ resp = client.get(root_url, {}, request_headers)
75
100
  expect(@cached_request).to have_been_requested
76
101
 
77
- expect(r.status).to eql(200)
78
- r.body.tap do |b|
79
- expect(b['_links']['shops']).to eql({'href' => 'https://api.bootic.net/v1/products'})
80
- end
102
+ assert_successful_response resp
81
103
  end
82
104
  end
105
+
83
106
  end
84
107
 
85
108
  context 'errors' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootic_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ismael Celis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-28 00:00:00.000000000 Z
11
+ date: 2016-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 0.4.2
61
+ version: 1.2.2
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: 0.4.2
68
+ version: 1.2.2
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: net-http-persistent
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -221,7 +221,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
221
221
  version: '0'
222
222
  requirements: []
223
223
  rubyforge_project:
224
- rubygems_version: 2.4.8
224
+ rubygems_version: 2.4.5
225
225
  signing_key:
226
226
  specification_version: 4
227
227
  summary: Official Ruby client for the Bootic API