bootic_client 0.0.16 → 0.0.17

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: e7f98b734f2884a9f8c5a40883dd7426115abe22
4
- data.tar.gz: 0c80cdac66d64b0c3d48faafff8e0fe867c0fe96
3
+ metadata.gz: e6d9d6472ee6d6d5ee26f1990f332eb1237b5769
4
+ data.tar.gz: 31a1c0ac6719d1ec0491b9da3a595491e50379e8
5
5
  SHA512:
6
- metadata.gz: 636f37d3746179433205e236f6a142eb9f2483cb7f76bb3477fed08e5ab284702a17077722ebe7fb6dba6e7353a68b79c84aa7b12903d5fcb7fa61a13ee09fac
7
- data.tar.gz: 8d20783ca33a7154b84965cd3560d138f6bf690c8a2107356d43006452948fb0013a5ffd167a95aaab76e6c202a7e5d897b2c3967a5b138de2ca664f1d109c9b
6
+ metadata.gz: ebae4dfbebe06f14fd5c6d63931a92f5be0421beca9c37a9d0507a7049a71118af2341c8d1077c127c55a711c089917d477a49ab7d0eded308fd6a2152d61995
7
+ data.tar.gz: 3ba8bf14ac98e1413726778b0a1eacaaf87ab148c056b51435156f8268487b982956973afd4e3a79f8d99f6d77d54f4d63a825982cf30e7e68741dad904e1336
data/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Change Log
2
2
 
3
+ ## [Unreleased](https://github.com/bootic/bootic_client.rb/tree/HEAD)
4
+
5
+ [Full Changelog](https://github.com/bootic/bootic_client.rb/compare/v0.0.16...HEAD)
6
+
7
+ **Merged pull requests:**
8
+
9
+ - Client\#from\_url\(url\) [\#9](https://github.com/bootic/bootic_client.rb/pull/9) ([ismasan](https://github.com/ismasan))
10
+
11
+ ## [v0.0.16](https://github.com/bootic/bootic_client.rb/tree/v0.0.16) (2017-04-01)
12
+ [Full Changelog](https://github.com/bootic/bootic_client.rb/compare/v0.0.15...v0.0.16)
13
+
14
+ **Merged pull requests:**
15
+
16
+ - Add Relation\#to\_hash [\#8](https://github.com/bootic/bootic_client.rb/pull/8) ([ismasan](https://github.com/ismasan))
17
+
3
18
  ## [v0.0.15](https://github.com/bootic/bootic_client.rb/tree/v0.0.15) (2016-12-03)
4
19
  [Full Changelog](https://github.com/bootic/bootic_client.rb/compare/v0.0.14...v0.0.15)
5
20
 
data/Gemfile CHANGED
@@ -5,6 +5,5 @@ gemspec
5
5
 
6
6
  group :test do
7
7
  gem 'byebug' if RUBY_VERSION.to_i >= 2
8
- gem 'vcr', '~> 2.4'
9
8
  gem 'webmock', '1.22.3'
10
9
  end
data/README.md CHANGED
@@ -254,6 +254,13 @@ new_message = messaging_api.send_message(title: 'This is a new message')
254
254
  messaging_api.delete_message(id: new_message.id)
255
255
  ```
256
256
 
257
+ It's also possibe to load a root resource directly from a URL:
258
+
259
+ ```ruby
260
+ messaging_api_root = client.from_url("https://some.api.com")
261
+ messaging_api.do_something(foo: "bar") # etc
262
+ ```
263
+
257
264
  ## Contributing
258
265
 
259
266
  1. Fork it
@@ -28,6 +28,6 @@ Gem::Specification.new do |spec|
28
28
  spec.add_development_dependency "bundler", "~> 1.3"
29
29
  spec.add_development_dependency "rake"
30
30
  spec.add_development_dependency "rspec", "3.5.0"
31
- spec.add_development_dependency "jwt"
32
- spec.add_development_dependency "dalli"
31
+ spec.add_development_dependency "jwt", "~> 1.5"
32
+ spec.add_development_dependency "dalli", "~> 2.7"
33
33
  end
@@ -17,6 +17,10 @@ module BooticClient
17
17
  wrapper_class.new hash, self
18
18
  end
19
19
 
20
+ def from_url(url, wrapper_class = Entity)
21
+ request_and_wrap :get, url, wrapper_class
22
+ end
23
+
20
24
  def request_and_wrap(request_method, href, wrapper_class, payload = {})
21
25
  pre_flight
22
26
  retryable do
@@ -1,3 +1,3 @@
1
1
  module BooticClient
2
- VERSION = "0.0.16"
2
+ VERSION = "0.0.17"
3
3
  end
@@ -153,5 +153,16 @@ describe 'BooticClient::Strategies::Authorized' do
153
153
  expect(entity.can?(:delete)).to be true
154
154
  end
155
155
  end
156
+
157
+ describe '#from_url' do
158
+ it 'builds and returns an entity' do
159
+ authorized_request = stub_request(:get, "https://api.bootic.net/v1/shops").
160
+ to_return(status: 200, :body => JSON.dump(title: 'All shops'))
161
+
162
+ entity = client.from_url('https://api.bootic.net/v1/shops')
163
+ expect(entity).to be_kind_of(BooticClient::Entity)
164
+ expect(entity.title).to eql('All shops')
165
+ end
166
+ end
156
167
  end
157
168
  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.16
4
+ version: 0.0.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ismael Celis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-01 00:00:00.000000000 Z
11
+ date: 2017-04-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -140,30 +140,30 @@ dependencies:
140
140
  name: jwt
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - ">="
143
+ - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: '0'
145
+ version: '1.5'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - ">="
150
+ - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: '0'
152
+ version: '1.5'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: dalli
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - ">="
157
+ - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: '0'
159
+ version: '2.7'
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - ">="
164
+ - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: '0'
166
+ version: '2.7'
167
167
  description: Official Ruby client for the Bootic API
168
168
  email:
169
169
  - ismaelct@gmail.com