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 CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.0.5 (October 7, 2010)
2
+
3
+ Handle camel-cased class names better
4
+
1
5
  ## 0.0.4 (October 7, 2010)
2
6
 
3
7
  Handle has_property_url calls better, use more explicit logic
@@ -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.4'
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.split('::').last.parameterize.pluralize
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
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 4
9
- version: 0.0.4
8
+ - 5
9
+ version: 0.0.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Quid, Inc.