sugester 0.5.4 → 0.6.1
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 +10 -11
- data/lib/sugester.rb +27 -18
- 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: 728781839d8dae0e112e2a907a77eff4e1d0d87b
|
4
|
+
data.tar.gz: b6485b460d00cb1fbefb07a479716d6d5e63022e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61d701b33e1d227f0f7077a95559a72eadf48f3d44f669a0524000831b11106fd8c8cc6371a33a1452a0f3743d89ff6d9ed05ebae6c6e0fec013c2da714ee0f6
|
7
|
+
data.tar.gz: f7f83d603cf0618eb053591ab805de73656973907f8ee7cee1344e866ce3d8bea4cb71d780a58e72e5c638f6c55adf9fa3e554d1839271c1f9804cbea52f237a
|
data/Gemfile.lock
CHANGED
@@ -1,29 +1,28 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
sugester (0.
|
4
|
+
sugester (0.6.1)
|
5
5
|
activesupport
|
6
6
|
aws-sdk (~> 2)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
activesupport (
|
11
|
+
activesupport (5.0.0.1)
|
12
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
12
13
|
i18n (~> 0.7)
|
13
|
-
json (~> 1.7, >= 1.7.7)
|
14
14
|
minitest (~> 5.1)
|
15
|
-
thread_safe (~> 0.3, >= 0.3.4)
|
16
15
|
tzinfo (~> 1.1)
|
17
|
-
aws-sdk (2.
|
18
|
-
aws-sdk-resources (= 2.
|
19
|
-
aws-sdk-core (2.
|
16
|
+
aws-sdk (2.6.1)
|
17
|
+
aws-sdk-resources (= 2.6.1)
|
18
|
+
aws-sdk-core (2.6.1)
|
20
19
|
jmespath (~> 1.0)
|
21
|
-
aws-sdk-resources (2.
|
22
|
-
aws-sdk-core (= 2.
|
20
|
+
aws-sdk-resources (2.6.1)
|
21
|
+
aws-sdk-core (= 2.6.1)
|
22
|
+
concurrent-ruby (1.0.2)
|
23
23
|
diff-lcs (1.2.5)
|
24
24
|
i18n (0.7.0)
|
25
25
|
jmespath (1.3.1)
|
26
|
-
json (1.8.3)
|
27
26
|
minitest (5.9.0)
|
28
27
|
rake (10.5.0)
|
29
28
|
rspec (3.5.0)
|
@@ -54,4 +53,4 @@ DEPENDENCIES
|
|
54
53
|
sugester!
|
55
54
|
|
56
55
|
BUNDLED WITH
|
57
|
-
1.
|
56
|
+
1.13.1
|
data/lib/sugester.rb
CHANGED
@@ -4,7 +4,7 @@ require 'digest'
|
|
4
4
|
|
5
5
|
module Sugester
|
6
6
|
|
7
|
-
VERSION = "0.
|
7
|
+
VERSION = "0.6.1"
|
8
8
|
|
9
9
|
private
|
10
10
|
|
@@ -57,7 +57,7 @@ module Sugester
|
|
57
57
|
|
58
58
|
def push(kind, client_id, msg)
|
59
59
|
Sugester.assert "unknown kind", MSG_KINDS.include?(kind)
|
60
|
-
Sugester.
|
60
|
+
Sugester.assert "client_id cannot be blank", client_id.present?
|
61
61
|
raw_push msg.merge({
|
62
62
|
client_id: client_id,
|
63
63
|
kind: kind,
|
@@ -83,32 +83,41 @@ module Sugester
|
|
83
83
|
MSG_KINDS = [:activity, :property, :payment]
|
84
84
|
public
|
85
85
|
|
86
|
-
def initialize(secret)
|
87
|
-
@
|
88
|
-
|
89
|
-
|
86
|
+
def initialize(secret, enabled: true)
|
87
|
+
@enabled = enabled
|
88
|
+
if @enabled
|
89
|
+
@secret = secret
|
90
|
+
c = config(:config)
|
91
|
+
@sqs = Aws::SQS::Client.new(config(:config)) if c
|
92
|
+
end
|
90
93
|
end
|
91
94
|
|
92
95
|
def activity(client_id, name, options = {})
|
93
|
-
|
94
|
-
|
96
|
+
if @enabled
|
97
|
+
Sugester.instance_assert "name", name, String, Symbol
|
98
|
+
push :activity, client_id, {name: name}
|
99
|
+
end
|
95
100
|
end
|
96
101
|
|
97
102
|
def property(client_id, options)
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
+
if @enabled
|
104
|
+
#options.enum do |name, value|
|
105
|
+
# Sugester.instance_assert "name", name, String, Symbol
|
106
|
+
# Sugester.instance_assert "value", value, String, Symbol, Numeric, Time, DateTime, Date
|
107
|
+
#end
|
108
|
+
push :property, client_id, {options: options}
|
109
|
+
end
|
103
110
|
end
|
104
111
|
|
105
112
|
def payment(client_id, name, price, date_from, date_to)
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
113
|
+
if @enabled
|
114
|
+
Sugester.instance_assert "date_from", date_from, Time, Date, DateTime
|
115
|
+
Sugester.instance_assert "date_to", date_to, Time, Date, DateTime
|
116
|
+
Sugester.instance_assert "price", price, Numeric
|
117
|
+
Sugester.instance_assert "name", name, String, Symbol
|
110
118
|
|
111
|
-
|
119
|
+
push :payment, client_id, {price: price, from: date_from, to: date_to, name: name}
|
120
|
+
end
|
112
121
|
end
|
113
122
|
end
|
114
123
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sugester
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- marcin
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-09-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|