queue_it 1.1.8 → 2.0.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: c485ac9dd1277900f3ed127d294b5d54afcb27d3d79f80cd7fe54c668079c28f
4
- data.tar.gz: 407a76048056f086591bd4fcd3088acb94f94be010f50937b0a645248258d497
3
+ metadata.gz: f11577e97ce556432a30d08b8ba74a6445bc9b1e5da0a3142f635f446244c3fc
4
+ data.tar.gz: cc3738902c861b0458d22fcdbb3488ffe1175c814e0368c763d6d8e84ec2104e
5
5
  SHA512:
6
- metadata.gz: 26ccccd935d7770cddfc276e3944be5664362969187b1967db1b9a239bedbd7f69e0f44bb021a8d4c40a826262b7545908ff3606eca47b5347184044e433af4b
7
- data.tar.gz: 54df44820c6b12d1a9469f4187f8204dee202f898cf47ef60935aee262ad09fba40cb58937d65f27d6ffe92108adb6ea8371c0d2e5ce05249ee98b852df496d6
6
+ metadata.gz: e55018d02461c0dde121202e00fa9417c293422bb4fb937c94ecb669b6ecfcb7eccd7432660883c1c629e92b45b7a0d0de947fec9837ac9e1e3995526351d327
7
+ data.tar.gz: 4ddf7fd7661186ba14ce8d2cfc2179b9627e1249cf7cbedc675ca32fac2c58b76e808ebc2f6d476ac41fc87a624f49cc66a493327068cd7ec064463cb1031d29
@@ -1,3 +1,9 @@
1
+ ### 2.0.0 - 2020-10-29
2
+
3
+ * A customer ID is needed to create a client instance
4
+ * Always include the Customer ID in the API request URL
5
+ * Bump webmock to properly handle Ruby 2.4+
6
+
1
7
  ### 1.1.6 - 2017-03-15
2
8
 
3
9
  * Now by default, during creation event, we support using redirect urls
data/README.md CHANGED
@@ -80,7 +80,7 @@ end
80
80
  Initialize client to pass it as a dependency to `Event` instance.
81
81
 
82
82
  ``` ruby
83
- client = QueueIt::Api::Client.new(api_key: "SECRET_API_KEY")
83
+ client = QueueIt::Api::Client.new("YOUR_CUSTOMER_ID", api_key: "SECRET_API_KEY")
84
84
  ```
85
85
 
86
86
  #### Event
@@ -8,11 +8,12 @@ module QueueIt
8
8
  module Api
9
9
  class Client
10
10
  JSON_FORMAT = "application/json".freeze
11
- ENDPOINT_URL = URI("https://api2.queue-it.net/2_0/event").freeze
12
11
 
13
- def initialize(api_key: nil, debug: false)
12
+ def initialize(customer_id, api_key: nil, debug: false)
13
+ self.customer_id = customer_id
14
14
  self.api_key = api_key
15
15
  self.debug = debug
16
+ self.endpoint = URI("https://#{customer_id}.api2.queue-it.net/2_0/event")
16
17
  end
17
18
 
18
19
  def put(path, body)
@@ -21,11 +22,11 @@ module QueueIt
21
22
 
22
23
  private
23
24
 
24
- attr_accessor :api_key, :debug
25
+ attr_accessor :api_key, :customer_id, :debug, :endpoint
25
26
 
26
27
  def options
