bootic_client 0.0.15 → 0.0.16
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.
- checksums.yaml +4 -4
- data/.ruby-version +1 -0
- data/.travis.yml +1 -1
- data/CHANGELOG.md +7 -0
- data/bootic_client.gemspec +2 -2
- data/lib/bootic_client/relation.rb +4 -0
- data/lib/bootic_client/version.rb +1 -1
- data/spec/authorized_strategy_spec.rb +1 -1
- data/spec/client_credentials_strategy_spec.rb +2 -2
- data/spec/memcache_storage_spec.rb +1 -1
- data/spec/relation_spec.rb +13 -5
- data/spec/spec_helper.rb +2 -0
- metadata +12 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7f98b734f2884a9f8c5a40883dd7426115abe22
|
4
|
+
data.tar.gz: 0c80cdac66d64b0c3d48faafff8e0fe867c0fe96
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 636f37d3746179433205e236f6a142eb9f2483cb7f76bb3477fed08e5ab284702a17077722ebe7fb6dba6e7353a68b79c84aa7b12903d5fcb7fa61a13ee09fac
|
7
|
+
data.tar.gz: 8d20783ca33a7154b84965cd3560d138f6bf690c8a2107356d43006452948fb0013a5ffd167a95aaab76e6c202a7e5d897b2c3967a5b138de2ca664f1d109c9b
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.3.1
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [v0.0.15](https://github.com/bootic/bootic_client.rb/tree/v0.0.15) (2016-12-03)
|
4
|
+
[Full Changelog](https://github.com/bootic/bootic_client.rb/compare/v0.0.14...v0.0.15)
|
5
|
+
|
6
|
+
**Merged pull requests:**
|
7
|
+
|
8
|
+
- Base64-encode any attribute that responds to \#read [\#7](https://github.com/bootic/bootic_client.rb/pull/7) ([ismasan](https://github.com/ismasan))
|
9
|
+
|
3
10
|
## [v0.0.14](https://github.com/bootic/bootic_client.rb/tree/v0.0.14) (2016-04-26)
|
4
11
|
[Full Changelog](https://github.com/bootic/bootic_client.rb/compare/v0.0.13...v0.0.14)
|
5
12
|
|
data/bootic_client.gemspec
CHANGED
@@ -23,11 +23,11 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_dependency "faraday_middleware", '~> 0.9'
|
24
24
|
spec.add_dependency "faraday-http-cache", '1.2.2'
|
25
25
|
spec.add_dependency "net-http-persistent", '~> 2.9'
|
26
|
-
spec.add_dependency "oauth2", "
|
26
|
+
spec.add_dependency "oauth2", "1.3.1"
|
27
27
|
|
28
28
|
spec.add_development_dependency "bundler", "~> 1.3"
|
29
29
|
spec.add_development_dependency "rake"
|
30
|
-
spec.add_development_dependency "rspec"
|
30
|
+
spec.add_development_dependency "rspec", "3.5.0"
|
31
31
|
spec.add_development_dependency "jwt"
|
32
32
|
spec.add_development_dependency "dalli"
|
33
33
|
end
|
@@ -24,7 +24,7 @@ describe 'BooticClient::Strategies::Authorized' do
|
|
24
24
|
|
25
25
|
def stub_auth(expired_token, status, body, client_id: '', client_secret: '', scope: '')
|
26
26
|
now = Time.now
|
27
|
-
Time.
|
27
|
+
allow(Time).to receive(:now).and_return now
|
28
28
|
|
29
29
|
stub_request(:post, "https://auth.bootic.net/oauth/token").
|
30
30
|
with(body: {
|
@@ -25,8 +25,8 @@ describe 'BooticClient::Strategies::ClientCredentials' do
|
|
25
25
|
describe 'with valid client credentials' do
|
26
26
|
|
27
27
|
def stub_auth(status, body)
|
28
|
-
stub_request(:post, "https://
|
29
|
-
with(body: {"grant_type"=>"client_credentials", 'scope' => 'admin'}).
|
28
|
+
stub_request(:post, "https://auth.bootic.net/oauth/token").
|
29
|
+
with(body: {"grant_type"=>"client_credentials", client_id: "aaa", client_secret: "bbb", 'scope' => 'admin'}).
|
30
30
|
to_return(status: status, body: JSON.dump(body), headers: {'Content-Type' => 'application/json'})
|
31
31
|
end
|
32
32
|
|
@@ -6,7 +6,7 @@ describe BooticClient::Stores::Memcache do
|
|
6
6
|
let(:store) { BooticClient::Stores::Memcache.new(['localhost:1112'], foo: 'bar') }
|
7
7
|
|
8
8
|
before do
|
9
|
-
Dalli::Client.
|
9
|
+
allow(Dalli::Client).to receive(:new).with(['localhost:1112'], foo: 'bar').and_return dalli
|
10
10
|
end
|
11
11
|
|
12
12
|
shared_examples_for 'dalli :get' do |method_name|
|
data/spec/relation_spec.rb
CHANGED
@@ -2,7 +2,8 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe BooticClient::Relation do
|
4
4
|
let(:client) { double(:client) }
|
5
|
-
let(:
|
5
|
+
let(:attributes) {{'href' => '/foo/bars', 'type' => 'application/json', 'title' => 'A relation', 'name' => 'self'}}
|
6
|
+
let(:relation) { BooticClient::Relation.new(attributes, client) }
|
6
7
|
|
7
8
|
describe 'attributes' do
|
8
9
|
it 'has readers for known relation attributes' do
|
@@ -13,12 +14,19 @@ describe BooticClient::Relation do
|
|
13
14
|
end
|
14
15
|
end
|
15
16
|
|
17
|
+
describe '#to_hash' do
|
18
|
+
it 'returns attributes' do
|
19
|
+
hash = relation.to_hash
|
20
|
+
expect(hash).to eq attributes
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
16
24
|
describe '#run' do
|
17
25
|
let(:entity) { BooticClient::Entity.new({'title' => 'Foobar'}, client) }
|
18
26
|
|
19
27
|
describe 'running GET by default' do
|
20
28
|
it 'fetches data and returns entity' do
|
21
|
-
client.
|
29
|
+
allow(client).to receive(:request_and_wrap).with(:get, '/foo/bars', BooticClient::Entity, {}).and_return entity
|
22
30
|
expect(relation.run).to eql(entity)
|
23
31
|
end
|
24
32
|
|
@@ -67,12 +75,12 @@ describe BooticClient::Relation do
|
|
67
75
|
let(:relation_templated) { BooticClient::Relation.new({'href' => '/foo/{bars}', 'templated' => true, 'type' => 'application/json', 'name' => 'self', 'method' => 'post'}, client) }
|
68
76
|
|
69
77
|
it 'POSTS data and returns resulting entity' do
|
70
|
-
client.
|
78
|
+
allow(client).to receive(:request_and_wrap).with(:post, '/foo/bars', BooticClient::Entity, {}).and_return entity
|
71
79
|
expect(relation.run).to eql(entity)
|
72
80
|
end
|
73
81
|
|
74
82
|
it 'interpolates templated URLs' do
|
75
|
-
client.
|
83
|
+
allow(client).to receive(:request_and_wrap).with(:post, '/foo/123', BooticClient::Entity, {foo: 'bar'}).and_return entity
|
76
84
|
expect(relation_templated.run(bars: 123, foo: 'bar')).to eql(entity)
|
77
85
|
end
|
78
86
|
end
|
@@ -81,7 +89,7 @@ describe BooticClient::Relation do
|
|
81
89
|
let(:relation) { BooticClient::Relation.new({'href' => '/foo/bars', 'type' => 'application/json', 'name' => 'self', 'method' => 'delete'}, client) }
|
82
90
|
|
83
91
|
it 'DELETEs data and returns resulting entity' do
|
84
|
-
client.
|
92
|
+
allow(client).to receive(:request_and_wrap).with(:delete, '/foo/bars', BooticClient::Entity, {}).and_return entity
|
85
93
|
expect(relation.run).to eql(entity)
|
86
94
|
end
|
87
95
|
end
|
data/spec/spec_helper.rb
CHANGED
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.
|
4
|
+
version: 0.0.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ismael Celis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -84,16 +84,16 @@ dependencies:
|
|
84
84
|
name: oauth2
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - '='
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: 1.3.1
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - '='
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: 1.3.1
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: bundler
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -126,16 +126,16 @@ dependencies:
|
|
126
126
|
name: rspec
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- -
|
129
|
+
- - '='
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
131
|
+
version: 3.5.0
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- -
|
136
|
+
- - '='
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
138
|
+
version: 3.5.0
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: jwt
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -173,6 +173,7 @@ extra_rdoc_files: []
|
|
173
173
|
files:
|
174
174
|
- ".gitignore"
|
175
175
|
- ".rspec"
|
176
|
+
- ".ruby-version"
|
176
177
|
- ".travis.yml"
|
177
178
|
- CHANGELOG.md
|
178
179
|
- Gemfile
|
@@ -222,7 +223,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
222
223
|
version: '0'
|
223
224
|
requirements: []
|
224
225
|
rubyforge_project:
|
225
|
-
rubygems_version: 2.
|
226
|
+
rubygems_version: 2.5.1
|
226
227
|
signing_key:
|
227
228
|
specification_version: 4
|
228
229
|
summary: Official Ruby client for the Bootic API
|