activeresource-response 1.2.0 → 1.3.0

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: c12ab32aee7b9d83f5d71af0fe372188b7aab41618aec5e52ade786e6fe069dd
4
- data.tar.gz: 63c1b88d91b907be17ca321eefa29652764310ef26bb46e319f2d3a0d2633742
3
+ metadata.gz: 6001c653f7f44c7c8216111159eda9a0c007d50caf2cd6ac79787419f197b690
4
+ data.tar.gz: b03396852f3125a076238f45c2bab5be01ccc504500dab658c6bb139fd1196b7
5
5
  SHA512:
6
- metadata.gz: 9db8b4905c290ffd6570c2f1b2a27802947214a8fbc1dafea58042cb83d06c80a7632a475c20d352d509678a2fb15730511e965df25b32ebf4ea2f6f7c5ede08
7
- data.tar.gz: bde35f4d766636db84404ac2f6c0a9b4823f74acaa9ad25847db798b4ac49ebb86a3058dd33fd463209eca4bd6198e55af48dee8df09970839533611da926b59
6
+ metadata.gz: eb0a148ded6376a68e1aee1f72a1330a114e993ca4e886de26cce43f66e6da04ce8fe9e3640f212be42a8164ef0af40c7f88afae594bfacca749347ca1f469f5
7
+ data.tar.gz: e8b3dce231e5ec7f39105636bbc00173965a8939d1fbd94dd7ada22d296a535fc4886bb676d1b82386a1808e9fc29a1e2bca3ff236ebc520e3c357044c124748
@@ -1,3 +1,4 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.3.0
3
+ - 2.4.0
4
+ - 2.5.0
@@ -17,6 +17,7 @@ Gem::Specification.new do |s|
17
17
  s.add_dependency "jruby-openssl" if RUBY_PLATFORM == "java"
18
18
  s.add_development_dependency "minitest" , '~> 5.3'
19
19
  s.add_development_dependency 'rake', '~> 10'
20
+ s.add_development_dependency 'byebug'
20
21
 
21
22
 
22
23
  s.files = `git ls-files | sed '/.gitignore/d'`.split("\n")
@@ -59,7 +59,7 @@ module ActiveResourceResponse
59
59
  end
60
60
 
61
61
  def wrap_result(result)
62
- result = SimpleDelegator.new(result) unless result.duplicable?
62
+ result = SimpleDelegator.new(result) if result.frozen?
63
63
  result.instance_variable_set(:@http_response, connection.http_response)
64
64
  result.singleton_class.send(:define_method, self.http_response_method) do
65
65
  @http_response
@@ -23,6 +23,6 @@
23
23
 
24
24
  module ActiveResourceResponse
25
25
  module Version
26
- VERSION = "1.2.0"
26
+ VERSION = "1.3.0"
27
27
  end
28
28
  end
@@ -21,7 +21,6 @@
21
21
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
22
  #++
23
23
  require_relative 'test_helper'
24
-
25
24
  class ActiveResourceResponseTest < MiniTest::Test
26
25
 
27
26
 
@@ -38,7 +37,8 @@ class ActiveResourceResponseTest < MiniTest::Test
38
37
  mock.get "/regions/1.json", {}, @region.to_json, 200, {"X-total"=>'1'}
39
38
  mock.get "/regions/population.json", {}, {:count => 45000000}.to_json, 200, {"X-total"=>'1'}
40
39
  mock.get "/regions/cities.json", {}, [@city].to_json, 200, {"X-total"=>'2'}
41
- mock.get "/countries/1.json", {}, @country.to_json, 200, {"X-total"=>'1', 'Set-Cookie'=>['path=/; expires=Tue, 20-Jan-2015 15:03:14 GMT, foo=bar, bar=foo']}
40
+ mock.get "/countries/1/statuses.json", {}, nil, 404
41
+ mock.get "/countries/1.json", {}, @country.to_json, 200, {"X-total"=>'1', 'Set-Cookie'=>['path=/; expires=Tue, 20-Jan-2015 15:03:14 GMT; foo=bar; bar=foo']}
42
42
  mock.get "/countries/1/population.json", {}, {:count => 45000000}.to_json, 200, {"X-total"=>'1'}
43
43
  mock.post "/countries.json", {}, @country_create_error.to_json, 422, {"X-total"=>'1'}
44
44
  mock.get "/countries/1/cities.json", {}, [@city].to_json, 200, {"X-total"=>'1'}
@@ -109,6 +109,16 @@ class ActiveResourceResponseTest < MiniTest::Test
109
109
  assert_equal country.http.headers[:x_total], ['1']
110
110
  end
111
111
 
112
+ def test_get_headers_from_find_when_404_custom_get
113
+ Country.find(1).get(:statuses) rescue nil
114
+ assert_equal Country.http_response.code, 404
115
+ end
116
+
117
+ def test_get_headers_from_find_when_404_custom_prefix
118
+ Status.all params: { country_id: 1 }
119
+ assert_equal Status.http_response.code, 404
120
+ end
121
+
112
122
  def test_get_cookies
113
123
  country = Country.find(1)
114
124
  assert_equal country.http.cookies['foo'], 'bar'
@@ -0,0 +1,26 @@
1
+ #--
2
+ # Copyright (c) 2012 Igor Fedoronchuk
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining
5
+ # a copy of this software and associated documentation files (the
6
+ # "Software"), to deal in the Software without restriction, including
7
+ # without limitation the rights to use, copy, modify, merge, publish,
8
+ # distribute, sublicense, and/or sell copies of the Software, and to
9
+ # permit persons to whom the Software is furnished to do so, subject to
10
+ # the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be
13
+ # included in all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ #++
23
+ class Status < ActiveResourceResponseBase
24
+ self.element_name = 'status'
25
+ self.prefix += 'countries/:country_id/'
26
+ end
@@ -12,4 +12,5 @@ require "fixtures/country"
12
12
  require "fixtures/city"
13
13
  require "fixtures/region"
14
14
  require "fixtures/street"
15
+ require "fixtures/status"
15
16
  require "active_resource_response/http_mock"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activeresource-response
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Fedoronchuk
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-31 00:00:00.000000000 Z
11
+ date: 2019-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activeresource
@@ -58,6 +58,20 @@ dependencies:
58
58
  - - "~>"
59
59
  - !ruby/object:Gem::Version
60
60
  version: '10'
61
+ - !ruby/object:Gem::Dependency
62
+ name: byebug
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
61
75
  description: 'This gem adds possibility to access http response object from result
62
76
  of ActiveResource::Base find method '
63
77
  email:
@@ -85,6 +99,7 @@ files:
85
99
  - test/fixtures/city.rb
86
100
  - test/fixtures/country.rb
87
101
  - test/fixtures/region.rb
102
+ - test/fixtures/status.rb
88
103
  - test/fixtures/street.rb
89
104
  - test/lint_test.rb
90
105
  - test/test_helper.rb
@@ -108,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
123
  version: '0'
109
124
  requirements: []
110
125
  rubyforge_project:
111
- rubygems_version: 2.7.7
126
+ rubygems_version: 2.7.9
112
127
  signing_key:
113
128
  specification_version: 4
114
129
  summary: activeresource extension
@@ -117,6 +132,7 @@ test_files:
117
132
  - test/fixtures/city.rb
118
133
  - test/fixtures/country.rb
119
134
  - test/fixtures/region.rb
135
+ - test/fixtures/status.rb
120
136
  - test/fixtures/street.rb
121
137
  - test/lint_test.rb
122
138
  - test/test_helper.rb