wrest 1.0.0.beta1 → 1.0.0.beta2
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 +14 -2
- data/LICENCE +7 -0
- data/README.rdoc +15 -69
- data/lib/wrest/components/container/alias_accessors.rb +1 -1
- data/lib/wrest/components/container/alias_accessors.rbc +905 -0
- data/lib/wrest/components/container/typecaster.rb +5 -5
- data/lib/wrest/components/container/typecaster.rbc +1985 -0
- data/lib/wrest/components/container.rb +11 -12
- data/lib/wrest/components/container.rbc +2466 -0
- data/lib/wrest/components/mutators/base.rbc +702 -0
- data/lib/wrest/components/mutators/camel_to_snake_case.rbc +360 -0
- data/lib/wrest/components/mutators/xml_mini_type_caster.rbc +679 -0
- data/lib/wrest/components/mutators/xml_simple_type_caster.rbc +559 -0
- data/lib/wrest/components/mutators.rbc +650 -0
- data/lib/wrest/components/translators/content_types.rbc +339 -0
- data/lib/wrest/components/translators/json.rbc +462 -0
- data/lib/wrest/components/translators/xml.rbc +457 -0
- data/lib/wrest/components/translators.rbc +517 -0
- data/lib/wrest/components.rbc +217 -0
- data/lib/wrest/core_ext/hash/conversions.rbc +501 -0
- data/lib/wrest/core_ext/hash.rbc +182 -0
- data/lib/wrest/core_ext/string/conversions.rbc +471 -0
- data/lib/wrest/core_ext/string.rbc +182 -0
- data/lib/wrest/curl/response.rb +8 -0
- data/lib/wrest/curl.rbc +704 -0
- data/lib/wrest/exceptions.rbc +312 -0
- data/lib/wrest/http_shared/headers.rb +0 -7
- data/lib/wrest/http_shared/headers.rbc +353 -0
- data/lib/wrest/http_shared/standard_headers.rbc +336 -0
- data/lib/wrest/http_shared/standard_tokens.rbc +316 -0
- data/lib/wrest/http_shared.rbc +279 -0
- data/lib/wrest/native/connection_factory.rbc +445 -0
- data/lib/wrest/native/delete.rbc +371 -0
- data/lib/wrest/native/get.rb +26 -0
- data/lib/wrest/native/get.rbc +855 -0
- data/lib/wrest/native/options.rbc +347 -0
- data/lib/wrest/native/post.rbc +388 -0
- data/lib/wrest/native/put.rbc +388 -0
- data/lib/wrest/native/redirection.rbc +520 -0
- data/lib/wrest/native/request.rb +4 -2
- data/lib/wrest/native/request.rbc +1675 -0
- data/lib/wrest/native/response.rb +53 -2
- data/lib/wrest/native/response.rbc +2150 -0
- data/lib/wrest/native/session.rbc +1372 -0
- data/lib/wrest/native.rbc +513 -0
- data/lib/wrest/resource/base.rbc +2115 -0
- data/lib/wrest/resource.rbc +163 -0
- data/lib/wrest/uri.rbc +2599 -0
- data/lib/wrest/uri_template.rbc +505 -0
- data/lib/wrest/version.rb +1 -1
- data/lib/wrest/version.rbc +372 -0
- data/lib/wrest.rb +1 -1
- data/lib/wrest.rbc +1900 -0
- metadata +99 -102
- data/Rakefile +0 -495
- data/VERSION.yml +0 -5
- data/bin/jwrest +0 -3
- data/examples/delicious.rb +0 -72
- data/examples/facebook.rb +0 -101
- data/examples/imgur_multipart.rb +0 -24
- data/examples/keep_alive.rb +0 -37
- data/examples/redirection.rb +0 -27
- data/examples/twitter.rb +0 -78
- data/examples/twitter_public_timeline.rb +0 -32
- data/examples/wow_realm_status.rb +0 -67
- data/init.rb +0 -0
- data/spec/custom_matchers/custom_matchers.rb +0 -2
- data/spec/rcov.opts +0 -4
- data/spec/spec.opts.disable +0 -6
- data/spec/unit/spec_helper.rb +0 -35
- data/spec/unit/wrest/components/attributes_container/alias_accessors_spec.rb +0 -49
- data/spec/unit/wrest/components/attributes_container/typecaster_spec.rb +0 -83
- data/spec/unit/wrest/components/attributes_container_spec.rb +0 -254
- data/spec/unit/wrest/components/mutators/base_spec.rb +0 -42
- data/spec/unit/wrest/components/mutators/camel_to_snake_spec.rb +0 -22
- data/spec/unit/wrest/components/mutators/xml_mini_type_caster_spec.rb +0 -75
- data/spec/unit/wrest/components/mutators/xml_simple_type_caster_spec.rb +0 -47
- data/spec/unit/wrest/components/mutators_spec.rb +0 -21
- data/spec/unit/wrest/components/translators/xml_spec.rb +0 -16
- data/spec/unit/wrest/components/translators_spec.rb +0 -18
- data/spec/unit/wrest/core_ext/hash/conversions_spec.rb +0 -22
- data/spec/unit/wrest/core_ext/string/conversions_spec.rb +0 -39
- data/spec/unit/wrest/curl/request_spec.rb +0 -19
- data/spec/unit/wrest/curl/response_spec.rb +0 -16
- data/spec/unit/wrest/http/response_spec.rb +0 -24
- data/spec/unit/wrest/native/redirection_spec.rb +0 -42
- data/spec/unit/wrest/native/request_spec.rb +0 -71
- data/spec/unit/wrest/native/response_spec.rb +0 -72
- data/spec/unit/wrest/native/session_spec.rb +0 -74
- data/spec/unit/wrest/resource/base_spec.rb +0 -274
- data/spec/unit/wrest/uri_spec.rb +0 -273
- data/spec/unit/wrest/uri_template_spec.rb +0 -38
- data/wrest.gemspec +0 -168
|
@@ -25,8 +25,8 @@ module Wrest::Components
|
|
|
25
25
|
# <tt>respond_to?</tt> however will respond as though
|
|
26
26
|
# they are all already present.
|
|
27
27
|
# This means that two different instances of the same
|
|
28
|
-
#
|
|
29
|
-
#
|
|
28
|
+
# Container could well have different attribute
|
|
29
|
+
# getters/setters/query methods.
|
|
30
30
|
#
|
|
31
31
|
# Note that the first call to a particular getter/setter/query
|
|
32
32
|
# method will be slower because the method is defined
|
|
@@ -42,12 +42,12 @@ module Wrest::Components
|
|
|
42
42
|
#
|
|
43
43
|
# If you're implementing your own initialize method
|
|
44
44
|
# remember to delegate to the default initialize
|
|
45
|
-
# of
|
|
45
|
+
# of Container by invoking <tt>super(attributes)</tt>
|
|
46
46
|
#
|
|
47
47
|
# Example:
|
|
48
48
|
# class ShenCoin
|
|
49
|
-
# include Wrest::Components::
|
|
50
|
-
# include Wrest::Components::
|
|
49
|
+
# include Wrest::Components::Container
|
|
50
|
+
# include Wrest::Components::Container::Typecaster
|
|
51
51
|
#
|
|
52
52
|
# always_has :id
|
|
53
53
|
# typecast :id => as_integer
|
|
@@ -79,7 +79,7 @@ module Wrest::Components
|
|
|
79
79
|
|
|
80
80
|
module ClassMethods
|
|
81
81
|
# This macro explicitly creates getter, setter and query methods on
|
|
82
|
-
# an
|
|
82
|
+
# an Container, overriding any exisiting methods with the same names.
|
|
83
83
|
# This can be used when attribute names clash with existing method names;
|
|
84
84
|
# an example would be Rails REST resources which frequently make use
|
|
85
85
|
# an attribute named <tt>id</tt> which clashes with Object#id. Also,
|
|
@@ -96,13 +96,13 @@ module Wrest::Components
|
|
|
96
96
|
end
|
|
97
97
|
|
|
98
98
|
# This is a convenience macro which includes
|
|
99
|
-
# Wrest::Components::
|
|
99
|
+
# Wrest::Components::Container::Typecaster into
|
|
100
100
|
# the class (effectively overwriting this method) before delegating to
|
|
101
101
|
# the actual typecast method that is a part of that module.
|
|
102
102
|
# This saves us the effort of explicitly doing the include. Easy to use API is king.
|
|
103
103
|
#
|
|
104
104
|
# Remember that using typecast carries a performance penalty.
|
|
105
|
-
# See Wrest::Components::
|
|
105
|
+
# See Wrest::Components::Container::Typecaster for the actual docs.
|
|
106
106
|
def typecast(cast_map)
|
|
107
107
|
self.class_eval{ include Wrest::Components::Container::Typecaster }
|
|
108
108
|
self.typecast cast_map
|
|
@@ -125,10 +125,9 @@ module Wrest::Components
|
|
|
125
125
|
# an attributes container by creating
|
|
126
126
|
# two variables, @attributes and @interface.
|
|
127
127
|
# Remember not to use these two variable names
|
|
128
|
-
# when using
|
|
129
|
-
# own class.
|
|
128
|
+
# when using Container in your own class.
|
|
130
129
|
def initialize(attributes = {})
|
|
131
|
-
@attributes = attributes
|
|
130
|
+
@attributes = HashWithIndifferentAccess.new(attributes)
|
|
132
131
|
end
|
|
133
132
|
|
|
134
133
|
# A translator is a anything that knows how to serialise a
|
|
@@ -141,7 +140,7 @@ module Wrest::Components
|
|
|
141
140
|
# applications; you may need to roll your own for anything else.
|
|
142
141
|
#
|
|
143
142
|
# Note: When serilising to XML, if you want the name of the class as the name of the root node
|
|
144
|
-
# then you should use the
|
|
143
|
+
# then you should use the Container#to_xml helper.
|
|
145
144
|
def serialise_using(translator, options = {})
|
|
146
145
|
translator.serialise(@attributes, options)
|
|
147
146
|
end
|