cloudability 0.0.1 → 0.0.5

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 (39) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +1 -0
  3. data/.travis.yml +5 -0
  4. data/Gemfile +3 -11
  5. data/LICENSE.txt +17 -18
  6. data/README.md +21 -22
  7. data/Rakefile +8 -5
  8. data/cloudability.gemspec +11 -6
  9. data/lib/cloudability.rb +7 -7
  10. data/lib/cloudability/billing.rb +35 -36
  11. data/lib/cloudability/budgets.rb +16 -10
  12. data/lib/cloudability/credentials.rb +7 -5
  13. data/lib/cloudability/organizations.rb +71 -0
  14. data/lib/cloudability/time_helper.rb +4 -5
  15. data/lib/cloudability/version.rb +1 -1
  16. data/spec/cloduability/billing_spec.rb +53 -0
  17. data/spec/cloduability/budgets_spec.rb +65 -0
  18. data/spec/cloduability/credentials_spec.rb +29 -0
  19. data/spec/cloduability/organizations_spec.rb +64 -0
  20. data/spec/fixtures/all_budgets +18 -0
  21. data/spec/fixtures/credentials +18 -0
  22. data/spec/fixtures/organization +18 -0
  23. data/spec/fixtures/organization_invitation +18 -0
  24. data/spec/fixtures/organization_invitations +18 -0
  25. data/spec/fixtures/organization_roles +18 -0
  26. data/spec/fixtures/report_by_account +18 -0
  27. data/spec/fixtures/report_by_period +18 -0
  28. data/spec/spec_helper.rb +48 -0
  29. metadata +89 -42
  30. data/test/fixtures/billing_report_by-vendor.json +0 -1
  31. data/test/fixtures/billing_report_period.json +0 -1
  32. data/test/fixtures/billing_report_year.json +0 -54
  33. data/test/fixtures/budgets.json +0 -34
  34. data/test/fixtures/credentials.json +0 -28
  35. data/test/helper.rb +0 -22
  36. data/test/lib/cloudability/test_billing.rb +0 -55
  37. data/test/lib/cloudability/test_budgets.rb +0 -44
  38. data/test/lib/cloudability/test_credentials.rb +0 -21
  39. data/test/lib/cloudability/test_time_helper.rb +0 -24
metadata CHANGED
@@ -1,56 +1,96 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudability
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
5
- prerelease:
4
+ version: 0.0.5
6
5
  platform: ruby
7
6
  authors:
7
+ - Colby Aley
8
8
  - Aaron Bento
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-20 00:00:00.000000000 Z
12
+ date: 2013-12-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty
16
16
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
17
  requirements:
19
- - - ! '>='
18
+ - - ~>
19
+ - !ruby/object:Gem::Version
20
+ version: 0.9.0
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ~>
26
+ - !ruby/object:Gem::Version
27
+ version: 0.9.0
28
+ - !ruby/object:Gem::Dependency
29
+ name: hashie
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - '>='
20
33
  - !ruby/object:Gem::Version
21
34
  version: '0'
22
35
  type: :runtime
23
36
  prerelease: false
24
37
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
38
  requirements:
27
- - - ! '>='
39
+ - - '>='
28
40
  - !ruby/object:Gem::Version
29
41
  version: '0'
30
42
  - !ruby/object:Gem::Dependency
31
- name: mash
43
+ name: rspec
32
44
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
45
  requirements:
35
- - - ! '>='
46
+ - - '>='
36
47
  - !ruby/object:Gem::Version
37
48
  version: '0'
38
- type: :runtime
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: fakeweb
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ type: :development
39
64
  prerelease: false
40
65
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
66
  requirements:
43
- - - ! '>='
67
+ - - '>='
44
68
  - !ruby/object:Gem::Version
45
69
  version: '0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: rake
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ~>
75
+ - !ruby/object:Gem::Version
76
+ version: '0.6'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ~>
82
+ - !ruby/object:Gem::Version
83
+ version: '0.6'
46
84
  description: Ruby wrapper for the Cloudability API
47
85
  email:
86
+ - colby@cloudability.com
48
87
  - abento+github@gmail.com
49
88
  executables: []
50
89
  extensions: []
51
90
  extra_rdoc_files: []
52
91
  files:
53
92
  - .gitignore
93
+ - .travis.yml
54
94
  - Gemfile
55
95
  - LICENSE.txt
