hyperclient 0.8.2 → 0.8.3

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: 1bde74927d1e402d1db9cfd3860e36d692bcba2b
4
- data.tar.gz: f65e61030043163822906124088bfba6ff47b72e
3
+ metadata.gz: bed16cb9c2392b30c87a860e6ec535b6d3fc7be8
4
+ data.tar.gz: 5ac012a05c90ba7972bb4bf438a02059fb42ca49
5
5
  SHA512:
6
- metadata.gz: 5b4716aad58beaeb9566564ba214afc7d69e31f8ea080ae12c26e10d3322e602d72c552e66bcd5d5653dc2c683499178fc34e0802b47c019848b97c6f35be617
7
- data.tar.gz: c1cd3c5ecbf2ed9112da1a7a6a4cea0f11abcdbb51c0473bed46c15b5f3be299456c7675b10fe9b51dba6c3fbb690b5517331ef4c05e5a8c9302fbd866107075
6
+ metadata.gz: 3a71056f91a8b0748fe4a381cec303d48f452090a05a4bacad87f1f36c51a302e85876e91a6241e7030b1e8f3e6fdd99beb7cb79796b88f96f84cd8c453c51c5
7
+ data.tar.gz: 2f8cf4720cd00317c958a4947b41bb3562f8df4727141f5575ebf37ba3c28d8da27a7517b88879f2baceb016234d39ec8d4858f2aad3c8d599c194147118fa26
data/.rubocop_todo.yml CHANGED
@@ -25,7 +25,7 @@ Metrics/MethodLength:
25
25
  # Offense count: 3
26
26
  # Configuration parameters: CountComments.
27
27
  Metrics/ModuleLength:
28
- Max: 391
28
+ Max: 398
29
29
 
30
30
  # Offense count: 1
31
31
  Style/AsciiComments:
data/.travis.yml CHANGED
@@ -10,13 +10,18 @@ matrix:
10
10
  - rvm: 2.3.1
11
11
  - rvm: 2.3.0
12
12
  - rvm: 2.2.5
13
+ - rvm: 2.4.0
13
14
  - rvm: rbx-2
14
15
  - rvm: ruby-head
15
16
  - rvm: jruby-head
16
- - rvm: jruby-9.1.6.0
17
+ - rvm: jruby-9.1.7.0
17
18
  allow_failures:
18
19
  - rvm: ruby-head
19
20
  - rvm: jruby-head
20
21
  - rvm: rbx-2
21
22
 
23
+ before_install:
24
+ - gem update --system
25
+ - gem install bundler
26
+
22
27
  bundler_args: --without development
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ### 0.8.3 (March 30, 2017)
2
+
3
+ * [#115](https://github.com/codegram/hyperclient/pull/115): Fix dropped values from queries by using FlatParamsEncoder - [@ivoanjo](https://github.com/ivoanjo).
4
+
1
5
  ### 0.8.2 (December 31, 2016)
2
6
 
3
7
  #### This version is no longer tested with Ruby < 2.2.
data/Rakefile CHANGED
@@ -20,8 +20,6 @@ YARD::Rake::YardocTask.new do |t|
20
20
  t.options = %w(-r README.md)
21
21
  end
22
22
 
23
- Bundler::GemHelper.install_tasks
24
-
25
23
  require 'rake/testtask'
26
24
 
27
25
  Rake::TestTask.new(:test) do |t|
@@ -12,6 +12,11 @@ Feature: API navigation
12
12
  When I search for a post with a templated link
13
13
  Then the API should receive the request with all the params
14
14
 
15
+ Scenario: Templated links with multiple values
16
+ Given I connect to the API
17
+ When I search for posts by tag with a templated link
18
+ Then the API should receive the request for posts by tag with all the params
19
+
15
20
  Scenario: Attributes
16
21
  Given I connect to the API
17
22
  When I load a single post
@@ -17,6 +17,14 @@ class Spinach::Features::ApiNavigation < Spinach::FeatureSteps
17
17
  assert_requested :get, 'http://api.example.org/search?q=something'
18
18
  end
19
19
 
20
+ step 'I search for posts by tag with a templated link' do
21
+ api._links.tagged._expand(tags: %w(foo bar))._resource
22
+ end
23
+
24
+ step 'the API should receive the request for posts by tag with all the params' do
25
+ assert_requested :get, 'http://api.example.org/search?tags=foo&tags=bar'
26
+ end
27
+
20
28
  step 'I load a single post' do
21
29
  @post = api._links.posts._links.last_post
22
30
  end
@@ -5,6 +5,8 @@ module API
5
5
  include Spinach::Fixtures
6
6
 
7
7
  before do
8
+ WebMock::Config.instance.query_values_notation = :flat_array
9
+
8
10
  stub_request(:any, %r{api.example.org*}).to_return(body: root_response, headers: { 'Content-Type' => 'application/hal+json' })
9
11
  stub_request(:get, 'api.example.org/posts').to_return(body: posts_response, headers: { 'Content-Type' => 'application/hal+json' })
10
12
  stub_request(:get, 'api.example.org/posts/1').to_return(body: post_response, headers: { 'Content-Type' => 'application/hal+json' })
@@ -8,6 +8,7 @@ module Spinach
8
8
  "self": { "href": "/" },
9
9
  "posts": { "href": "/posts" },
10
10
  "search": { "href": "/search{?q}", "templated": true },
11
+ "tagged": { "href": "/search{?tags*}", "templated": true },
11
12
  "api:authors": { "href": "/authors" },
12
13
  "next": { "href": "/page2" }
13
14
  }
