cashbox 0.0.26 → 0.0.27

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: 8f0879313903596e6629faa4f5607e7b58289106
4
- data.tar.gz: 766a69dd38f48d203e59d337ab0c6427c0fc1a8c
3
+ metadata.gz: 951b6470d72ad4abe9306debd04191c96a5fdce6
4
+ data.tar.gz: 2ca18f3331caa284dbff6d33420bd4013b013ac0
5
5
  SHA512:
6
- metadata.gz: 92cb3dfe241b58bd704f58c04db19d25c8a6ed3769cb33ca70ce94a315ea66a534d7afff83d8849e85e3bafd767f5dcd631a01ce96f329b39eaf04f703c18f15
7
- data.tar.gz: 5ebdd359fc3cf4e7fdc84f13c4b49ca47331bfbca93538b9b459e092230ba6dc25d6c7064c9e6475d1f363b278ae6b65226a72f676106aef896ef8b94eb74b49
6
+ metadata.gz: 2d79edaef2d834998bb5a76ba009722025503c8d87ac55b58244c76e11dbb219a5942dfbab373bdac22b3eec59150057130922130ff385485ae652e0a81b286a
7
+ data.tar.gz: 0fd97e7518ede85287def2704c843ac94b2c03079e22f9e7cba795a31933a3eea51868190b1bdf0e9196640bf6fd8df023da053c1959b7a36996e7fcb80db2b0
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cashbox (0.0.26)
4
+ cashbox (0.0.27)
5
5
  activesupport
6
6
  addressable
7
7
  hashie
@@ -84,4 +84,4 @@ DEPENDENCIES
84
84
  webmock (~> 2.0)
85
85
 
86
86
  BUNDLED WITH
87
- 1.16.5
87
+ 1.16.6
@@ -30,5 +30,29 @@ module Cashbox
30
30
  property :policy
31
31
  property :starts, coerce: Cashbox::Type.DateTime
32
32
  property :status
33
+
34
+ def add_subscription_item(product_to_add)
35
+ subscription_item_to_add = Cashbox::SubscriptionItem.new({
36
+ product: product_to_add
37
+ })
38
+
39
+ items.push(subscription_item_to_add)
40
+ end
41
+
42
+ def remove_subscription_item(product_to_remove)
43
+ index = (items || []).index {|subscription_item| subscription_item.product.id == product_to_remove.id }
44
+ items.delete_at(index) if index
45
+ end
46
+
47
+ def replace_subscription_item(product_to_add, product_to_remove)
48
+ subscription_item_to_remove = remove_subscription_item(product_to_remove)
49
+
50
+ add_subscription_item(product_to_add)
51
+ items.last.replaces = subscription_item_to_remove.product.id if subscription_item_to_remove
52
+ end
53
+
54
+ def update_subscription_items
55
+ Cashbox::Request.new(:post, "#{route(id)}?effective_date=today&bill_prorated_period=true", { body: self.to_json })
56
+ end
33
57
  end
34
58
  end
@@ -5,5 +5,6 @@ module Cashbox
5
5
  property :id
6
6
  property :product, coerce: Cashbox::Product
7
7
  property :index_number, from: :index
8
+ property :replaces
8
9
  end
9
10
  end
@@ -1,3 +1,3 @@
1
1
  module Cashbox
2
- VERSION = "0.0.26"
2
+ VERSION = "0.0.27"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cashbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.26
4
+ version: 0.0.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathon Storer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-26 00:00:00.000000000 Z
11
+ date: 2018-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler