payload-api 0.6.1 → 0.6.2
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/lib/payload/arm/request.rb +4 -0
- data/lib/payload/version.rb +2 -2
- data/spec/payload/arm/request_spec.rb +51 -0
- 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: 3ed53d5dcc3451ce907cbc5a4c28b294abd0c7819a3b1d20505e077378f1bfb5
|
|
4
|
+
data.tar.gz: 27d17e508ae166fce7dbad51d86ffdf6986c6c0a11624e4c4609b1733895ea03
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ca2f23bb36bdb05dfadf24fc931e55986e9f856c393685a5e07540e9325b05fb33eda290dc2cd2c1910e1cc0c312ec9bfc99a7dab598bd6260f8b6a04d2b6e8e
|
|
7
|
+
data.tar.gz: 90166f672175b2cddc3a3b8be0450f028bcc1da8060d519775cce6f462ea08b613f70a6811bfcc69786a0fdfa216d1cd999f964ff36cafe9b69b4ea9632cee0c
|
data/lib/payload/arm/request.rb
CHANGED
data/lib/payload/version.rb
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
module Payload
|
|
2
|
-
VERSION = '0.6.
|
|
3
|
-
end
|
|
2
|
+
VERSION = '0.6.2'
|
|
3
|
+
end
|
|
@@ -299,6 +299,57 @@ RSpec.describe Payload::ARMRequest do
|
|
|
299
299
|
expect(customers[2].session).to eq(instance.instance_variable_get(:@session))
|
|
300
300
|
end
|
|
301
301
|
end
|
|
302
|
+
|
|
303
|
+
context "when the user creates a single ARMObject via Session#create" do
|
|
304
|
+
it "executes the appropriate request and returns the appropriate object" do
|
|
305
|
+
|
|
306
|
+
$test_access_token = 'tok_' + rand(900000..999999).to_s
|
|
307
|
+
$test_refresh_token = 'ref_' + rand(900000..999999).to_s
|
|
308
|
+
|
|
309
|
+
Payload::api_key = 'test_key'
|
|
310
|
+
pl = Payload::Session.new('test_key', 'https://api.payload.com')
|
|
311
|
+
|
|
312
|
+
expect_any_instance_of(Payload::ARMRequest).to receive(:_execute_request) do |_req, http, request|
|
|
313
|
+
expect(request.method).to eq("POST")
|
|
314
|
+
expect(http.address).to eq("api.payload.com")
|
|
315
|
+
expect(Base64.decode64(request['authorization'].split(' ')[1]).split(':')[0]).to eq('test_key')
|
|
316
|
+
expect(request.path).to eq("/oauth/token?")
|
|
317
|
+
expect(request.body).to eq("{\"code\":\"auth_code_123\",\"grant_type\":\"authorization_code\",\"client_id\":\"org_abc\",\"client_secret\":\"secret_key_xyz\"}")
|
|
318
|
+
|
|
319
|
+
class MockResponse
|
|
320
|
+
def initialize
|
|
321
|
+
end
|
|
322
|
+
|
|
323
|
+
def code
|
|
324
|
+
'200'
|
|
325
|
+
end
|
|
326
|
+
|
|
327
|
+
def body
|
|
328
|
+
'{
|
|
329
|
+
"object": "oauth_token",
|
|
330
|
+
"access_token": "' + $test_access_token + '",
|
|
331
|
+
"refresh_token": "' + $test_refresh_token + '"
|
|
332
|
+
}'
|
|
333
|
+
end
|
|
334
|
+
end
|
|
335
|
+
|
|
336
|
+
MockResponse.new
|
|
337
|
+
end
|
|
338
|
+
|
|
339
|
+
oauth_token = pl.create(Payload::OAuthToken.new({
|
|
340
|
+
code: 'auth_code_123',
|
|
341
|
+
grant_type: 'authorization_code',
|
|
342
|
+
client_id: 'org_abc',
|
|
343
|
+
client_secret: 'secret_key_xyz'
|
|
344
|
+
}))
|
|
345
|
+
|
|
346
|
+
expect(oauth_token).to be_a(Payload::OAuthToken)
|
|
347
|
+
expect(oauth_token.object).to eq("oauth_token")
|
|
348
|
+
expect(oauth_token.access_token).to eq($test_access_token)
|
|
349
|
+
expect(oauth_token.refresh_token).to eq($test_refresh_token)
|
|
350
|
+
expect(oauth_token.session).to eq(pl)
|
|
351
|
+
end
|
|
352
|
+
end
|
|
302
353
|
end
|
|
303
354
|
|
|
304
355
|
describe "#get" do
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: payload-api
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.6.
|
|
4
|
+
version: 0.6.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Payload
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-02-
|
|
11
|
+
date: 2026-02-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: A simple library to interface with the Payload API. See https://docs.payload.com
|
|
14
14
|
for details.
|