bootic_client 0.0.15 → 0.0.16

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: 108342ffa36bdaa0249839395c81134746d41cbb
4
- data.tar.gz: 65e2f9a55e7f6b8066164a9237d29a6b9a61fc96
3
+ metadata.gz: e7f98b734f2884a9f8c5a40883dd7426115abe22
4
+ data.tar.gz: 0c80cdac66d64b0c3d48faafff8e0fe867c0fe96
5
5
  SHA512:
6
- metadata.gz: cf0a58fe90751a1f8bb9a50a6ad226f0e0e5131812a7ee9dedc1222c4410aa5797ecf1ce2789c18087362f091180b736c19f0ba71c63873790afe5cc9e4af60b
7
- data.tar.gz: 5330b361a1a03701db99f4a05be166544cd829348f42cea28af6c8e92cabb2f3b9b7307ce16f8234d3b8daa1d7af7d6870e55b2e0a0a080d9c83cac7599c07d9
6
+ metadata.gz: 636f37d3746179433205e236f6a142eb9f2483cb7f76bb3477fed08e5ab284702a17077722ebe7fb6dba6e7353a68b79c84aa7b12903d5fcb7fa61a13ee09fac
7
+ data.tar.gz: 8d20783ca33a7154b84965cd3560d138f6bf690c8a2107356d43006452948fb0013a5ffd167a95aaab76e6c202a7e5d897b2c3967a5b138de2ca664f1d109c9b
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.3.1
data/.travis.yml CHANGED
@@ -1,3 +1,3 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2.2
3
+ - 2.3.1
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
 
@@ -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", "~> 1"
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
@@ -43,6 +43,10 @@ module BooticClient
43
43
  attrs['docs']
44
44
  end
45
45
 
46
+ def to_hash
47
+ attrs
48
+ end
49
+
46
50
  def transport_method
47
51
  @transport_method ||= attrs['method'] || GET
48
52
  end
@@ -1,3 +1,3 @@
1
1
  module BooticClient
2
- VERSION = "0.0.15"
2
+ VERSION = "0.0.16"
3
3
  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.stub(:now).and_return now
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://aaa:bbb@auth.bootic.net/oauth/token").
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.stub(:new).with(['localhost:1112'], foo: 'bar').and_return dalli
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|
@@ -2,7 +2,8 @@ require 'spec_helper'
2
2
 
3
3
  describe BooticClient::Relation do
4
4
  let(:client) { double(:client) }
5
- let(:relation) { BooticClient::Relation.new({'href' => '/foo/bars', 'type' => 'application/json', 'title' => 'A relation', 'name' => 'self'}, client) }
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.stub(:request_and_wrap).with(:get, '/foo/bars', BooticClient::Entity, {}).and_return entity
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.stub(:request_and_wrap).with(:post, '/foo/bars', BooticClient::Entity, {}).and_return entity
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.stub(:request_and_wrap).with(:post, '/foo/123', BooticClient::Entity, {foo: 'bar'}).and_return entity
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.stub(:request_and_wrap).with(:delete, '/foo/bars', BooticClient::Entity, {}).and_return entity
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
@@ -3,6 +3,8 @@ require 'bootic_client'
3
3
  require 'byebug'
4
4
 
5
5
  RSpec.configure do |config|
6
+ config.raise_errors_for_deprecations!
7
+
6
8
  config.expect_with :rspec do |c|
7
9
  c.syntax = :expect
8
10
  end
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.15
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: 2016-12-03 00:00:00.000000000 Z
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: '1'
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: '1'
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: '0'
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: '0'
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.4.5
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