hypertext_client 0.0.4 → 0.0.5
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 +2 -2
- data/test/test_hypertext_client.rb +14 -0
- metadata +2 -2
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.5'
|
|
22
22
|
|
|
23
23
|
extend ActiveSupport::Concern
|
|
24
24
|
# Include HTTParty
|
|
@@ -89,7 +89,7 @@ module HypertextClient
|
|
|
89
89
|
# Specify a base url for the client.
|
|
90
90
|
def base_url(base)
|
|
91
91
|
self.base_endpoint = base
|
|
92
|
-
base_uri self.base_endpoint + '/' + self.name.
|
|
92
|
+
base_uri self.base_endpoint + '/' + self.name.demodulize.pluralize.downcase
|
|
93
93
|
end
|
|
94
94
|
|
|
95
95
|
def belongs_to(*classes)
|
|
@@ -37,6 +37,11 @@ FakeWeb.register_uri(:get,
|
|
|
37
37
|
:body => '',
|
|
38
38
|
:content_type => 'application/json')
|
|
39
39
|
|
|
40
|
+
FakeWeb.register_uri(:get,
|
|
41
|
+
FAKE_ENDPOINT + '/camelcase_classes/example',
|
|
42
|
+
:body => {:property => 'exists'}.to_json,
|
|
43
|
+
:content_type => 'application/json')
|
|
44
|
+
|
|
40
45
|
|
|
41
46
|
module SkynetClient
|
|
42
47
|
extend ActiveSupport::Concern
|
|
@@ -60,6 +65,10 @@ class SkynetClient::Button < ObjectStruct
|
|
|
60
65
|
belongs_to Widget
|
|
61
66
|
end
|
|
62
67
|
|
|
68
|
+
class SkynetClient::CamelcaseClass < ObjectStruct
|
|
69
|
+
include SkynetClient
|
|
70
|
+
end
|
|
71
|
+
|
|
63
72
|
|
|
64
73
|
class HypertextClientTest < MiniTest::Unit::TestCase
|
|
65
74
|
include ActiveModel::Lint::Tests
|
|
@@ -115,4 +124,9 @@ class HypertextClientTest < MiniTest::Unit::TestCase
|
|
|
115
124
|
assert_nil widget.has_nonexistent_property?
|
|
116
125
|
assert_nil widget.has_id?
|
|
117
126
|
end
|
|
127
|
+
|
|
128
|
+
def gets_camelcased_classes_correctly
|
|
129
|
+
example = SkynetClient::CamelcaseClass.get 'example'
|
|
130
|
+
assert_equal example.property, "exists"
|
|
131
|
+
end
|
|
118
132
|
end
|