smartdc 0.3.0 → 0.4.0

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 (64) hide show
  1. data/Gemfile +7 -7
  2. data/README.md +5 -5
  3. data/VERSION +1 -1
  4. data/bin/sdc-addmachinemetadata +2 -2
  5. data/bin/sdc-addmachinetag +2 -2
  6. data/bin/sdc-createinstrumentation +1 -2
  7. data/bin/sdc-createkey +1 -2
  8. data/bin/sdc-createmachine +5 -5
  9. data/bin/sdc-createmachinesnapshot +1 -2
  10. data/bin/sdc-deleteinstrumentation +4 -2
  11. data/bin/sdc-deletekey +4 -2
  12. data/bin/sdc-deletemachine +4 -2
  13. data/bin/sdc-deletemachinemetadata +4 -2
  14. data/bin/sdc-deletemachinesnapshot +4 -3
  15. data/bin/sdc-deletemachinetag +4 -2
  16. data/bin/sdc-describeanalytics +1 -2
  17. data/bin/sdc-getdatacenter +1 -2
  18. data/bin/sdc-getdataset +1 -2
  19. data/bin/sdc-getinstrumentation +1 -2
  20. data/bin/sdc-getkey +1 -2
  21. data/bin/sdc-getmachine +3 -2
  22. data/bin/sdc-getmachinemetadata +4 -3
  23. data/bin/sdc-getmachinesnapshot +1 -2
  24. data/bin/sdc-getmachinetag +1 -2
  25. data/bin/sdc-getpackage +1 -2
  26. data/bin/sdc-listdatacenters +1 -2
  27. data/bin/sdc-listdatasets +1 -2
  28. data/bin/sdc-listinstrumentations +1 -2
  29. data/bin/sdc-listkeys +1 -2
  30. data/bin/sdc-listmachines +1 -2
  31. data/bin/sdc-listmachinesnapshots +1 -2
  32. data/bin/sdc-listmachinetags +1 -2
  33. data/bin/sdc-listpackages +1 -2
  34. data/bin/sdc-rebootmachine +4 -2
  35. data/bin/sdc-resizemachine +5 -3
  36. data/bin/sdc-setup +7 -3
  37. data/bin/sdc-startmachine +4 -2
  38. data/bin/sdc-startmachinefromsnapshot +4 -3
  39. data/bin/sdc-stopmachine +4 -2
  40. data/lib/smartdc.rb +1 -0
  41. data/lib/smartdc/api/analytics/instrumentations.rb +1 -2
  42. data/lib/smartdc/api/keys.rb +0 -1
  43. data/lib/smartdc/api/machine/metadata.rb +1 -2
  44. data/lib/smartdc/api/machine/snapshots.rb +1 -3
  45. data/lib/smartdc/api/machine/tags.rb +1 -2
  46. data/lib/smartdc/api/machines.rb +0 -5
  47. data/lib/smartdc/client.rb +4 -0
  48. data/lib/smartdc/error.rb +35 -0
  49. data/lib/smartdc/request.rb +13 -10
  50. data/lib/smartdc/response/mashify.rb +29 -0
  51. data/lib/smartdc/response/parse_json.rb +26 -0
  52. data/lib/smartdc/response/raise_error.rb +38 -0
  53. data/smartdc.gemspec +25 -23
  54. data/spec/smartdc/api/analytics_spec.rb +1 -1
  55. data/spec/smartdc/api/keys_spec.rb +1 -1
  56. data/spec/smartdc/api/machine/metadata_spec.rb +21 -4
  57. data/spec/smartdc/api/machine/snapshots_spec.rb +17 -5
  58. data/spec/smartdc/api/machine/tags_spec.rb +21 -4
  59. data/spec/smartdc/api/machines_spec.rb +19 -23
  60. data/spec/smartdc/request_spec.rb +3 -2
  61. data/spec/spec_helper.rb +7 -1
  62. metadata +33 -31
  63. data/lib/faraday/response/mashify.rb +0 -26
  64. data/lib/faraday/response/parse_json.rb +0 -22
@@ -1,26 +0,0 @@
1
- require 'faraday'
2
-
3
- module Faraday
4
- class Response::Mashify < Response::Middleware
5
- dependency 'hashie/mash'
6
-
7
- class << self
8
- attr_accessor :mash_class
9
- end
10
-
11
- self.mash_class = ::Hashie::Mash
12
-
13
- def parse(body)
14
- case body
15
- when Hash
16
- self.class.mash_class.new(body)
17
- when Array
18
- body.map { |item| item.is_a?(Hash) ? self.class.mash_class.new(item) : item }
19
- else
20
- body
21
- end
22
- rescue
23
- body
24
- end
25
- end
26
- end
@@ -1,22 +0,0 @@
1
- require 'faraday'
2
-
3
- module Faraday
4
- class Response::ParseJson < Response::Middleware
5
- dependency 'multi_json'
6
-
7
- def parse(body)
8
- case body
9
- when ''
10
- nil
11
- when 'true'
12
- true
13
- when 'false'
14
- false
15
- else
16
- ::MultiJson.decode(body)
17
- end
18
- rescue
19
- body
20
- end
21
- end
22
- end