azure-armrest 0.3.12 → 0.3.13

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: 5022f64bbe2cfc12d269a9b1ef34eda423076aff
4
- data.tar.gz: 86f456d2c2e7eb2724599da6d2239f3dc1839e7b
3
+ metadata.gz: 9b520aacacd8fdef3e6e2ac80c456d2abcb283bd
4
+ data.tar.gz: 0a566e5530a3f87f153775905767cdab27eb1644
5
5
  SHA512:
6
- metadata.gz: 516af488cfffe832df8e468c19201ab59253130023d0eddc1c0bba2dbe6ddb269b51ff781f5218c6090a37450d8d057f5ccf0083b737941c2830e67988a32f2b
7
- data.tar.gz: 2ef615e16a7809c5418becdcf17439c9303a3f05119c2a26925319ba16194f028e7599537fb4c940b6a29d0b3833e24a89e05d2aff67fb09f11ae58c978fd16e
6
+ metadata.gz: 89e70a7bc4e5e822fe239260a5cc0f17b5e6bb06dec78373c64ab6f0a84b44f5a95295e257429fd29c64b5dbe3fe43675bc9fb86b6e26d7d7e83f459ff8f0260
7
+ data.tar.gz: d1dd5813b5681bfea7ffdb2a92e3d5265e49a3a451a5142a534e341c8e2d9d7d59bbcaf83ccfcd2dc6b3183c89cca2b32372d6c0f0e7cd4b0a3dd0ce369d4b44
data/CHANGES CHANGED
@@ -1,3 +1,9 @@
1
+ = 0.3.13 - 30-Nov-2016
2
+ * Fixed the Billing::Usage model class name.
3
+ * Updated the Billing::Usage#list method so that it returns an ArmrestCollection
4
+ instead of a plain array. In addition, it now supports an :all option so
5
+ that you don't have to deal with continuation tokens.
6
+
1
7
  = 0.3.12 - 15-Nov-2016
2
8
  * Added the Insights::DiagnosticService class.
3
9
  * Added the get_from_vm and get_os_disk methods to StorageAccountService.
@@ -18,15 +18,42 @@ module Azure
18
18
  # :showDetails # Either true or false. Default is true.
19
19
  # :continuationToken # Token received from previous call. No default.
20
20
  #
21
+ # You may also pass ':all => true' to retrieve all records instead of
22
+ # dealing with continuation tokens yourself. By default Azure will only
23
+ # return the first 1000 records.
24
+ #
21
25
  # The :reportedStartTime and :reportedEndTime values should be in
22
26
  # UTC + iso8601 format. For "Daily" aggregation, the time should be set
23
27
  # to midnight. For "Hourly" aggregation, only the hour should be
24
28
  # set, with minutes and seconds set to "00".
25
29
  #
30
+ # Example:
31
+ #
32
+ # require 'azure-armrest'
33
+ # require 'time'
34
+ #
35
+ # conf = Azure::Armrest::Configuration.new(<your_credentials>)
36
+ # bill = Azure::Armrest::Billing::UsageService.new(conf)
37
+ #
38
+ # options = {
39
+ # :reportedStartTime => Time.new(2016,10,1,0,0,0,0).utc.iso8601,
40
+ # :reportedEndTime => Time.new(2016,10,31,0,0,0,0).utc.iso8601,
41
+ # :showDetails => true,
42
+ # :aggregationGranularity => 'Daily',
43
+ # :all => true
44
+ # }
45
+ #
46
+ # list = bill.list(options)
47
+ #
26
48
  def list(options = {})
27
49
  url = build_url(options)
28
50
  response = rest_get(url)
29
- JSON.parse(response)['value'].map { |hash| Azure::Armrest::Usage.new(hash) }
51
+
52
+ if options[:all]
53
+ get_all_results(response)
54
+ else
55
+ Azure::Armrest::ArmrestCollection.create_from_response(response, Azure::Armrest::Billing::Usage)
56
+ end
30
57
  end
31
58
 
32
59
  private
@@ -189,7 +189,10 @@ module Azure
189
189
  class ResourceGroup < BaseModel; end
190
190
  class ResourceProvider < BaseModel; end
191
191
  class Sku < BaseModel; end
192
- class Usage < BaseModel; end
192
+
193
+ module Billing
194
+ class Usage < BaseModel; end
195
+ end
193
196
 
194
197
  class ResponseHeaders < BaseModel
195
198
  undef_method :response_headers
@@ -1,5 +1,5 @@
1
1
  module Azure
2
2
  module Armrest
3
- VERSION = '0.3.12'.freeze
3
+ VERSION = '0.3.13'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: azure-armrest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.12
4
+ version: 0.3.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel J. Berger
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2016-11-15 00:00:00.000000000 Z
14
+ date: 2016-11-30 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: json
@@ -290,7 +290,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
290
290
  version: '0'
291
291
  requirements: []
292
292
  rubyforge_project:
293
- rubygems_version: 2.6.8
293
+ rubygems_version: 2.6.6
294
294
  signing_key:
295
295
  specification_version: 4
296
296
  summary: An interface for ARM/JSON Azure REST API