56
96
  - README.md
@@ -60,50 +100,57 @@ files:
60
100
  - lib/cloudability/billing.rb
61
101
  - lib/cloudability/budgets.rb
62
102
  - lib/cloudability/credentials.rb
103
+ - lib/cloudability/organizations.rb
63
104
  - lib/cloudability/time_helper.rb
64
105
  - lib/cloudability/version.rb
65
- - test/fixtures/billing_report_by-vendor.json
66
- - test/fixtures/billing_report_period.json
67
- - test/fixtures/billing_report_year.json
68
- - test/fixtures/budgets.json
69
- - test/fixtures/credentials.json
70
- - test/helper.rb
71
- - test/lib/cloudability/test_billing.rb
72
- - test/lib/cloudability/test_budgets.rb
73
- - test/lib/cloudability/test_credentials.rb
74
- - test/lib/cloudability/test_time_helper.rb
75
- homepage: ''
76
- licenses: []
106
+ - spec/cloduability/billing_spec.rb
107
+ - spec/cloduability/budgets_spec.rb
108
+ - spec/cloduability/credentials_spec.rb
109
+ - spec/cloduability/organizations_spec.rb
110
+ - spec/fixtures/all_budgets
111
+ - spec/fixtures/credentials
112
+ - spec/fixtures/organization
113
+ - spec/fixtures/organization_invitation
114
+ - spec/fixtures/organization_invitations
115
+ - spec/fixtures/organization_roles
116
+ - spec/fixtures/report_by_account
117
+ - spec/fixtures/report_by_period
118
+ - spec/spec_helper.rb
119
+ homepage: https://github.com/colbyaley/cloudability
120
+ licenses:
121
+ - MIT
122
+ metadata: {}
77
123
  post_install_message:
78
124
  rdoc_options: []
79
125
  require_paths:
80
126
  - lib
81
127
  required_ruby_version: !ruby/object:Gem::Requirement
82
- none: false
83
128
  requirements:
84
- - - ! '>='
129
+ - - '>='
85
130
  - !ruby/object:Gem::Version
86
131
  version: '0'
87
132
  required_rubygems_version: !ruby/object:Gem::Requirement
88
- none: false
89
133
  requirements:
90
- - - ! '>='
134
+ - - '>='
91
135
  - !ruby/object:Gem::Version
92
136
  version: '0'
93
137
  requirements: []
94
138
  rubyforge_project:
95
- rubygems_version: 1.8.24
139
+ rubygems_version: 2.0.3
96
140
  signing_key:
97
- specification_version: 3
98
- summary: Ruby wrapper for the Cloudability API using httparty
141
+ specification_version: 4
142
+ summary: Ruby wrapper for the Cloudability API built with HTTParty
99
143
  test_files:
100
- - test/fixtures/billing_report_by-vendor.json
101
- - test/fixtures/billing_report_period.json
102
- - test/fixtures/billing_report_year.json
103
- - test/fixtures/budgets.json
104
- - test/fixtures/credentials.json
105
- - test/helper.rb
106
- - test/lib/cloudability/test_billing.rb
107
- - test/lib/cloudability/test_budgets.rb
108
- - test/lib/cloudability/test_credentials.rb
109
- - test/lib/cloudability/test_time_helper.rb
144
+ - spec/cloduability/billing_spec.rb
145
+ - spec/cloduability/budgets_spec.rb
146
+ - spec/cloduability/credentials_spec.rb
147
+ - spec/cloduability/organizations_spec.rb
148
+ - spec/fixtures/all_budgets
149
+ - spec/fixtures/credentials
150
+ - spec/fixtures/organization
151
+ - spec/fixtures/organization_invitation
152
+ - spec/fixtures/organization_invitations
153
+ - spec/fixtures/organization_roles
154
+ - spec/fixtures/report_by_account
155
+ - spec/fixtures/report_by_period
156
+ - spec/spec_helper.rb
@@ -1 +0,0 @@
1
- [{"vendor_id":1,"vendor_name":"Amazon","spend":"100000.99"}]
@@ -1 +0,0 @@
1
- [{"period":"2012-11-01","spend":"4987.99"}]
@@ -1,54 +0,0 @@
1
- [
2
- {
3
- "period": "2011-11-01",
4
- "spend": "4463.67"
5
- },
6
- {
7
- "period": "2011-12-01",
8
- "spend": "5207.81"
9
- },
10
- {
11
- "period": "2012-01-01",
12
- "spend": "6398.46"
13
- },
14
- {
15
- "period": "2012-02-01",
16
- "spend": "7645.38"
17
- },
18
- {
19
- "period": "2012-03-01",
20
- "spend": "10005.89"
21
- },
22
- {
23
- "period": "2012-04-01",
24
- "spend": "12363.48"
25
- },
26
- {
27
- "period": "2012-05-01",
28
- "spend": "13752.46"
29
- },
30
- {
31
- "period": "2012-06-01",
32
- "spend": "12618.84"
33
- },
34
- {
35
- "period": "2012-07-01",
36
- "spend": "13739.12"
37
- },
38
- {
39
- "period": "2012-08-01",
40
- "spend": "13461.66"
41
- },
42
- {
43
- "period": "2012-09-01",
44
- "spend": "12741.14"
45
- },
46
- {
47
- "period": "2012-10-01",
48
- "spend": "12729.93"
49
- },
50
- {
51
- "period": "2012-11-01",
52
- "spend": "4987.99"
53
- }
54
- ]
@@ -1,34 +0,0 @@
1
- [
2
- {
3
- "predicted_monthly_spend": {
4
- "cents": 1000000,
5
- "currency": {
6
- "id": 146,
7
- "key": "usd",
8
- "priority": 1,
9
- "iso_code": "USD"
10
- }
11
- },
12
- "subject": "1234-5678-90A",
13
- "type": "Account",
14
- "id": 1234,
15
- "is_active": true,
16
- "threshold": "100000.0"
17
- },
18
- {
19
- "predicted_monthly_spend": {
20
- "cents": 10000000,
21
- "currency": {
22
- "id": 146,
23
- "key": "usd",
24
- "priority": 1,
25
- "iso_code": "USD"
26
- }
27
- },
28
- "subject": "user@example.com",
29
- "type": "User",
30
- "id": 9999,
31
- "is_active": true,
32
- "threshold": "10000.0"
33
- }
34
- ]
@@ -1,28 +0,0 @@
1
- [
2
- {
3
- "has_auth": true,
4
- "has_estimate": false,
5
- "is_duplicate": false,
6
- "vendor_key": "Amazon",
7
- "id": 10001,
8
- "vendor_id": 1,
9
- "created_at": "2011-11-01T00:00:00Z",
10
- "updated_at": "2012-11-01T00:00:00Z",
11
- "nickname": "Amazon Example",
12
- "state": "verified",
13
- "account_identifier": "1234-5678-90A",
14
- "account_created_at": "2011-11-01T00:00:00Z"
15
- },
16
- {
17
- "has_auth": false,
18
- "has_estimate": false,
19
- "is_duplicate": false,
20
- "vendor_key": "Cloudability",
21
- "id": 10001,
22
- "vendor_id": 122,
23
- "created_at": "2012-11-01T00:00:00Z",
24
- "updated_at": "2012-11-01T00:00:00Z",
25
- "nickname": "Cloudability",
26
- "state": "invisible"
27
- }
28
- ]
@@ -1,22 +0,0 @@
1
- require 'test/unit'
2
- require 'turn/autorun'
3
- require 'shoulda'
4
- require 'fakeweb'
5
- require 'matchy'
6
-
7
- require_relative '../lib/cloudability'
8
-
9
- FakeWeb.allow_net_connect = false
10
-
11
- def fixture_file(filename)
12
- return '' if filename == ''
13
- file_path = File.expand_path(File.dirname(__FILE__) + '/fixtures/' + filename)
14
- File.read(file_path)
15
- end
16
-
17
- def stub_get(url, filename, status=nil)
18
- options = {:body => fixture_file(filename)}
19
- options.merge!({:status => status}) unless status.nil?
20
-
21
- FakeWeb.register_uri(:get, url, options)
22
- end
@@ -1,55 +0,0 @@
1
- require_relative '../../helper'
2
-
3
- class TestCloudability < Test::Unit::TestCase
4
- context "Billing :: Hitting the Cloudability Billing API" do
5
- setup do
6
- @auth_token = 'xxxxxxxxxxxxxxxxxxxx'
7
- @report = Cloudability::Billing.new(:auth_token => @auth_token)
8
-
9
- # The billing API endpoint
10
- @billing_uri = "https://app.cloudability.com/api/0/billing_reports?auth_token=#{@auth_token}"
11
- @default_fixture = "billing_report_period.json"
12
- end
13
-
14
- # Filter by TODO ::
15
- # - <filter>= : vendor, service, credential, account
16
- # - combine filters
17
- should "return a single period Mash containing spending" do
18
- period = "2012-11-01"
19
- uri = "#{@billing_uri}&period=#{period}"
20
-
21
- stub_get uri, @default_fixture
22
- single_period = @report.filter_by_period(period)
23
- single_period.period.should == period
24
- single_period.spend.should == "4987.99"
25
- end
26
-
27
- # Report by TODO ::
28
- # - by= : service, credential, account
29
- # - combine filters
30
-
31
- should "report by period" do
32
- uri = "#{@billing_uri}&by=period"
33
- stub_get uri, "billing_report_year.json"
34
-
35
- billing_report = @report.report_by(:period)
36
-
37
- billing_report.count.should == 13
38
- billing_report.first.period.should == "2011-11-01"
39
- billing_report.last.period.should == "2012-11-01"
40
- billing_report.last.spend.should == "4987.99"
41
- end
42
-
43
- should "report by vendor" do
44
- uri = "#{@billing_uri}&by=vendor"
45
- stub_get uri, "billing_report_by-vendor.json"
46
-
47
- billing_report = @report.report_by(:vendor)
48
-
49
- billing_report.count.should == 1
50
- billing_report.first.vendor_name.should == "Amazon"
51
- billing_report.last.spend.should == "100000.99"
52
- end
53
-
54
- end
55
- end
@@ -1,44 +0,0 @@
1
- require_relative '../../helper'
2
-
3
- class TestCloudability < Test::Unit::TestCase
4
- context "Budgets :: Hitting the Cloudability Budgets API" do
5
- setup do
6
- @auth_token = 'xxxxxxxxxxxxxxxxxxxx'
7
- @budgets = Cloudability::Budgets.new(:auth_token => @auth_token)
8
-
9
- # The budget API endpoint
10
- @default_uri = "https://app.cloudability.com/api/1/budgets/index?auth_token=#{@auth_token}"
11
- @default_fixture = "budgets.json"
12
- end
13
-
14
- should "return all budgets in an Array of Mashes" do
15
- stub_get @default_uri, @default_fixture
16
- all_budgets = @budgets.find_all
17
- all_budgets.class.should == Array
18
- all_budgets.each { |b| b.class.should == Mash }
19
- end
20
-
21
- should "return a single budget Mash when calling find with an id" do
22
- stub_get @default_uri, @default_fixture
23
- single_budget = @budgets.find_by_id(1234)
24
- single_budget.subject.should == "1234-5678-90A"
25
- end
26
-
27
- should "return a single budget Mash when calling find with a subject" do
28
- stub_get @default_uri, @default_fixture
29
- single_budget = @budgets.find_by_subject("1234-5678-90A")
30
- single_budget.id.should == 1234
31
- end
32
-
33
- should "return a single budget Mash when calling find with a key" do
34
- stub_get @default_uri, @default_fixture
35
-
36
- single_budget = @budgets.find_by_key({ :key => :id, :value => 1234 })
37
- single_budget.subject.should == "1234-5678-90A"
38
-
39
- single_budget = @budgets.find_by_key({ :key => :subject, :value => "1234-5678-90A" })
40
- single_budget.id.should == 1234
41
- end
42
-
43
- end
44
- end
@@ -1,21 +0,0 @@
1
- require_relative '../../helper'
2
-
3
- class TestCloudability < Test::Unit::TestCase
4
- context "Credentials :: Hitting the Cloudability Credentials API" do
5
- setup do
6
- @auth_token = 'xxxxxxxxxxxxxxxxxxxx'
7
- @credentials = Cloudability::Credentials.new(:auth_token => @auth_token)
8
-
9
- # The budget API endpoint
10
- @default_uri = "https://app.cloudability.com/api/0/credentials/index?auth_token=#{@auth_token}"
11
- @default_fixture = "credentials.json"
12
- end
13
-
14
- should "return all credentials in an Array of Mashes" do
15
- stub_get @default_uri, @default_fixture
16
- all_credentials = @credentials.find_all
17
- all_credentials.class.should == Array
18
- all_credentials.each { |c| c.class.should == Mash }
19
- end
20
- end
21
- end