hypertext_client 0.0.9 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +4 -0
- data/lib/hypertext_client/hypertext_client.rb +6 -2
- data/test/test_hypertext_client.rb +16 -1
- metadata +3 -3
data/CHANGELOG
CHANGED
@@ -18,7 +18,7 @@
|
|
18
18
|
|
19
19
|
# Hypertext provides an HTTP client based on HTTParty, with a few assumptions baked in.
|
20
20
|
module HypertextClient
|
21
|
-
VERSION = '0.0.
|
21
|
+
VERSION = '0.0.10'
|
22
22
|
|
23
23
|
extend ActiveSupport::Concern
|
24
24
|
# Include HTTParty
|
@@ -70,7 +70,11 @@ module HypertextClient
|
|
70
70
|
|
71
71
|
# Get a related property.
|
72
72
|
def get_related(related)
|
73
|
-
|
73
|
+
if related.to_s =~ /[Aa]lias/ # patch over bug in ActiveSupport::Inflector
|
74
|
+
klass = (self.class.name.split('::').first + '::' + 'Alias').constantize
|
75
|
+
else
|
76
|
+
klass = (self.class.name.split('::').first + '::' + related.to_s.singularize.classify).constantize
|
77
|
+
end
|
74
78
|
result = klass.get(send (related.to_s+'_url').to_sym)
|
75
79
|
|
76
80
|
(class << self; self; end).instance_eval do
|
@@ -39,7 +39,7 @@ FakeWeb.register_uri(:get,
|
|
39
39
|
|
40
40
|
FakeWeb.register_uri(:get,
|
41
41
|
FAKE_ENDPOINT + '/camel_cases/example',
|
42
|
-
:body => {:property => 'exists'}.to_json,
|
42
|
+
:body => {:property => 'exists', :aliases_url => FAKE_ENDPOINT + '/camel_cases/different_example/aliases'}.to_json,
|
43
43
|
:content_type => 'application/json')
|
44
44
|
|
45
45
|
FakeWeb.register_uri(:any,
|
@@ -61,6 +61,11 @@ FakeWeb.register_uri(:any,
|
|
61
61
|
FAKE_ENDPOINT + '/camel_cases/different_example/camel_case_inheritors',
|
62
62
|
:body => {:property => 'exists'}.to_json,
|
63
63
|
:content_type => 'application/json')
|
64
|
+
|
65
|
+
FakeWeb.register_uri(:any,
|
66
|
+
FAKE_ENDPOINT + '/camel_cases/different_example/aliases',
|
67
|
+
:body => {:property => 'exists'}.to_json,
|
68
|
+
:content_type => 'application/json')
|
64
69
|
|
65
70
|
|
66
71
|
module SkynetClient
|
@@ -94,6 +99,11 @@ class SkynetClient::CamelCaseInheritor < ObjectStruct
|
|
94
99
|
belongs_to SkynetClient::CamelCase
|
95
100
|
end
|
96
101
|
|
102
|
+
class SkynetClient::Alias < ObjectStruct
|
103
|
+
include SkynetClient
|
104
|
+
belongs_to SkynetClient::CamelCase
|
105
|
+
end
|
106
|
+
|
97
107
|
class HypertextClientTest < MiniTest::Unit::TestCase
|
98
108
|
include ActiveModel::Lint::Tests
|
99
109
|
|
@@ -188,4 +198,9 @@ class HypertextClientTest < MiniTest::Unit::TestCase
|
|
188
198
|
example = SkynetClient::CamelCaseInheritor.get(:camel_case => 'different_example')
|
189
199
|
assert_equal '/camel_cases/different_example/camel_case_inheritors', FakeWeb.last_request.path
|
190
200
|
end
|
201
|
+
|
202
|
+
def test_aliases_class_name_issue
|
203
|
+
example = SkynetClient::CamelCase.get('example')
|
204
|
+
assert example.aliases
|
205
|
+
end
|
191
206
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 10
|
9
|
+
version: 0.0.10
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Quid, Inc.
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-10-
|
17
|
+
date: 2010-10-17 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|