@@ -40,6 +40,7 @@ module Hyperclient
40
40
  @entry_point = self
41
41
  @options = { async: true }
42
42
  @connection = nil
43
+ @resource = nil
43
44
  yield self if block_given?
44
45
  end
45
46
 
@@ -138,6 +139,7 @@ module Hyperclient
138
139
  connection.request :hal_json
139
140
  connection.response :hal_json, content_type: /\bjson$/
140
141
  connection.adapter :net_http
142
+ connection.options.params_encoder = Faraday::FlatParamsEncoder
141
143
  end
142
144
  end
143
145
 
@@ -1,3 +1,3 @@
1
1
  module Hyperclient
2
- VERSION = '0.8.2'.freeze
2
+ VERSION = '0.8.3'.freeze
3
3
  end
@@ -33,11 +33,14 @@ module Hyperclient
33
33
 
34
34
  it 'creates a Faraday connection with the default block' do
35
35
  handlers = entry_point.connection.builder.handlers
36
+
36
37
  handlers.must_include Faraday::Response::RaiseError
37
38
  handlers.must_include FaradayMiddleware::FollowRedirects
38
39
  handlers.must_include FaradayMiddleware::EncodeHalJson
39
40
  handlers.must_include FaradayMiddleware::ParseHalJson
40
41
  handlers.must_include Faraday::Adapter::NetHttp
42
+
43
+ entry_point.connection.options.params_encoder.must_equal Faraday::FlatParamsEncoder
41
44
  end
42
45
 
43
46
  it 'raises a ConnectionAlreadyInitializedError if attempting to modify headers' do
@@ -172,12 +175,15 @@ module Hyperclient
172
175
 
173
176
  it 'creates a Faraday connection with the default block plus any additional handlers' do
174
177
  handlers = entry_point.connection.builder.handlers
178
+
175
179
  handlers.must_include Faraday::Request::OAuth
176
180
  handlers.must_include Faraday::Response::RaiseError
177
181
  handlers.must_include FaradayMiddleware::FollowRedirects
178
182
  handlers.must_include FaradayMiddleware::EncodeHalJson
179
183
  handlers.must_include FaradayMiddleware::ParseHalJson
180
184
  handlers.must_include Faraday::Adapter::NetHttp
185
+
186
+ entry_point.connection.options.params_encoder.must_equal Faraday::FlatParamsEncoder
181
187
  end
182
188
  end
183
189
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hyperclient
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oriol Gual
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-31 00:00:00.000000000 Z
11
+ date: 2017-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -183,29 +183,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
183
183
  version: '0'
184
184
  requirements: []
185
185
  rubyforge_project:
186
- rubygems_version: 2.5.1
186
+ rubygems_version: 2.6.11
187
187
  signing_key:
188
188
  specification_version: 4
189
189
  summary: ''
190
- test_files:
191
- - features/api_navigation.feature
192
- - features/default_config.feature
193
- - features/steps/api_navigation.rb
194
- - features/steps/default_config.rb
195
- - features/support/api.rb
196
- - features/support/env.rb
197
- - features/support/fixtures.rb
198
- - test/faraday/connection_test.rb
199
- - test/fixtures/collection.json
200
- - test/fixtures/element.json
201
- - test/fixtures/root.json
202
- - test/hyperclient/attributes_test.rb
203
- - test/hyperclient/collection_test.rb
204
- - test/hyperclient/curie_test.rb
205
- - test/hyperclient/entry_point_test.rb
206
- - test/hyperclient/link_collection_test.rb
207
- - test/hyperclient/link_test.rb
208
- - test/hyperclient/resource_collection_test.rb
209
- - test/hyperclient/resource_test.rb
210
- - test/hyperclient_test.rb
211
- - test/test_helper.rb
190
+ test_files: []