hyperclient 0.9.0 → 0.9.1

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
  SHA256:
3
- metadata.gz: f96f4a987e6b56ca1668ea89fb5d93affb0360f6200b164ad45593dcaa2de8d3
4
- data.tar.gz: 1aded500fd45aa1e80817df0807ebae6d67814d79313d7b30b2552f2abe08695
3
+ metadata.gz: 494b4be638b3b6d76edd4d07e5b12e36433dfd84c9a756dec34a278fd9ea2faa
4
+ data.tar.gz: 1d9e97e2a76cdf4a991a5803bd14eadf40ae300e4065cbacdedee64b66f19a3c
5
5
  SHA512:
6
- metadata.gz: a4c468104b767ac408e5e3763b4620e719b0ce8671e721d5537ce0751b88752b8aa6fdf5abdd335107994ff60d5740b77c88e7d1c1ad5ac317491ad6bbb7f5db
7
- data.tar.gz: 739ad270184b0d15c574eeb1e7f835ac069f613fe1e90af671c49df5594964a0f7030878fc635331b4e452004a443b3390714bbb80a60fe6a4e1b67987e1ed61
6
+ metadata.gz: bd401bb429c28fb75af0c95908deaa43f91a67923c47ba17ba369eb238252add1657ea1aa2b57f9721c59113c06d394274268ade288618314b93c7d4e0c11b31
7
+ data.tar.gz: 5892d3cabd8bad2e6bd5c6e9a5c6ef7f3fa9f7376c6aa39e9225acf8c37160da3550b66ff420440a9565d29ea898784bd3093bd36b09cbf1302f45aaa7d0a5a6
@@ -1,7 +1,10 @@
1
1
  inherit_from: .rubocop_todo.yml
2
2
 
3
3
  AllCops:
4
- TargetRubyVersion: 2.2
4
+ TargetRubyVersion: 2.3
5
5
 
6
6
  Metrics/BlockLength:
7
7
  ExcludedMethods: [it, describe]
8
+
9
+ Style/FrozenStringLiteralComment:
10
+ Enabled: false
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2018-01-05 16:54:58 -0500 using RuboCop version 0.50.0.
3
+ # on 2019-08-25 11:12:51 -0400 using RuboCop version 0.74.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -11,14 +11,8 @@
11
11
  Metrics/ClassLength:
12
12
  Max: 103
13
13
 
14
- # Offense count: 94
15
- # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
16
- # URISchemes: http, https
17
- Metrics/LineLength:
18
- Max: 142
19
-
20
14
  # Offense count: 3
21
- # Configuration parameters: CountComments.
15
+ # Configuration parameters: CountComments, ExcludedMethods.
22
16
  Metrics/MethodLength:
23
17
  Max: 25
24
18
 
@@ -28,7 +22,8 @@ Metrics/ModuleLength:
28
22
  Max: 265
29
23
 
30
24
  # Offense count: 2
31
- # Configuration parameters: EnforcedStyle, SupportedStyles.
25
+ # Cop supports --auto-correct.
26
+ # Configuration parameters: AutoCorrect, EnforcedStyle.
32
27
  # SupportedStyles: nested, compact
33
28
  Style/ClassAndModuleChildren:
34
29
  Exclude:
@@ -52,6 +47,13 @@ Style/DoubleNegation:
52
47
  - 'lib/hyperclient/link.rb'
53
48
 
54
49
  # Offense count: 1
55
- Style/MethodMissing:
50
+ Style/MethodMissingSuper:
56
51
  Exclude:
57
52
  - 'lib/hyperclient/collection.rb'
53
+
54
+ # Offense count: 93
55
+ # Cop supports --auto-correct.
56
+ # Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
57
+ # URISchemes: http, https
58
+ Metrics/LineLength:
59
+ Max: 142
@@ -4,20 +4,19 @@ sudo: false
4
4
 
5
5
  matrix:
6
6
  include:
7
- - rvm: 2.4.1
8
- - rvm: 2.4.1
7
+ - rvm: 2.6.3
8
+ - rvm: 2.5.5
9
+ - rvm: 2.4.6
10
+ - rvm: 2.4.6
9
11
  script:
10
12
  - bundle exec danger
