spackle-ruby 0.0.5 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/README.md +4 -0
- data/lib/spackle/stores/dynamodb.rb +12 -30
- data/spackle.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88a684f832fdbd25801c0548a9c11e3a9e2fedac9e24e967630c216b9baf8fb8
|
4
|
+
data.tar.gz: 01a3950d81410f73dad15fbf329b0beb49ff09aba9a12a9a2bf56e32d10f700f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23ad5d82c45799cbdfe4946f667185f320023eaed31722cfa9f5216f0a4b151a0208441c34b6d1a99c0c7bc09a88a228d6bd1e926ae39794d2f76d2a672e6376
|
7
|
+
data.tar.gz: 39d199e6944eee7b5d2e30e53a7aee0cc2876b998786f6ba83310d66c26ca8dc2534084e44457f9d72e97ab7d40e2b98cce0da093e2f1e54d8aab4f49985c2c5
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -115,10 +115,12 @@ In production, Spackle requires a valid Stripe customer. However, that is not de
|
|
115
115
|
"cus_000000000": {
|
116
116
|
"features": [
|
117
117
|
{
|
118
|
+
"type": 0,
|
118
119
|
"key": "flag_feature",
|
119
120
|
"value_flag": true
|
120
121
|
},
|
121
122
|
{
|
123
|
+
"type": 1,
|
122
124
|
"key": "limit_feature",
|
123
125
|
"value_limit": 100
|
124
126
|
}
|
@@ -149,10 +151,12 @@ Spackle.store = Spackle::MemoryStore.new()
|
|
149
151
|
Spackle.store.set_customer_data("cus_000000000", {
|
150
152
|
"features": [
|
151
153
|
{
|
154
|
+
"type": 0,
|
152
155
|
"key": "flag_feature",
|
153
156
|
"value_flag": True,
|
154
157
|
},
|
155
158
|
{
|
159
|
+
"type": 1,
|
156
160
|
"key": "limit_feature",
|
157
161
|
"value_limit": 100,
|
158
162
|
},
|
@@ -14,45 +14,27 @@ module Spackle
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def get_customer_data(id)
|
17
|
-
|
18
|
-
key_condition_expression: 'CustomerId = :customer_id',
|
19
|
-
filter_expression: 'Version = :version',
|
20
|
-
expression_attribute_values: {
|
21
|
-
':customer_id' => id,
|
22
|
-
':version' => Spackle.version
|
23
|
-
},
|
24
|
-
limit: 1
|
25
|
-
})
|
17
|
+
result = get_item(id)
|
26
18
|
|
27
|
-
if
|
19
|
+
if result.nil? or result.item.nil?
|
28
20
|
raise SpackleError.new "Customer #{id} not found"
|
29
21
|
end
|
30
22
|
|
31
|
-
JSON.parse(
|
23
|
+
JSON.parse(result.item['State'])
|
32
24
|
end
|
33
25
|
|
34
26
|
private
|
35
27
|
|
36
|
-
def get_item(
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
key: key
|
44
|
-
})
|
45
|
-
|
46
|
-
JSON.parse(response.item['State'])
|
47
|
-
end
|
48
|
-
|
49
|
-
def query(query)
|
50
|
-
query[:table_name] = @store_config['table_name']
|
51
|
-
query[:key_condition_expression] = 'AccountId = :account_id AND ' + query[:key_condition_expression]
|
52
|
-
query[:expression_attribute_values] = query[:expression_attribute_values].merge({
|
53
|
-
':account_id' => @store_config['identity_id']
|
28
|
+
def get_item(id)
|
29
|
+
return @client.get_item({
|
30
|
+
table_name: @store_config['table_name'],
|
31
|
+
key: {
|
32
|
+
AccountId: @store_config['identity_id'],
|
33
|
+
CustomerId: "#{id}:#{Spackle.version}"
|
34
|
+
}
|
54
35
|
})
|
55
|
-
|
36
|
+
rescue StandardError
|
37
|
+
return nil
|
56
38
|
end
|
57
39
|
|
58
40
|
def bootstrap_client
|
data/spackle.gemspec
CHANGED
@@ -2,7 +2,7 @@ $LOAD_PATH.unshift(::File.join(::File.dirname(__FILE__), "lib"))
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "spackle-ruby"
|
5
|
-
s.version = "0.0.
|
5
|
+
s.version = "0.0.7"
|
6
6
|
s.summary = "Spackle Ruby gem"
|
7
7
|
s.description = "Spackle is the easiest way to integrate your Ruby app with Stripe Billing. " \
|
8
8
|
"See https://www.spackle.so for details."
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spackle-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Spackle
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Spackle is the easiest way to integrate your Ruby app with Stripe Billing.
|
14
14
|
See https://www.spackle.so for details.
|