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.
Files changed (93) hide show
  1. data/CHANGELOG +14 -2
  2. data/LICENCE +7 -0
  3. data/README.rdoc +15 -69
  4. data/lib/wrest/components/container/alias_accessors.rb +1 -1
  5. data/lib/wrest/components/container/alias_accessors.rbc +905 -0
  6. data/lib/wrest/components/container/typecaster.rb +5 -5
  7. data/lib/wrest/components/container/typecaster.rbc +1985 -0
  8. data/lib/wrest/components/container.rb +11 -12
  9. data/lib/wrest/components/container.rbc +2466 -0
  10. data/lib/wrest/components/mutators/base.rbc +702 -0
  11. data/lib/wrest/components/mutators/camel_to_snake_case.rbc +360 -0
  12. data/lib/wrest/components/mutators/xml_mini_type_caster.rbc +679 -0
  13. data/lib/wrest/components/mutators/xml_simple_type_caster.rbc +559 -0
  14. data/lib/wrest/components/mutators.rbc +650 -0
  15. data/lib/wrest/components/translators/content_types.rbc +339 -0
  16. data/lib/wrest/components/translators/json.rbc +462 -0
  17. data/lib/wrest/components/translators/xml.rbc +457 -0
  18. data/lib/wrest/components/translators.rbc +517 -0
  19. data/lib/wrest/components.rbc +217 -0
  20. data/lib/wrest/core_ext/hash/conversions.rbc +501 -0
  21. data/lib/wrest/core_ext/hash.rbc +182 -0
  22. data/lib/wrest/core_ext/string/conversions.rbc +471 -0
  23. data/lib/wrest/core_ext/string.rbc +182 -0
  24. data/lib/wrest/curl/response.rb +8 -0
  25. data/lib/wrest/curl.rbc +704 -0
  26. data/lib/wrest/exceptions.rbc +312 -0
  27. data/lib/wrest/http_shared/headers.rb +0 -7
  28. data/lib/wrest/http_shared/headers.rbc +353 -0
  29. data/lib/wrest/http_shared/standard_headers.rbc +336 -0
  30. data/lib/wrest/http_shared/standard_tokens.rbc +316 -0
  31. data/lib/wrest/http_shared.rbc +279 -0
  32. data/lib/wrest/native/connection_factory.rbc +445 -0
  33. data/lib/wrest/native/delete.rbc +371 -0
  34. data/lib/wrest/native/get.rb +26 -0
  35. data/lib/wrest/native/get.rbc +855 -0
  36. data/lib/wrest/native/options.rbc +347 -0
  37. data/lib/wrest/native/post.rbc +388 -0
  38. data/lib/wrest/native/put.rbc +388 -0
  39. data/lib/wrest/native/redirection.rbc +520 -0
  40. data/lib/wrest/native/request.rb +4 -2
  41. data/lib/wrest/native/request.rbc +1675 -0
  42. data/lib/wrest/native/response.rb +53 -2
  43. data/lib/wrest/native/response.rbc +2150 -0
  44. data/lib/wrest/native/session.rbc +1372 -0
  45. data/lib/wrest/native.rbc +513 -0
  46. data/lib/wrest/resource/base.rbc +2115 -0
  47. data/lib/wrest/resource.rbc +163 -0
  48. data/lib/wrest/uri.rbc +2599 -0
  49. data/lib/wrest/uri_template.rbc +505 -0
  50. data/lib/wrest/version.rb +1 -1
  51. data/lib/wrest/version.rbc +372 -0
  52. data/lib/wrest.rb +1 -1
  53. data/lib/wrest.rbc +1900 -0
  54. metadata +99 -102
  55. data/Rakefile +0 -495
  56. data/VERSION.yml +0 -5
  57. data/bin/jwrest +0 -3
  58. data/examples/delicious.rb +0 -72
  59. data/examples/facebook.rb +0 -101
  60. data/examples/imgur_multipart.rb +0 -24
  61. data/examples/keep_alive.rb +0 -37
  62. data/examples/redirection.rb +0 -27
  63. data/examples/twitter.rb +0 -78
  64. data/examples/twitter_public_timeline.rb +0 -32
  65. data/examples/wow_realm_status.rb +0 -67
  66. data/init.rb +0 -0
  67. data/spec/custom_matchers/custom_matchers.rb +0 -2
  68. data/spec/rcov.opts +0 -4
  69. data/spec/spec.opts.disable +0 -6
  70. data/spec/unit/spec_helper.rb +0 -35
  71. data/spec/unit/wrest/components/attributes_container/alias_accessors_spec.rb +0 -49
  72. data/spec/unit/wrest/components/attributes_container/typecaster_spec.rb +0 -83
  73. data/spec/unit/wrest/components/attributes_container_spec.rb +0 -254
  74. data/spec/unit/wrest/components/mutators/base_spec.rb +0 -42
  75. data/spec/unit/wrest/components/mutators/camel_to_snake_spec.rb +0 -22
  76. data/spec/unit/wrest/components/mutators/xml_mini_type_caster_spec.rb +0 -75
  77. data/spec/unit/wrest/components/mutators/xml_simple_type_caster_spec.rb +0 -47
  78. data/spec/unit/wrest/components/mutators_spec.rb +0 -21
  79. data/spec/unit/wrest/components/translators/xml_spec.rb +0 -16
  80. data/spec/unit/wrest/components/translators_spec.rb +0 -18
  81. data/spec/unit/wrest/core_ext/hash/conversions_spec.rb +0 -22
  82. data/spec/unit/wrest/core_ext/string/conversions_spec.rb +0 -39
  83. data/spec/unit/wrest/curl/request_spec.rb +0 -19
  84. data/spec/unit/wrest/curl/response_spec.rb +0 -16
  85. data/spec/unit/wrest/http/response_spec.rb +0 -24
  86. data/spec/unit/wrest/native/redirection_spec.rb +0 -42
  87. data/spec/unit/wrest/native/request_spec.rb +0 -71
  88. data/spec/unit/wrest/native/response_spec.rb +0 -72
  89. data/spec/unit/wrest/native/session_spec.rb +0 -74
  90. data/spec/unit/wrest/resource/base_spec.rb +0 -274
  91. data/spec/unit/wrest/uri_spec.rb +0 -273
  92. data/spec/unit/wrest/uri_template_spec.rb +0 -38
  93. 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
- # AttributesContainer could well have
29
- # different attribute getters/setters/query methods.
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 AttributesContainer by invoking <tt>super(attributes)</tt>
45
+ # of Container by invoking <tt>super(attributes)</tt>
46
46
  #
47
47
  # Example:
48
48
  # class ShenCoin
49
- # include Wrest::Components::AttributesContainer
50
- # include Wrest::Components::AttributesContainer::Typecaster
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 AttributesContainer, overriding any exisiting methods with the same names.
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::AttributesContainer::Typecaster into
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::AttributesContainer::Typecaster for the actual docs.
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 AttributesContainer in your
129
- # own class.
128
+ # when using Container in your own class.
130
129
  def initialize(attributes = {})
131
- @attributes = attributes.symbolize_keys
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 AttributesContainer#to_xml helper.
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