wrest 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. data/README.rdoc +51 -19
  2. data/Rakefile +8 -4
  3. data/VERSION.yml +1 -1
  4. data/lib/wrest.rb +11 -2
  5. data/lib/wrest/components.rb +1 -2
  6. data/lib/wrest/components/attributes_container.rb +31 -69
  7. data/lib/wrest/components/attributes_container/typecaster.rb +121 -0
  8. data/lib/wrest/components/mutators.rb +18 -1
  9. data/lib/wrest/components/mutators/base.rb +52 -39
  10. data/lib/wrest/components/mutators/camel_to_snake_case.rb +7 -5
  11. data/lib/wrest/components/mutators/xml_mini_type_caster.rb +43 -0
  12. data/lib/wrest/components/mutators/xml_simple_type_caster.rb +22 -20
  13. data/lib/wrest/components/translators.rb +20 -17
  14. data/lib/wrest/components/translators/content_types.rb +2 -2
  15. data/lib/wrest/components/translators/json.rb +11 -8
  16. data/lib/wrest/components/translators/xml.rb +9 -12
  17. data/lib/wrest/core_ext/hash/conversions.rb +1 -1
  18. data/lib/wrest/resource/base.rb +25 -13
  19. data/lib/wrest/resource/state.rb +6 -0
  20. data/lib/wrest/response.rb +4 -0
  21. data/lib/wrest/uri.rb +5 -1
  22. data/lib/wrest/version.rb +1 -1
  23. data/spec/spec.opts +1 -1
  24. data/spec/spec_helper.rb +8 -1
  25. data/spec/wrest/components/attributes_container/typecaster_spec.rb +63 -0
  26. data/spec/wrest/components/attributes_container_spec.rb +6 -61
  27. data/spec/wrest/components/mutators/base_spec.rb +5 -1
  28. data/spec/wrest/components/mutators/xml_mini_type_caster_spec.rb +75 -0
  29. data/spec/wrest/components/mutators_spec.rb +21 -0
  30. data/spec/wrest/components/translators/xml_spec.rb +1 -1
  31. data/spec/wrest/components/translators_spec.rb +9 -0
  32. data/spec/wrest/uri_spec.rb +16 -4
  33. metadata +14 -15
  34. data/lib/wrest/components/typecast_helpers.rb +0 -41
@@ -1,41 +0,0 @@
1
- module Wrest::Components #:nodoc:
2
- # Provides helper methods which build lambdas
3
- # to cast strings to specific types.
4
- module TypecastHelpers
5
- def as_base64Binary
6
- ActiveSupport::CoreExtensions::Hash::Conversions::XML_PARSING['base64Binary']
7
- end
8
-
9
- def as_boolean
10
- ActiveSupport::CoreExtensions::Hash::Conversions::XML_PARSING['boolean']
11
- end
12
-
13
- def as_decimal
14
- ActiveSupport::CoreExtensions::Hash::Conversions::XML_PARSING['decimal']
15
- end
16
-
17
- def as_date
18
- ActiveSupport::CoreExtensions::Hash::Conversions::XML_PARSING['date']
19
- end
20
-
21
- def as_datetime
22
- ActiveSupport::CoreExtensions::Hash::Conversions::XML_PARSING['datetime']
23
- end
24
-
25
- def as_float
26
- ActiveSupport::CoreExtensions::Hash::Conversions::XML_PARSING['float']
27
- end
28
-
29
- def as_integer
30
- ActiveSupport::CoreExtensions::Hash::Conversions::XML_PARSING['integer']
31
- end
32
-
33
- def as_symbol
34
- ActiveSupport::CoreExtensions::Hash::Conversions::XML_PARSING['symbol']
35
- end
36
-
37
- def as_yaml
38
- ActiveSupport::CoreExtensions::Hash::Conversions::XML_PARSING['yaml']
39
- end
40
- end
41
- end