cloudability 0.1.0 → 0.1.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 97772a04d10ae950a9ac8b6c7f821bf6a43fbbe6
4
- data.tar.gz: 48ba113fcd25cc19921743f5fa6304b069897589
3
+ metadata.gz: 91765810ca59b0ee578b639e8a4e0501eb63e50c
4
+ data.tar.gz: aafec5772c39d5c7b3dd65ff19cecac6a9f4f82c
5
5
  SHA512:
6
- metadata.gz: a166392737fe8d90c66b8345e43cb3f4b29266291682f7c5d64cb81742c4784e214f662b23b5f725a079ca4cb45d07dad6241b3a11e832d5c0648afe69510ba3
7
- data.tar.gz: 5945d472dce52218f9c54addec0f4cfb588bd94d92e8a86cff02b9d012b9eaea08612e364408e54d99f5214faae6436bcd2efa1b35f00812e1b1f0ae05ecbc50
6
+ metadata.gz: 2363768fce7a35a567eb39897757ed8b815dda2f41f446c33a4b49cd3a911c8b1e896a7d74ecff5611b799b9cb223f4179b6437b490594ebea448e003e8b4612
7
+ data.tar.gz: 2968647530d907f388c1cbc87c2f6686ff2ff80b4a6a44ed27db3fc1cb53c5b56f97088ecec1782810e4eaf705710bb0017ff10cf9af893c0c7fd37c623a2bd1
@@ -10,8 +10,11 @@ require 'cloudability/client/organizations'
10
10
 
11
11
  require 'cloudability/version'
12
12
 
13
-
14
13
  module Cloudability
14
+
15
+ # Exceptions
16
+ class RequestError < StandardError; end
17
+
15
18
  class Client
16
19
  include Cloudability::Client::BillingReports
17
20
  include Cloudability::Client::UsageReports
@@ -32,28 +35,28 @@ module Cloudability
32
35
 
33
36
  def get(url, params={})
34
37
  response = self.class.get(url, options(query: params))
35
- response.success? ? response : raise(response.response)
38
+ response.success? ? response : raise(RequestError, response.message)
36
39
  end
37
40
 
38
41
  def post(url, params={})
39
42
  response = self.class.post(url, options(query: params))
40
- response.success? ? response : raise(response.response)
43
+ response.success? ? response : raise(RequestError, response.message)
41
44
  end
42
45
 
43
46
  def put(url, params={})
44
47
  response = self.class.put(url, options(query: params))
45
- response.success? ? response : raise(response.response)
48
+ response.success? ? response : raise(RequestError, response.message)
46
49
  end
47
50
 
48
51
  def delete(url, params={})
49
52
  response = self.class.delete(url, options(query: params))
50
- response.success? ? response : raise(response.response)
53
+ response.success? ? response : raise(RequestError, response.message)
51
54
  end
52
55
 
53
56
  # Convert the an array of hashes into an array of Mashes!
54
57
  #
55
- # @param [String] array of hashes.
56
- # @return [Array] array of Hashie::Mashes
58
+ # @param [String] array of Ruby hashes
59
+ # @return [Array<Hashie::Mash>] array of Hashie::Mashes
57
60
  def convert_to_mashes(array)
58
61
  array.map { |element| Hashie::Mash.new(element) }
59
62
  end
@@ -67,4 +70,4 @@ module Cloudability
67
70
  end
68
71
 
69
72
  end
70
- end
73
+ end
@@ -5,7 +5,7 @@ module Cloudability
5
5
  # Generate a report of your spend
6
6
  #
7
7
  # @param [Hash] optional parameters
8
- # @return [Array] array of Hashie::Mashes
8
+ # @return [Array<Hashie::Mash>] array of Hashie::Mashes
9
9
  # @see http://developers.cloudability.com/resources/billing_reports/
10
10
  # @example generate report
11
11
  # .billing_report(vendor: 'Amazon')
@@ -16,7 +16,7 @@ module Cloudability
16
16
  convert_to_mashes request
17
17
  end
18
18
  alias :billing_reports :billing_report
19
-
19
+
20
20
  end
21
21
  end
22
- end
22
+ end
@@ -9,7 +9,7 @@ module Cloudability
9
9
  request = get '/1/budgets/index'
10
10
  convert_to_mashes(request)
11
11
  end
12
-
12
+
13
13
  end
14
14
  end
15
- end
15
+ end
@@ -9,7 +9,7 @@ module Cloudability
9
9
  request = get '/0/credentials/index'
10
10
  convert_to_mashes request
11
11
  end
12
-
12
+
13
13
  end
14
14
  end
15
- end
15
+ end
@@ -73,4 +73,4 @@ module Cloudability
73
73
  alias :update_invitation :update_invite
74
74
  end
75
75
  end
76
- end
76
+ end
@@ -27,7 +27,7 @@ module Cloudability
27
27
  def usage_filters
28
28
  get('/1/reporting/filters').to_a
29
29
  end
30
-
30
+
31
31
  end
32
32
  end
33
- end
33
+ end
@@ -1,3 +1,3 @@
1
1
  module Cloudability
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudability
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Colby Aley
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-12-27 00:00:00.000000000 Z
12
+ date: 2014-01-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty