nurego 1.1.21 → 1.1.22

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9fd050b25a4f218e696b283b83fd92b53465043e
4
- data.tar.gz: 561bd9c4233c2434914894f4dec6cd02d331542a
3
+ metadata.gz: c74351863623bde7e41f9ae426e773d7199a7237
4
+ data.tar.gz: b4b994925e0241cccf45a746b8dab9cd978c3352
5
5
  SHA512:
6
- metadata.gz: bf5b1c5b5f4be28293466ff82ed203b27ee165c6647d798c3b48f37a446db3b27a77bf525567d49089d3db400a362a768f0107ad453a8464aced6b8bbb0d1c94
7
- data.tar.gz: 515e3d7888256c0a9d8454b37923f55e11d16277644208290d9388da69fef4c4018f8fdf8375a7515c0bc9d64ee6017fffca9c8c1f18397ae3c8b5e23efebaaa
6
+ metadata.gz: 5c0218315ee123e7165251ff49405ec4770e80d2c4d47278dcd67e53c28d4af3f3565ad200dd7a13863853afee657b0a2e200662b78d07f64353c4ed746a7633
7
+ data.tar.gz: a787e22d34732aea76ea3c139b8f018225ce3f6c1447271159207461f687cb6d6af2e9cfe4139a6096416b39eb5592c45b188ab1f453af7b3bc3dade102b8cd2
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nurego (1.1.20)
4
+ nurego (1.1.21)
5
5
  cf-uaa-lib (= 1.3.10)
6
6
  mime-types (~> 1.25)
7
7
  multi_json (>= 1.0.4, < 2)
@@ -17,14 +17,19 @@ GEM
17
17
  builder (>= 2.1.2)
18
18
  diff-lcs (1.2.5)
19
19
  docile (1.1.3)
20
+ domain_name (0.5.24)
21
+ unf (>= 0.0.5, < 1.0.0)
22
+ http-cookie (1.0.2)
23
+ domain_name (~> 0.5)
20
24
  mime-types (1.25.1)
21
- multi_json (1.10.1)
22
- netrc (0.10.2)
25
+ multi_json (1.11.2)
26
+ netrc (0.10.3)
23
27
  rack (1.5.2)
24
28
  rack-test (0.6.2)
25
29
  rack (>= 1.0)
26
30
  rake (10.3.1)
27
- rest-client (1.7.2)
31
+ rest-client (1.8.0)
32
+ http-cookie (>= 1.0.2, < 2.0)
28
33
  mime-types (>= 1.16, < 3.0)
29
34
  netrc (~> 0.7)
30
35
  rspec (2.14.1)
@@ -44,6 +49,9 @@ GEM
44
49
  simplecov-html (0.8.0)
45
50
  simplecov-rcov (0.2.3)
46
51
  simplecov (>= 0.4.1)
52
+ unf (0.1.4)
53
+ unf_ext
54
+ unf_ext (0.0.7.1)
47
55
  uuidtools (2.1.4)
48
56
 
49
57
  PLATFORMS
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.21
1
+ 1.1.22
@@ -5,9 +5,6 @@ begin
5
5
  setup_login_and_login(true)
6
6
  @email = "integration.test+#{UUIDTools::UUID.random_create.to_s}@openskymarkets.com"
7
7
 
8
-
9
-
10
-
11
8
  # retrieve catalog
12
9
  catalog = Nurego::Catalog.retrieve()
13
10
  puts "Retrieve a catalog:\n" ,catalog[:data]
@@ -42,9 +39,6 @@ begin
42
39
  org = Nurego::Organization.retrieve(org_id)
43
40
  puts "Retrieve an organization by guid:\n" , org , "\n"
44
41
 
45
- entitlements = Nurego::Entitlement.all(org_id)
46
- puts "Retrieve entitlements by organization guid\n" , entitlements, "\n"
47
-
48
42
  #create a new subscription
49
43
  params = {}
50
44
  params[:plan_id] = current_offering.plans[:data][2][:id]
@@ -59,16 +53,17 @@ begin
59
53
  updatedsub = Nurego::Subscription.update(org_id,sub.id,newplan)
60
54
  puts "The Customer subscription (notice the plan update):\n", Nurego::Customer.me.subscriptions , "\n"
61
55
 
62
- #cancel subscription
63
- updatedsub.cancel
64
- puts "The Customer subscription (notice end date:\n", Nurego::Customer.me.subscriptions , "\n"
56
+ entitlements = Nurego::Entitlement.all(updatedsub.id)
57
+ puts "Retrieve entitlements by subscription guid\n" , entitlements, "\n"
65
58
 
66
59
  # update usage
67
- entitlement = org.entitlements.first
68
- Nurego::Entitlement.set_usage(org_id,entitlement.id, 13)
69
- puts "Notice the usage of #{entitlement.id} is now set to 13:\n", Nurego::Organization.retrieve(org_id).entitlements.first, "\n"
70
-
60
+ entitlement = updatedsub.entitlements.first
61
+ Nurego::Entitlement.set_usage(updatedsub.id,entitlement.id, 13)
62
+ puts "Notice the usage of #{entitlement.id} is now set to 13:\n", Nurego::Subscription.retrieve(updatedsub.id).entitlements.first, "\n"
71
63
 
64
+ #cancel subscription
65
+ updatedsub.cancel
66
+ puts "The Customer subscription (notice end date:\n", Nurego::Customer.me.subscriptions , "\n"
72
67
 
73
68
  end
74
69
 
@@ -3,7 +3,15 @@ module Nurego
3
3
  include Nurego::APIOperations::List
4
4
  include Nurego::APIOperations::Create
5
5
 
6
- def self.set_usage(organization_id, feature_id, amount)
6
+ def self.set_usage(subscription_id, feature_id, amount)
7
+ payload = {
8
+ feature_id: feature_id,
9
+ amount: amount,
10
+ }
11
+ response, api_key = Nurego.request(:post, "/v1/subscriptions/#{subscription_id}/entitlements/usage", nil, payload)
12
+ end
13
+
14
+ def self.set_usage_by_organization(organization_id, feature_id, amount)
7
15
  payload = {
8
16
  feature_id: feature_id,
9
17
  amount: amount,
@@ -11,7 +19,12 @@ module Nurego
11
19
  response, api_key = Nurego.request(:post, "/v1/organizations/#{organization_id}/entitlements/usage", nil, payload)
12
20
  end
13
21
 
14
- def self.all(organization_id, filters={}, api_key=nil)
22
+ def self.all(subscription_id, filters={}, api_key=nil)
23
+ response, api_key = Nurego.request(:get, "/v1/subscriptions/#{subscription_id}/entitlements", api_key, filters)
24
+ Util.convert_to_nurego_object(response, api_key)
25
+ end
26
+
27
+ def self.all_by_organization(organization_id, filters={}, api_key=nil)
15
28
  response, api_key = Nurego.request(:get, "/v1/organizations/#{organization_id}/entitlements", api_key, filters)
16
29
  Util.convert_to_nurego_object(response, api_key)
17
30
  end
@@ -16,7 +16,7 @@ module Nurego
16
16
  end
17
17
 
18
18
  def entitlements(feature_id = nil)
19
- Entitlement.all(id, {:feature_id => feature_id, :external_ids => 'false' }, @api_key)
19
+ Entitlement.all_by_organization(id, {:feature_id => feature_id}, @api_key)
20
20
  end
21
21
 
22
22
  def subscriptions(params = {}, api_key = nil)
@@ -17,7 +17,7 @@ module Nurego
17
17
  if values.length > 0
18
18
  values.delete(:id)
19
19
 
20
- response, api_key = Nurego.request(:post, url(self.organization_id), @api_key, values)
20
+ response, api_key = Nurego.request(:put, url(self.organization_id), @api_key, values)
21
21
  refresh_from(response, api_key)
22
22
  end
23
23
  self
@@ -56,5 +56,9 @@ module Nurego
56
56
  Util.convert_to_nurego_object(response, api_key)
57
57
  end
58
58
 
59
+ def entitlements(feature_id = nil)
60
+ Entitlement.all(id, {:feature_id => feature_id}, @api_key)
61
+ end
62
+
59
63
  end
60
64
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nurego
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.21
4
+ version: 1.1.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ilia Gilderman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-17 00:00:00.000000000 Z
11
+ date: 2015-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -268,7 +268,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
268
268
  version: '0'
269
269
  requirements: []
270
270
  rubyforge_project:
271
- rubygems_version: 2.4.6
271
+ rubygems_version: 2.4.8
272
272
  signing_key:
273
273
  specification_version: 4
274
274
  summary: Ruby bindings for the Nurego API