electric_profile_ruby 1.13.1 → 1.15.0

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
  SHA256:
3
- metadata.gz: 472ebccb19f6a75888dfa4ecff64f9d604023eb12ff7bd6a219de38f14fda00e
4
- data.tar.gz: 6460ed7e172a3b49e196da78dcc7c7c0a651bfb8c4eb2519b1ba35eb778aac8b
3
+ metadata.gz: 4f76bfba1976d4a4a20b178eed6bc43271c1d48f3d8418a8b0143f817790bec3
4
+ data.tar.gz: 5770f28b073c877b46e48a7f1626ea91872415a7babb63589703a9403825b158
5
5
  SHA512:
6
- metadata.gz: 69bce6ff82e792c0169c7a2c2b898af74188d89dd03e15f4549f94f6bcb5dcb28956a0b8dfea10f896b4d4a305ade07aba9a00827322f2c5ef25136d4510495d
7
- data.tar.gz: 0ddf58e7a0a0aaddc0e8a0ceebbbb8ab06b0fd9663b730f2d865a57129cb3a82bb23980d734df7b9e4214f97300a13209ce164a8ae45aa8ab9c40fe4d4d74c9c
6
+ metadata.gz: e40a4a95dac511eef1482b01789fec30efcbc4d652c5c7ca20e9a2c5eb70e1fb52e28cc1457a2e6dcdbb561ce1a0e5a12497b8cae14cd67c5738c94915b9c921
7
+ data.tar.gz: 9cdc86999f7f042112958b6f0ae2ca2b3b0e1cd11302861cf514427995e1fe625b18a80e8af75a324e23801427962287a57f0b00707d400559cf605bc5295433
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.6.9
1
+ 2.7.4
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- electric_profile_ruby (1.13.1)
4
+ electric_profile_ruby (1.14.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -46,4 +46,4 @@ DEPENDENCIES
46
46
  webmock
47
47
 
48
48
  BUNDLED WITH
49
- 1.17.2
49
+ 2.1.4
@@ -19,8 +19,15 @@ module ElectricProfile
19
19
  }
20
20
  end
21
21
 
22
- def fetch_questions(page_size = 99999)
23
- uri = URI(@api_url + "question?PageSize=#{page_size}")
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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module ElectricProfile
2
- VERSION = "1.13.1"
2
+ VERSION = "1.15.0"
3
3
  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.13.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: 2021-12-20 00:00:00.000000000 Z
11
+ date: 2023-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -126,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
126
  - !ruby/object:Gem::Version
127
127
  version: '0'
128
128
  requirements: []
129
- rubygems_version: 3.0.3.1
129
+ rubygems_version: 3.1.6
130
130
  signing_key:
131
131
  specification_version: 4
132
132
  summary: Official Ruby SDK for Electric Profile