electric_profile_ruby 1.13.0 → 1.15.0
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 +5 -5
- data/.ruby-version +1 -1
- data/Gemfile.lock +2 -2
- data/lib/electric_profile_ruby/client.rb +9 -2
- data/lib/electric_profile_ruby/profiler.rb +6 -1
- data/lib/electric_profile_ruby/question.rb +18 -0
- data/lib/electric_profile_ruby/reward.rb +3 -3
- data/lib/electric_profile_ruby/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4f76bfba1976d4a4a20b178eed6bc43271c1d48f3d8418a8b0143f817790bec3
|
4
|
+
data.tar.gz: 5770f28b073c877b46e48a7f1626ea91872415a7babb63589703a9403825b158
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e40a4a95dac511eef1482b01789fec30efcbc4d652c5c7ca20e9a2c5eb70e1fb52e28cc1457a2e6dcdbb561ce1a0e5a12497b8cae14cd67c5738c94915b9c921
|
7
|
+
data.tar.gz: 9cdc86999f7f042112958b6f0ae2ca2b3b0e1cd11302861cf514427995e1fe625b18a80e8af75a324e23801427962287a57f0b00707d400559cf605bc5295433
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.4
|
1
|
+
2.7.4
|
data/Gemfile.lock
CHANGED
@@ -19,8 +19,15 @@ module ElectricProfile
|
|
19
19
|
}
|
20
20
|
end
|
21
21
|
|
22
|
-
def fetch_questions(page_size
|
23
|
-
|
22
|
+
def fetch_questions(page_size: 99999, categoryIncluded: nil, categoryExcluded: nil)
|
23
|
+
path_and_query = "question?PageSize=#{page_size}"
|
24
|
+
if categoryIncluded
|
25
|
+
path_and_query += "&categoryIncluded=#{categoryIncluded}"
|
26
|
+
end
|
27
|
+
if categoryExcluded
|
28
|
+
path_and_query += "&categoryExcluded=#{categoryExcluded}"
|
29
|
+
end
|
30
|
+
uri = URI(@api_url + path_and_query)
|
24
31
|
http_request = Net::HTTP::Get.new uri, @http_headers
|
25
32
|
perform_request(uri, http_request)
|
26
33
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module ElectricProfile
|
2
2
|
|
3
3
|
class Profiler
|
4
|
-
attr_accessor :id, :customerId, :name, :listQuestionsId, :introMessage, :exitMessage, :hideAnsweredQuestions, :questionOrder, :callbackType, :archived, :error
|
4
|
+
attr_accessor :id, :customerId, :name, :listQuestionsId, :introMessage, :exitMessage, :hideAnsweredQuestions, :questionOrder, :callbackType, :profilerCallbacks, :archived, :error
|
5
5
|
|
6
6
|
def initialize(atts)
|
7
7
|
atts = atts.inject({}){ |memo, (k, v) | memo[k.to_sym] = v; memo }
|
@@ -14,6 +14,7 @@ module ElectricProfile
|
|
14
14
|
@hideAnsweredQuestions = atts[:hideAnsweredQuestions] || false
|
15
15
|
@questionOrder = atts[:questionOrder]
|
16
16
|
@callbackType = atts[:callbackType]
|
17
|
+
@profilerCallbacks = atts[:profilerCallbacks]
|
17
18
|
@archived = atts[:archived] || false
|
18
19
|
end
|
19
20
|
|
@@ -35,8 +36,10 @@ module ElectricProfile
|
|
35
36
|
hideAnsweredQuestions: @hideAnsweredQuestions,
|
36
37
|
questionOrder: @questionOrder,
|
37
38
|
callbackType: @callbackType,
|
39
|
+
profilerCallbacks: @profilerCallbacks,
|
38
40
|
archived: @archived
|
39
41
|
}
|
42
|
+
attributes.delete(:profilerCallbacks) if attributes[:profilerCallbacks].nil?
|
40
43
|
if @client.create_profiler(attributes)
|
41
44
|
@id = @client.data["data"]["id"]
|
42
45
|
@customerId = @client.data["data"]["customerId"]
|
@@ -59,8 +62,10 @@ module ElectricProfile
|
|
59
62
|
hideAnsweredQuestions: @hideAnsweredQuestions,
|
60
63
|
questionOrder: @questionOrder,
|
61
64
|
callbackType: @callbackType,
|
65
|
+
profilerCallbacks: @profilerCallbacks,
|
62
66
|
archived: @archived
|
63
67
|
}
|
68
|
+
attributes.delete(:profilerCallbacks) if attributes[:profilerCallbacks].nil?
|
64
69
|
if @client.update_profiler(attributes)
|
65
70
|
true
|
66
71
|
else
|
@@ -103,6 +103,24 @@ module ElectricProfile
|
|
103
103
|
end
|
104
104
|
end
|
105
105
|
|
106
|
+
def self.all_with_category(category)
|
107
|
+
client = Client.new
|
108
|
+
if client.fetch_questions(categoryIncluded: category)
|
109
|
+
client.data["Items"].map { |atts| new atts }
|
110
|
+
else
|
111
|
+
raise StandardError, client.error
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
def self.all_without_category(category)
|
116
|
+
client = Client.new
|
117
|
+
if client.fetch_questions(categoryExcluded: category)
|
118
|
+
client.data["Items"].map { |atts| new atts }
|
119
|
+
else
|
120
|
+
raise StandardError, client.error
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
106
124
|
def initialize_client
|
107
125
|
@client ||= Client.new
|
108
126
|
end
|
@@ -66,9 +66,9 @@ module ElectricProfile
|
|
66
66
|
autoClaim: @autoClaim,
|
67
67
|
autoDeliver: @autoDeliver,
|
68
68
|
delivered: @delivered,
|
69
|
-
deliveryErrors: @deliveryErrors
|
70
|
-
transactionId: @transactionId
|
69
|
+
deliveryErrors: @deliveryErrors
|
71
70
|
}
|
71
|
+
attributes[:transactionId] = @transactionId if @transactionId
|
72
72
|
if @client.update_reward(attributes)
|
73
73
|
true
|
74
74
|
else
|
@@ -90,7 +90,7 @@ module ElectricProfile
|
|
90
90
|
def self.find(id)
|
91
91
|
client = Client.new
|
92
92
|
if client.fetch_reward(id)
|
93
|
-
new client.data
|
93
|
+
new client.data["data"]
|
94
94
|
else
|
95
95
|
raise StandardError, client.error
|
96
96
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: electric_profile_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.15.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Alston
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-06-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -126,8 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
126
|
- !ruby/object:Gem::Version
|
127
127
|
version: '0'
|
128
128
|
requirements: []
|
129
|
-
|
130
|
-
rubygems_version: 2.6.11
|
129
|
+
rubygems_version: 3.1.6
|
131
130
|
signing_key:
|
132
131
|
specification_version: 4
|
133
132
|
summary: Official Ruby SDK for Electric Profile
|