27
28
  {
28
- url: ENDPOINT_URL.dup,
29
+ url: endpoint.dup,
29
30
  headers: {
30
31
  accept: JSON_FORMAT,
31
32
  content_type: JSON_FORMAT,
@@ -1,3 +1,3 @@
1
1
  module QueueIt
2
- VERSION = "1.1.8"
2
+ VERSION = "2.0.0"
3
3
  end
@@ -24,5 +24,5 @@ Gem::Specification.new do |spec|
24
24
 
25
25
  spec.add_development_dependency "bundler", "~> 1.3"
26
26
  spec.add_development_dependency "rspec", "~> 3.2"
27
- spec.add_development_dependency "webmock", "~> 1.21"
27
+ spec.add_development_dependency "webmock", "~> 3.3"
28
28
  end
@@ -5,7 +5,7 @@ require 'queue_it/api/client'
5
5
  module QueueIt
6
6
  module Api
7
7
  describe Client do
8
- subject(:client) { described_class.new(api_key: "SECURE_KEY") }
8
+ subject(:client) { Client.new("customerid", api_key: "SECURE_KEY") }
9
9
 
10
10
  specify "PUT data under given endpoint & path in JSON format" do
11
11
  request_hash = { "Request" => true }
@@ -71,7 +71,7 @@ module QueueIt
71
71
  end
72
72
 
73
73
  specify "debugging mode puts to STDOUT" do
74
- client = Client.new(api_key: "SECURE_KEY", debug: true)
74
+ client = Client.new("customerid", api_key: "SECURE_KEY", debug: true)
75
75
 
76
76
  request_hash = { "Request" => true }
77
77
 
@@ -83,7 +83,7 @@ module QueueIt
83
83
  private
84
84
 
85
85
  def endpoint_url
86
- Client::ENDPOINT_URL.to_s + "/fancy_event"
86
+ "https://customerid.api2.queue-it.net/2_0/event/fancy_event"
87
87
  end
88
88
 
89
89
  def stub_request_factory(method: :put, status: 200, request_body: "{}", response_body: "{}", content_type: "application/json")
@@ -108,12 +108,12 @@ module QueueIt
108
108
  end
109
109
 
110
110
  specify "Request hits proper endpoint" do
111
- client = Client.new(api_key: "SECURE_KEY")
111
+ client = Client.new("customerid", api_key: "SECURE_KEY")
112
112
  event_adapter = Event.new(client)
113
113
 
114
114
  body = JSON.generate(valid_create_body)
115
115
 
116
- stub = stub_request(:put, "https://api2.queue-it.net/2_0/event/fancyevent")
116
+ stub = stub_request(:put, "https://customerid.api2.queue-it.net/2_0/event/fancyevent")
117
117
  .with(body: body, headers: headers)
118
118
 
119
119
  event_adapter.create_or_update(event_id: event_id,
@@ -165,13 +165,13 @@ module QueueIt
165
165
  end
166
166
 
167
167
  context "#set_speed" do
168
- let(:client) { Client.new(api_key: "SECURE_KEY") }
168
+ let(:client) { Client.new("customerid", api_key: "SECURE_KEY") }
169
169
  let(:max_redirects_per_minute) { 15 }
170
170
 
171
171
  specify "Proper speed value is set" do
172
172
  body = { "MaxRedirectsPerMinute" => "15" }
173
173
 
174
- stub = stub_request(:put, "https://api2.queue-it.net/2_0/event/fancyevent/queue/speed")
174
+ stub = stub_request(:put, "https://customerid.api2.queue-it.net/2_0/event/fancyevent/queue/speed")
175
175
  .with(body: body, headers: headers)
176
176
 
177
177
  event_adapter.set_speed(event_id: event_id, max_redirects_per_minute: max_redirects_per_minute)
@@ -182,7 +182,7 @@ module QueueIt
182
182
  specify "Speed must be greater than 5 so we send at least 5" do
183
183
  expected_body = { "MaxRedirectsPerMinute" => "5" }
184
184
 
185
- stub = stub_request(:put, "https://api2.queue-it.net/2_0/event/fancyevent/queue/speed")
185
+ stub = stub_request(:put, "https://customerid.api2.queue-it.net/2_0/event/fancyevent/queue/speed")
186
186
  .with(body: expected_body, headers: headers)
187
187
 
188
188
  event_adapter.set_speed(event_id: event_id, max_redirects_per_minute: 1)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: queue_it
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.8
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Billetto
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-23 00:00:00.000000000 Z
11
+ date: 2020-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -98,14 +98,14 @@ dependencies:
98
98
  requirements:
99
99
  - - "~>"
100
100
  - !ruby/object:Gem::Version
101
- version: '1.21'
101
+ version: '3.3'
102
102
  type: :development
103
103
  prerelease: false
104
104
  version_requirements: !ruby/object:Gem::Requirement
105
105
  requirements:
106
106
  - - "~>"
107
107
  - !ruby/object:Gem::Version
108
- version: '1.21'
108
+ version: '3.3'
109
109
  description: Gem to handle the implementation of http://queue-it.net!
110
110
  email:
111
111
  - development@billetto.dk
@@ -139,7 +139,7 @@ homepage: https://github.com/gfish/queue_it
139
139
  licenses:
140
140
  - GNU/GPLv3
141
141
  metadata: {}
142
- post_install_message:
142
+ post_install_message:
143
143
  rdoc_options: []
144
144
  require_paths:
145
145
  - lib
@@ -155,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
155
155
  version: '0'
156
156
  requirements: []
157
157
  rubygems_version: 3.0.3
158
- signing_key:
158
+ signing_key:
159
159
  specification_version: 4
160
160
  summary: Gem to handle the implementation of http://queue-it.net
161
161
  test_files: