cashbox 0.0.26 → 0.0.27
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 +4 -4
- data/Gemfile.lock +2 -2
- data/lib/cashbox/model/subscription.rb +24 -0
- data/lib/cashbox/model/subscription_item.rb +1 -0
- data/lib/cashbox/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 951b6470d72ad4abe9306debd04191c96a5fdce6
|
4
|
+
data.tar.gz: 2ca18f3331caa284dbff6d33420bd4013b013ac0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d79edaef2d834998bb5a76ba009722025503c8d87ac55b58244c76e11dbb219a5942dfbab373bdac22b3eec59150057130922130ff385485ae652e0a81b286a
|
7
|
+
data.tar.gz: 0fd97e7518ede85287def2704c843ac94b2c03079e22f9e7cba795a31933a3eea51868190b1bdf0e9196640bf6fd8df023da053c1959b7a36996e7fcb80db2b0
|
data/Gemfile.lock
CHANGED
@@ -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
|
data/lib/cashbox/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2018-10-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|