smartdc 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +7 -7
- data/README.md +5 -5
- data/VERSION +1 -1
- data/bin/sdc-addmachinemetadata +2 -2
- data/bin/sdc-addmachinetag +2 -2
- data/bin/sdc-createinstrumentation +1 -2
- data/bin/sdc-createkey +1 -2
- data/bin/sdc-createmachine +5 -5
- data/bin/sdc-createmachinesnapshot +1 -2
- data/bin/sdc-deleteinstrumentation +4 -2
- data/bin/sdc-deletekey +4 -2
- data/bin/sdc-deletemachine +4 -2
- data/bin/sdc-deletemachinemetadata +4 -2
- data/bin/sdc-deletemachinesnapshot +4 -3
- data/bin/sdc-deletemachinetag +4 -2
- data/bin/sdc-describeanalytics +1 -2
- data/bin/sdc-getdatacenter +1 -2
- data/bin/sdc-getdataset +1 -2
- data/bin/sdc-getinstrumentation +1 -2
- data/bin/sdc-getkey +1 -2
- data/bin/sdc-getmachine +3 -2
- data/bin/sdc-getmachinemetadata +4 -3
- data/bin/sdc-getmachinesnapshot +1 -2
- data/bin/sdc-getmachinetag +1 -2
- data/bin/sdc-getpackage +1 -2
- data/bin/sdc-listdatacenters +1 -2
- data/bin/sdc-listdatasets +1 -2
- data/bin/sdc-listinstrumentations +1 -2
- data/bin/sdc-listkeys +1 -2
- data/bin/sdc-listmachines +1 -2
- data/bin/sdc-listmachinesnapshots +1 -2
- data/bin/sdc-listmachinetags +1 -2
- data/bin/sdc-listpackages +1 -2
- data/bin/sdc-rebootmachine +4 -2
- data/bin/sdc-resizemachine +5 -3
- data/bin/sdc-setup +7 -3
- data/bin/sdc-startmachine +4 -2
- data/bin/sdc-startmachinefromsnapshot +4 -3
- data/bin/sdc-stopmachine +4 -2
- data/lib/smartdc.rb +1 -0
- data/lib/smartdc/api/analytics/instrumentations.rb +1 -2
- data/lib/smartdc/api/keys.rb +0 -1
- data/lib/smartdc/api/machine/metadata.rb +1 -2
- data/lib/smartdc/api/machine/snapshots.rb +1 -3
- data/lib/smartdc/api/machine/tags.rb +1 -2
- data/lib/smartdc/api/machines.rb +0 -5
- data/lib/smartdc/client.rb +4 -0
- data/lib/smartdc/error.rb +35 -0
- data/lib/smartdc/request.rb +13 -10
- data/lib/smartdc/response/mashify.rb +29 -0
- data/lib/smartdc/response/parse_json.rb +26 -0
- data/lib/smartdc/response/raise_error.rb +38 -0
- data/smartdc.gemspec +25 -23
- data/spec/smartdc/api/analytics_spec.rb +1 -1
- data/spec/smartdc/api/keys_spec.rb +1 -1
- data/spec/smartdc/api/machine/metadata_spec.rb +21 -4
- data/spec/smartdc/api/machine/snapshots_spec.rb +17 -5
- data/spec/smartdc/api/machine/tags_spec.rb +21 -4
- data/spec/smartdc/api/machines_spec.rb +19 -23
- data/spec/smartdc/request_spec.rb +3 -2
- data/spec/spec_helper.rb +7 -1
- metadata +33 -31
- data/lib/faraday/response/mashify.rb +0 -26
- 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
|