11
- - rvm: jruby-9.1.12.0
13
+ - rvm: jruby-9.2.7.0
12
14
  - rvm: jruby-head
13
- - rvm: 2.2.7
14
- - rvm: 2.3.4
15
- - rvm: rbx-2
15
+ - rvm: 2.3.8
16
16
  - rvm: ruby-head
17
17
  allow_failures:
18
18
  - rvm: ruby-head
19
19
  - rvm: jruby-head
20
- - rvm: rbx-2
21
20
 
22
21
  before_install:
23
22
  - gem update --system
@@ -1,69 +1,80 @@
1
- ### 0.9.0 (January 10, 2018)
1
+ ## Changelog
2
+
3
+ ### 0.9.1 (2019/08/25)
4
+
5
+ * NOTE: **⚠ This version is no longer tested with Ruby < 2.3 ⚠** - [@ivoanjo](https://github.com/ivoanjo).
6
+
7
+ * [#135](https://github.com/codegram/hyperclient/pull/135): Fix validation for empty body responses - [@paulocdf](https://github.com/paulocdf).
8
+ * [#139](https://github.com/codegram/hyperclient/pull/139): Test `hyperclient` against newer versions of MRI Ruby, up until 2.6.x - [@mrcasals](https://github.com/mrcasals).
9
+ * [#141](https://github.com/codegram/hyperclient/pull/141): Replace `uri_template` with `addressable` library - [@mrcasals](https://github.com/mrcasals).
10
+ * [#136](https://github.com/codegram/hyperclient/pull/136), [#146](https://github.com/codegram/hyperclient/pull/146): Upgraded Danger plugins - [@dblock](https://github.com/dblock), [@ivoanjo](https://github.com/ivoanjo).
11
+
12
+ ### 0.9.0 (2018/01/10)
2
13
 
3
14
  * [#133](https://github.com/codegram/hyperclient/pull/133): Removed futuroscope - [@dblock](https://github.com/dblock).
4
15
  * [#131](https://github.com/codegram/hyperclient/pull/131): Upgrade to Rubocop 0.50.0, fix Bundler's insecure git source warning - [@nebolsin](https://github.com/nebolsin).
5
16
  * [#132](https://github.com/codegram/hyperclient/pull/132): Swapped yard dependency for danger-toc - [@dblock](https://github.com/dblock).
6
17
 
7
- ### 0.8.6 (August 27, 2017)
18
+ ### 0.8.6 (2017/08/27)
8
19
 
9
20
  * [#122](https://github.com/codegram/hyperclient/pull/122): Improve error message when server returns invalid data - [@ivoanjo](https://github.com/ivoanjo).
10
21
  * [#125](https://github.com/codegram/hyperclient/pull/125): Add table of contents to readme and add note asking users to add their projects to the wiki - [@ivoanjo](https://github.com/ivoanjo).
11
22
  * [#127](https://github.com/codegram/hyperclient/pull/127): Minor fixes: Fix warnings, and pry-byebug to dev Gemfile and tweak rubocop execution - [@ivoanjo](https://github.com/ivoanjo).
12
23
  * [#128](https://github.com/codegram/hyperclient/pull/128): Fix link delegation returning nil for field with value false - [@ivoanjo](https://github.com/ivoanjo).
13
24
 
14
- ### 0.8.5 (July 5, 2017)
25
+ ### 0.8.5 (2017/07/05)
15
26
 
16
27
  * [#120](https://github.com/codegram/hyperclient/pull/120): Replace non-working homepage link in gemspec - [@ivoanjo](https://github.com/ivoanjo).
17
28
 
18
- ### 0.8.4 (May 16, 2017)
29
+ ### 0.8.4 (2017/05/16)
19
30
 
20
31
  * [#117](https://github.com/codegram/hyperclient/issues/117): Require Faraday >= 0.9.0 in gemspec - [@ivoanjo](https://github.com/ivoanjo).
21
32
 
22
- ### 0.8.3 (March 30, 2017)
33
+ ### 0.8.3 (2017/03/30)
23
34
 
24
35
  * [#115](https://github.com/codegram/hyperclient/pull/115): Fix dropped values from queries by using FlatParamsEncoder - [@ivoanjo](https://github.com/ivoanjo).
25
36
 
26
- ### 0.8.2 (December 31, 2016)
37
+ ### 0.8.2 (2016/12/31)
27
38
 
28
- #### This version is no longer tested with Ruby < 2.2.
39
+ * NOTE: **⚠ This version is no longer tested with Ruby < 2.2 ⚠** - [@dblock](https://github.com/dblock).
29
40
 
30
41
  * [#105](https://github.com/codegram/hyperclient/pull/105), [#108](https://github.com/codegram/hyperclient/pull/108): Added Danger, PR linter - [@dblock](https://github.com/dblock).
31
42
  * [#109](https://github.com/codegram/hyperclient/pull/109): Allow disabling asynchronous behavior per-instance - [@Talkdesk](https://github.com/Talkdesk).
32
43
  * [#110](https://github.com/codegram/hyperclient/pull/110): Fixed ruby warnings - [@ivoanjo](https://github.com/ivoanjo).
33
44
 
34
- ### 0.8.1 (March 15, 2016)
45
+ ### 0.8.1 (2016/03/15)
35
46
 
36
47
  * [#97](https://github.com/codegram/hyperclient/issues/97): Fix: curies are no longer used as link shorteners - [@joshco](https://github.com/joshco), [@dblock](https://github.com/dblock).
37
48
  * [#95](https://github.com/codegram/hyperclient/issues/95): Fix: re-add eager delegation for `resource.each` - [@dblock](https://github.com/dblock).
38
49
 
39
- ### 0.7.2 (August 23, 2015)
50
+ ### 0.7.2 (2015/08/23)
40
51
 
41
52
  * [#95](https://github.com/codegram/hyperclient/issues/95): Fix: re-add eager delegation for `resource.x._embeddded.x` - [@dblock](https://github.com/dblock).
42
53
 
43
- ### 0.7.1 (August 15, 2015)
54
+ ### 0.7.1 (2015/08/15)
44
55
 
45
56
  * [#89](https://github.com/codegram/hyperclient/issues/89): Added `Hyperclient::Resource#fetch` - [@alabeduarte](https://github.com/alabeduarte).
46
57
  * [#87](https://github.com/codegram/hyperclient/pull/87): Fix: eager delegation causes link skipping - [@dblock](https://github.com/dblock).
47
58
 
48
- ### 0.7.0 (February 23, 2015)
59
+ ### 0.7.0 (2015/02/23)
49
60
 
50
- #### This version introduces several backwards incompatible changes. See [UPGRADING](UPGRADING.md) for details.
61
+ * NOTE: **⚠ This version introduces several backwards incompatible changes. See [UPGRADING](UPGRADING.md) for details ⚠** - [@dblock](https://github.com/dblock).
51
62
 
52
63
  * [#80](https://github.com/codegram/hyperclient/pull/80): Faraday options can be passed to the connection on initialization - [@koenpunt](https://github.com/koenpunt).
53
64
  * [#81](https://github.com/codegram/hyperclient/pull/81): The default Content-Type is now `application/hal+json` - [@koenpunt](https://github.com/koenpunt).
54
65
 
55
- ### 0.6.1 (October 17, 2014)
66
+ ### 0.6.1 (2014/10/17)
56
67
 
57
- #### This version introduces several backwards incompatible changes. See [UPGRADING](UPGRADING.md) for details.
68
+ * NOTE: **⚠ This version introduces several backwards incompatible changes. See [UPGRADING](UPGRADING.md) for details ⚠** - [@dblock](https://github.com/dblock).
58
69
 
59
70
  * [#51](https://github.com/codegram/hyperclient/issues/51), [#75](https://github.com/codegram/hyperclient/pull/75): Added support for setting headers and overriding or extending the default Faraday connection block before a connection is constructed - [@dblock](https://github.com/dblock).
60
71
  * [#41](https://github.com/codegram/hyperclient/issues/41), [#73](https://github.com/codegram/hyperclient/pull/73): All Link HTTP methods now return a Resource, including `_get`, which has been aliased to `_resource`, `_post`, `_put`, `_patch`, `_head` and `_options` - [@dblock](https://github.com/dblock).
61
72
  * [#72](https://github.com/codegram/hyperclient/pull/72): The default Faraday block now uses `Faraday::Response::RaiseError` and will cause HTTP errors to be raised as exceptions - [@dblock](https://github.com/dblock).
62
73
  * [#77](https://github.com/codegram/hyperclient/pull/77): Added support for templated links with all optional arguments - [@dblock](https://github.com/dblock).
63
74
 
64
- ### 0.5.0 (October 1, 2014)
75
+ ### 0.5.0 (2014/10/01)
65
76
 
66
- #### This version introduces several backwards incompatible changes. See [UPGRADING](UPGRADING.md) for details.
77
+ * NOTE: **⚠ This version introduces several backwards incompatible changes. See [UPGRADING](UPGRADING.md) for details ⚠** - [@dblock](https://github.com/dblock).
67
78
 
68
79
  * [#63](https://github.com/codegram/hyperclient/pull/63): Navigational methods, including `links`, `get` or `post`, have been renamed to `_links`, `_get`, or `_post` respectively - [@dblock](https://github.com/dblock).
69
80
  * [#64](https://github.com/codegram/hyperclient/issues/64): Added support for curies - [@dblock](https://github.com/dblock).
@@ -71,12 +82,12 @@
71
82
  * [#63](https://github.com/codegram/hyperclient/pull/63): You can omit the navigational elements, `api.links.products` is now equivalent to `api.products` - [@dblock](https://github.com/dblock).
72
83
  * [#61](https://github.com/codegram/hyperclient/pull/61): Implemented Rubocop, Ruby-style linter - [@dblock](https://github.com/dblock).
73
84
 
74
- ### 0.4.0 (May 5, 2014)
85
+ ### 0.4.0 (2014/05/05)
75
86
 
76
87
  * [#54](https://github.com/codegram/hyperclient/pull/54): Support Faraday 0.9.0 - [@lucianapazos](https://github.com/lucianapazos).
77
88
  * [#30](https://github.com/codegram/hyperclient/pull/30): Use futuroscope to run API calls in the background - [@josepjaume](https://github.com/josepjaume).
78
89
 
79
- ### 0.3.2 (December 20, 2013)
90
+ ### 0.3.2 (2013/12/20)
80
91
 
81
92
  * [#48](https://github.com/codegram/hyperclient/pull/48): Added support for fetch on the collection class - [@col](https://github.com/col).
82
93
  * [#50](https://github.com/codegram/hyperclient/pull/50): Fixed Resource/Attributes mutating the response body - [@col](https://github.com/col).
@@ -90,10 +101,10 @@
90
101
  * [#31](https://github.com/codegram/hyperclient/pull/31): Allowed underscored attribute names other than the ones reserved by the HAL spec - [@karlin](https://github.com/karlin).
91
102
  * [#29](https://github.com/codegram/hyperclient/pull/29): Handled JSON that includes a link with a null value - [@arbylee](https://github.com/arbylee).
92
103
 
93
- ### 0.3.1 (April 3, 2013)
104
+ ### 0.3.1 (2013/04/03)
94
105
 
95
106
  * [#27](https://github.com/codegram/hyperclient/pull/27): Added support for collections of links - [@rehevkor5](https://github.com/rehevkor5).
96
107
 
97
- ### 0.3.0 (February 3, 2013)
108
+ ### 0.3.0 (2013/02/03)
98
109
 
99
110
  * Initial public release - [@oriolgual](https://github.com/oriolgual).
data/Dangerfile CHANGED
@@ -1,2 +1,2 @@
1
- changelog.check
2
- toc.check
1
+ changelog.check!
2
+ toc.check!
data/Gemfile CHANGED
@@ -16,17 +16,16 @@ end
16
16
 
17
17
  group :development, :test do
18
18
  gem 'rake'
19
- gem 'rubocop', '~> 0.50.0', require: false
19
+ gem 'rubocop', '~> 0.74.0', require: false
20
20
  gem 'simplecov', require: false
21
21
  end
22
22
 
23
23
  group :test do
24
- gem 'danger-changelog', '~> 0.1'
25
- gem 'danger-toc', '~> 0.1'
24
+ gem 'danger-changelog', '~> 0.6.0'
25
+ gem 'danger-toc', '~> 0.2.0'
26
26
  gem 'minitest'
27
27
  gem 'mocha'
28
28
  gem 'rack-test'
29
29
  gem 'spinach'
30
- gem 'turn'
31
30
  gem 'webmock'
32
31
  end
data/Rakefile CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env rake
2
+
2
3
  require 'rubygems'
3
4
  require 'bundler'
4
5
  Bundler.setup :default, :test, :development
@@ -1,5 +1,4 @@
1
-
2
- require File.expand_path('../lib/hyperclient/version', __FILE__)
1
+ require File.expand_path('lib/hyperclient/version', __dir__)
3
2
 
4
3
  Gem::Specification.new do |gem|
5
4
  gem.authors = ['Oriol Gual']
@@ -14,10 +13,10 @@ Gem::Specification.new do |gem|
14
13
  gem.require_paths = ['lib']
15
14
  gem.version = Hyperclient::VERSION
16
15
 
16
+ gem.add_dependency 'addressable'
17
17
  gem.add_dependency 'faraday', '>= 0.9.0'
18
- gem.add_dependency 'faraday_middleware'
18
+ gem.add_dependency 'faraday-digestauth'
19
19
  gem.add_dependency 'faraday_hal_middleware'
20
- gem.add_dependency 'uri_template'
20
+ gem.add_dependency 'faraday_middleware'
21
21
  gem.add_dependency 'net-http-digest_auth'
22
- gem.add_dependency 'faraday-digestauth'
23
22
  end
@@ -41,7 +41,8 @@ module Hyperclient
41
41
  # Returns a new expanded url.
42
42
  def expand(rel)
43
43
  return rel unless rel && templated?
44
- href.gsub('{rel}', rel) if href
44
+
45
+ href&.gsub('{rel}', rel)
45
46
  end
46
47
  end
47
48
  end
@@ -57,6 +57,7 @@ module Hyperclient
57
57
  @faraday_options ||= options.dup
58
58
  if block_given?
59
59
  raise ConnectionAlreadyInitializedError if @connection
60
+
60
61
  @faraday_block = if @faraday_options.delete(:default) == false
61
62
  block
62
63
  else
@@ -75,6 +76,7 @@ module Hyperclient
75
76
  # Returns a Hash.
76
77
  def headers
77
78
  return @connection.headers if @connection
79
+
78
80
  @headers ||= default_headers
79
81
  end
80
82
 
@@ -83,6 +85,7 @@ module Hyperclient
83
85
  # value - A Hash containing headers to include with every API request.
84
86
  def headers=(value)
85
87
  raise ConnectionAlreadyInitializedError if @connection
88
+
86
89
  @headers = value
87
90
  end
88
91
 
@@ -98,6 +101,7 @@ module Hyperclient
98
101
  # value - A Hash containing options to pass to Faraday
99
102
  def faraday_options=(value)
100
103
  raise ConnectionAlreadyInitializedError if @connection
104
+
101
105
  @faraday_options = value
102
106
  end
103
107
 
@@ -113,6 +117,7 @@ module Hyperclient
113
117
  # value - A Proc accepting a Faraday::Connection.
114
118
  def faraday_block=(value)
115
119
  raise ConnectionAlreadyInitializedError if @connection
120
+
116
121
  @faraday_block = value
117
122
  end
118
123
 
@@ -1,4 +1,4 @@
1
- require 'uri_template'
1
+ require 'addressable'
2
2
 
3
3
  module Hyperclient
4
4
  # Internal: The Link is used to let a Resource interact with the API.
@@ -39,7 +39,8 @@ module Hyperclient
39
39
  # Public: Returns the url of the Link.
40
40
  def _url
41
41
  return @link['href'] unless _templated?
42
- @url ||= _uri_template.expand(@uri_variables || {})
42
+
43
+ @url ||= _uri_template.expand(@uri_variables || {}).to_s
43
44
  end
44
45
 
45
46
  # Public: Returns an array of variables from the URITemplate.
@@ -137,8 +138,10 @@ module Hyperclient
137
138
  # This allows `api.posts` instead of `api._links.posts.embedded.posts`
138
139
  def delegate_method(method, *args, &block)
139
140
  return unless @key && _resource.respond_to?(@key)
141
+
140
142
  @delegate ||= _resource.send(@key)
141
- return unless @delegate && @delegate.respond_to?(method.to_s)
143
+ return unless @delegate&.respond_to?(method.to_s)
144
+
142
145
  @delegate.send(method, *args, &block)
143
146
  end
144
147
 
@@ -162,7 +165,7 @@ module Hyperclient
162
165
 
163
166
  # Internal: Memoization for a URITemplate instance
164
167
  def _uri_template
165
- @uri_template ||= URITemplate.new(@link['href'])
168
+ @uri_template ||= Addressable::Template.new(@link['href'])
166
169
  end
167
170
 
168
171
  def http_method(method, body = nil)
@@ -55,11 +55,11 @@ module Hyperclient
55
55
  end
56
56
 
57
57
  def _success?
58
- _response && _response.success?
58
+ _response&.success?
59
59
  end
60
60
 
61
61
  def _status
62
- _response && _response.status
62
+ _response&.status
63
63
  end
64
64
 
65
65
  def [](name)
@@ -82,7 +82,7 @@ module Hyperclient
82
82
 
83
83
  # Internal: Ensures the received representation is a valid Hash-lookalike.
84
84
  def validate(representation)
85
- return {} unless representation
85
+ return {} if representation.nil? || representation.empty?
86
86
 
87
87
  if representation.respond_to?(:to_hash)
88
88
  representation.to_hash.dup
@@ -1,3 +1,3 @@
1
1
  module Hyperclient
2
- VERSION = '0.9.0'.freeze
2
+ VERSION = '0.9.1'.freeze
3
3
  end
@@ -3,8 +3,8 @@
3
3
  "self": {
4
4
  "href": "/productions/1"
5
5
  },
6
- "filter": {
7
- "href": "/productions/1?categories={filter}",
6
+ "search": {
7
+ "href": "/productions/1?categories={search}",
8
8
  "templated": true
9
9
  },
10
10
  "gizmos": [
@@ -15,17 +15,17 @@
15
15
  "href": "/gizmos/2"
16
16
  }
17
17
  ],
18
- "curies" : [
18
+ "curies": [
19
19
  {
20
- "name": "image",
21
- "href": "/docs/images/{rel}",
22
- "templated": true
20
+ "name": "image",
21
+ "href": "/docs/images/{rel}",
22
+ "templated": true
23
23
  }
24
24
  ],
25
25
  "null_link": null,
26
26
  "image:thumbnail": {
27
- "href": "/images/thumbnails/{version}.jpg",
28
- "templated": true
27
+ "href": "/images/thumbnails/{version}.jpg",
28
+ "templated": true
29
29
  }
30
30
  },
31
31
  "title": "Real World ASP.NET MVC3",
@@ -48,9 +48,9 @@
48
48
  "href": "/episodes/1"
49
49
  },
50
50
  "media": {
51
- "type": "video/webm; codecs='vp8.0, vorbis'",
52
- "href": "/media/1"
53
- }
51
+ "type": "video/webm; codecs='vp8.0, vorbis'",
52
+ "href": "/media/1"
53
+ }
54
54
  },
55
55
  "title": "Foundations",
56
56
  "description": "In this episode we talk about what it is we're doing: building our startup and getting ourselves off the ground. We take..",
@@ -62,9 +62,9 @@
62
62
  "href": "/episodes/2"
63
63
  },
64
64
  "media": {
65
- "type": "video/ogg; codecs='theora, vorbis'",
66
- "href": "/media/4"
67
- }
65
+ "type": "video/ogg; codecs='theora, vorbis'",
66
+ "href": "/media/4"
67
+ }
68
68
  },
69
69
  "title": "Membership",
70
70
  "description": "In this episode Rob hooks up testing in an effort to deal with ASP.NET Membership. The team has decided..",
@@ -72,4 +72,4 @@
72
72
  }
73
73
  ]
74
74
  }
75
- }
75
+ }
@@ -18,12 +18,12 @@ module Hyperclient
18
18
  end
19
19
 
20
20
  it 'initializes the collection with links' do
21
- links.must_respond_to :filter
21
+ links.must_respond_to :search
22
22
  links.must_respond_to :gizmos
23
23
  end
24
24
 
25
25
  it 'returns link objects for each link' do
26
- links.filter.must_be_kind_of Link
26
+ links.search.must_be_kind_of Link
27
27
  links['self'].must_be_kind_of Link
28
28
 
29
29
  links.gizmos.must_be_kind_of Array
@@ -38,9 +38,9 @@ module Hyperclient
38
38
  end
39
39
 
40
40
  describe 'templated link' do
41
- let(:templated_link) { links.filter }
41
+ let(:templated_link) { links.search }
42
42
  it 'must expand' do
43
- templated_link._expand(filter: 'gizmos')._url.must_equal '/productions/1?categories=gizmos'
43
+ templated_link._expand(search: 'gizmos')._url.must_equal '/productions/1?categories=gizmos'
44
44
  end
45
45
  end
46
46
 
@@ -16,7 +16,7 @@ module Hyperclient
16
16
 
17
17
  it 'returns nil if the property is not present' do
18
18
  link = Link.new('key', {}, entry_point)
19
- link.send("_#{prop}").must_equal nil
19
+ link.send("_#{prop}").must_be_nil
20
20
  end
21
21
  end
22
22
  end
@@ -301,7 +301,7 @@ module Hyperclient
301
301
  end
302
302
 
303
303
  resource.foos._embedded.orders.first.id.must_equal 1
304
- resource.foos.first.must_equal nil
304
+ resource.foos.first.must_be_nil
305
305
  end
306
306
 
307
307
  it 'backtracks when navigating links' do
@@ -41,6 +41,16 @@ module Hyperclient
41
41
  resource._response.body.must_equal body
42
42
  end
43
43
 
44
+ describe 'with an empty body in response' do
45
+ it 'initializes the response' do
46
+ mock_response = mock(body: '')
47
+
48
+ resource = Resource.new(mock_response.body, entry_point, mock_response)
49
+
50
+ resource._response.must_equal mock_response
51
+ end
52
+ end
53
+
44
54
  describe 'with an invalid representation' do
45
55
  it 'raises an InvalidRepresentationError' do
46
56
  proc { Resource.new('invalid representation data', entry_point) }.must_raise InvalidRepresentationError
@@ -1,12 +1,11 @@
1
1
  $LOAD_PATH << 'lib'
2
2
 
3
- require 'minitest/spec'
4
3
  require 'minitest/autorun'
4
+ require 'minitest/pride'
5
5
  require 'mocha/setup'
6
- require 'turn'
7
6
  require 'json'
8
7
 
9
- MiniTest::Unit::TestCase.class_eval do
8
+ MiniTest::Test.class_eval do
10
9
  def stub_request(conn, adapter_class = Faraday::Adapter::Test, &stubs_block)
11
10
  adapter_handler = conn.builder.handlers.find { |h| h.klass < Faraday::Adapter }
12
11
  conn.builder.swap(adapter_handler, adapter_class, &stubs_block)
metadata CHANGED
@@ -1,45 +1,45 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hyperclient
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oriol Gual
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-10 00:00:00.000000000 Z
11
+ date: 2019-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: faraday
14
+ name: addressable
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.9.0
19
+ version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 0.9.0
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: faraday_middleware
28
+ name: faraday
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: 0.9.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: 0.9.0
41
41
  - !ruby/object:Gem::Dependency
42
- name: faraday_hal_middleware
42
+ name: faraday-digestauth
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
@@ -53,7 +53,7 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: uri_template
56
+ name: faraday_hal_middleware
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
@@ -67,7 +67,7 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: net-http-digest_auth
70
+ name: faraday_middleware
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
@@ -81,7 +81,7 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: faraday-digestauth
84
+ name: net-http-digest_auth
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ">="
@@ -168,8 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
168
168
  - !ruby/object:Gem::Version
169
169
  version: '0'
170
170
  requirements: []
171
- rubyforge_project:
172
- rubygems_version: 2.7.3
171
+ rubygems_version: 3.0.3
173
172
  signing_key:
174
173
  specification_version: 4
175
174
  summary: ''