payload-api 0.3.4 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/README.md +2 -2
- data/lib/payload/version.rb +1 -1
- data/lib/payload.rb +1 -1
- data/payload.gemspec +2 -2
- data/spec/payload/arm/request_spec.rb +17 -17
- data/spec/payload/arm/session_spec.rb +6 -6
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6bed3adff70e34efe92779759df9927317d76572899140174f026fc0317bf558
|
4
|
+
data.tar.gz: a30f7763d405886d6b2f05ae2ac3e762f0c90b20bc7ee01722d73fe10fee423f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43504c2dd38496043e2c9200cc2d92acc207ad9c39581a1a528ff7c2f469b037c582e7fc1f0c9ae83c4af284bd59e02d7c5c5e946ada48400bfcb1757402ad43
|
7
|
+
data.tar.gz: 3c87796896fce58f76f34acc2f3579c9251d5e13a3860f57c6d5531112507b02a5cf00a8e627c56189272ecfb484f4a95b49dbcf6e0d88755262240155f0fd0f
|
data/LICENSE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License
|
2
2
|
|
3
|
-
Copyright (c)
|
3
|
+
Copyright (c) 2024 Payload (http://payload.com)
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Payload RubyGem
|
2
2
|
|
3
|
-
A RubyGem for integrating [Payload](https://payload.
|
3
|
+
A RubyGem for integrating [Payload](https://payload.com).
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -91,4 +91,4 @@ customers = Payload::Customer.filter_by(
|
|
91
91
|
## Documentation
|
92
92
|
|
93
93
|
To get further information on Payload's RubyGem and API capabilities,
|
94
|
-
visit the unabridged [Payload Documentation](https://docs.payload.
|
94
|
+
visit the unabridged [Payload Documentation](https://docs.payload.com/?ruby).
|
data/lib/payload/version.rb
CHANGED
data/lib/payload.rb
CHANGED
data/payload.gemspec
CHANGED
@@ -8,10 +8,10 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = Payload::VERSION
|
9
9
|
spec.required_ruby_version = ">= 2.0.0"
|
10
10
|
spec.summary = "Payload ruby library"
|
11
|
-
spec.description = "A simple library to interface with the Payload API. See https://docs.payload.
|
11
|
+
spec.description = "A simple library to interface with the Payload API. See https://docs.payload.com for details."
|
12
12
|
spec.author = "Payload"
|
13
13
|
spec.email = "help@payload.co"
|
14
|
-
spec.homepage = "https://docs.payload.
|
14
|
+
spec.homepage = "https://docs.payload.com"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
17
17
|
spec.files = `git ls-files`.split("\n")
|
@@ -26,7 +26,7 @@ RSpec.describe Payload::ARMRequest do
|
|
26
26
|
|
27
27
|
expect(instance).to receive(:_execute_request) do |http, request|
|
28
28
|
expect(request.method).to eq("GET")
|
29
|
-
expect(http.address).to eq("api.payload.
|
29
|
+
expect(http.address).to eq("api.payload.com")
|
30
30
|
expect(Base64.decode64(request['authorization'].split(' ')[1]).split(':')[0]).to eq('test_key')
|
31
31
|
expect(request.path).to eq("/customers?fields=name%2Cage")
|
32
32
|
|
@@ -81,7 +81,7 @@ RSpec.describe Payload::ARMRequest do
|
|
81
81
|
|
82
82
|
expect(instance).to receive(:_execute_request) do |http, request|
|
83
83
|
expect(request.method).to eq("GET")
|
84
|
-
expect(http.address).to eq("api.payload.
|
84
|
+
expect(http.address).to eq("api.payload.com")
|
85
85
|
expect(Base64.decode64(request['authorization'].split(' ')[1]).split(':')[0]).to eq('test_key')
|
86
86
|
expect(request.path).to eq("/customers?name=John&age=30")
|
87
87
|
|
@@ -144,7 +144,7 @@ RSpec.describe Payload::ARMRequest do
|
|
144
144
|
|
145
145
|
expect(instance).to receive(:_execute_request) do |http, request|
|
146
146
|
expect(request.method).to eq("POST")
|
147
|
-
expect(http.address).to eq("api.payload.
|
147
|
+
expect(http.address).to eq("api.payload.com")
|
148
148
|
expect(Base64.decode64(request['authorization'].split(' ')[1]).split(':')[0]).to eq('test_key')
|
149
149
|
expect(request.path).to eq("/customers?")
|
150
150
|
expect(request.body).to eq("{\"type\":\"bill\",\"processing_id\":\"acct_3bz0zU99AX06SJwfMmfn0\",\"due_date\":\"2020-01-01\",\"items\":[{\"entry_type\":\"charge\",\"type\":\"item1\",\"amount\":29.99}],\"customer_id\":\"acct_3bW9JMoGYQul5fCIa9f8q\"}")
|
@@ -198,7 +198,7 @@ RSpec.describe Payload::ARMRequest do
|
|
198
198
|
|
199
199
|
expect(instance).to receive(:_execute_request) do |http, request|
|
200
200
|
expect(request.method).to eq("POST")
|
201
|
-
expect(http.address).to eq("api.payload.
|
201
|
+
expect(http.address).to eq("api.payload.com")
|
202
202
|
expect(Base64.decode64(request['authorization'].split(' ')[1]).split(':')[0]).to eq('test_key')
|
203
203
|
expect(request.path).to eq("/customers?")
|
204
204
|
expect(request.body).to eq("{\"object\":\"list\",\"values\":[{\"name\":\"John\",\"age\":30},{\"name\":\"Alice\",\"age\":25},{\"name\":\"Bob\",\"age\":35}]}")
|
@@ -255,7 +255,7 @@ RSpec.describe Payload::ARMRequest do
|
|
255
255
|
|
256
256
|
expect(instance).to receive(:_execute_request) do |http, request|
|
257
257
|
expect(request.method).to eq("POST")
|
258
|
-
expect(http.address).to eq("api.payload.
|
258
|
+
expect(http.address).to eq("api.payload.com")
|
259
259
|
expect(Base64.decode64(request['authorization'].split(' ')[1]).split(':')[0]).to eq('test_key')
|
260
260
|
expect(request.path).to eq("/customers?")
|
261
261
|
expect(request.body).to eq("{\"object\":\"list\",\"values\":[{\"name\":\"John\",\"age\":30},{\"name\":\"Alice\",\"age\":25},{\"name\":\"Bob\",\"age\":35}]}")
|
@@ -316,7 +316,7 @@ RSpec.describe Payload::ARMRequest do
|
|
316
316
|
|
317
317
|
expect(instance).to receive(:_execute_request) do |http, request|
|
318
318
|
expect(request.method).to eq("GET")
|
319
|
-
expect(http.address).to eq("api.payload.
|
319
|
+
expect(http.address).to eq("api.payload.com")
|
320
320
|
expect(Base64.decode64(request['authorization'].split(' ')[1]).split(':')[0]).to eq('test_key')
|
321
321
|
expect(request.path).to eq("/customers/" + $test_id + "?")
|
322
322
|
|
@@ -362,7 +362,7 @@ RSpec.describe Payload::ARMRequest do
|
|
362
362
|
|
363
363
|
expect_any_instance_of(Payload::ARMRequest).to receive(:_execute_request) do |inst, http, request|
|
364
364
|
expect(request.method).to eq("PUT")
|
365
|
-
expect(http.address).to eq("api.payload.
|
365
|
+
expect(http.address).to eq("api.payload.com")
|
366
366
|
expect(Base64.decode64(request['authorization'].split(' ')[1]).split(':')[0]).to eq('test_key')
|
367
367
|
expect(request.path).to eq("/customers/" + $test_id + "?")
|
368
368
|
expect(request.body).to eq("{\"name\":\"John\",\"age\":30}")
|
@@ -400,14 +400,14 @@ RSpec.describe Payload::ARMRequest do
|
|
400
400
|
$test_id = 'acct_' + rand(9000000...9999999).to_s
|
401
401
|
|
402
402
|
Payload::api_key = 'test_key'
|
403
|
-
instance = Payload::Session.new('session_key', 'https://sandbox.payload.
|
403
|
+
instance = Payload::Session.new('session_key', 'https://sandbox.payload.com')
|
404
404
|
|
405
405
|
cust = Payload::Customer.new({id: $test_id})
|
406
406
|
cust.set_session(instance)
|
407
407
|
|
408
408
|
expect_any_instance_of(Payload::ARMRequest).to receive(:_execute_request) do |inst, http, request|
|
409
409
|
expect(request.method).to eq("PUT")
|
410
|
-
expect(http.address).to eq("sandbox.payload.
|
410
|
+
expect(http.address).to eq("sandbox.payload.com")
|
411
411
|
expect(Base64.decode64(request['authorization'].split(' ')[1]).split(':')[0]).to eq('session_key')
|
412
412
|
expect(request.path).to eq("/customers/" + $test_id + "?")
|
413
413
|
expect(request.body).to eq("{\"name\":\"John\",\"age\":30}")
|
@@ -448,7 +448,7 @@ RSpec.describe Payload::ARMRequest do
|
|
448
448
|
|
449
449
|
expect_any_instance_of(Payload::ARMRequest).to receive(:_execute_request) do |inst, http, request|
|
450
450
|
expect(request.method).to eq("PUT")
|
451
|
-
expect(http.address).to eq("api.payload.
|
451
|
+
expect(http.address).to eq("api.payload.com")
|
452
452
|
expect(Base64.decode64(request['authorization'].split(' ')[1]).split(':')[0]).to eq('test_key')
|
453
453
|
expect(request.path).to eq("/customers?")
|
454
454
|
expect(request.body).to eq("{\"object\":\"list\",\"values\":[{\"name\":\"John\",\"age\":30,\"id\":\"" + $test_id_a + "\"},{\"name\":\"Alice\",\"age\":25,\"id\":\"" + $test_id_b + "\"},{\"name\":\"Bob\",\"age\":35,\"id\":\"" + $test_id_c + "\"}]}")
|
@@ -509,7 +509,7 @@ RSpec.describe Payload::ARMRequest do
|
|
509
509
|
|
510
510
|
expect_any_instance_of(Payload::ARMRequest).to receive(:_execute_request) do |inst, http, request|
|
511
511
|
expect(request.method).to eq("PUT")
|
512
|
-
expect(http.address).to eq("api.payload.
|
512
|
+
expect(http.address).to eq("api.payload.com")
|
513
513
|
expect(Base64.decode64(request['authorization'].split(' ')[1]).split(':')[0]).to eq('test_key')
|
514
514
|
expect(request.path).to eq("/customers?name=John+Smith&mode=query")
|
515
515
|
expect(request.body).to eq("{\"name\":\"John\",\"age\":30}")
|
@@ -562,7 +562,7 @@ RSpec.describe Payload::ARMRequest do
|
|
562
562
|
|
563
563
|
expect_any_instance_of(Payload::ARMRequest).to receive(:_execute_request) do |inst, http, request|
|
564
564
|
expect(request.method).to eq("DELETE")
|
565
|
-
expect(http.address).to eq("api.payload.
|
565
|
+
expect(http.address).to eq("api.payload.com")
|
566
566
|
expect(Base64.decode64(request['authorization'].split(' ')[1]).split(':')[0]).to eq('test_key')
|
567
567
|
expect(request.path).to eq("/customers/" + $test_id + "?")
|
568
568
|
expect(request.body).to eq(nil)
|
@@ -600,14 +600,14 @@ RSpec.describe Payload::ARMRequest do
|
|
600
600
|
$test_id = 'acct_' + rand(9000000...9999999).to_s
|
601
601
|
|
602
602
|
Payload::api_key = 'test_key'
|
603
|
-
instance = Payload::Session.new('session_key', 'https://sandbox.payload.
|
603
|
+
instance = Payload::Session.new('session_key', 'https://sandbox.payload.com')
|
604
604
|
|
605
605
|
cust = Payload::Customer.new({id: $test_id})
|
606
606
|
cust.set_session(instance)
|
607
607
|
|
608
608
|
expect_any_instance_of(Payload::ARMRequest).to receive(:_execute_request) do |inst, http, request|
|
609
609
|
expect(request.method).to eq("DELETE")
|
610
|
-
expect(http.address).to eq("sandbox.payload.
|
610
|
+
expect(http.address).to eq("sandbox.payload.com")
|
611
611
|
expect(Base64.decode64(request['authorization'].split(' ')[1]).split(':')[0]).to eq('session_key')
|
612
612
|
expect(request.path).to eq("/customers/" + $test_id + "?")
|
613
613
|
expect(request.body).to eq(nil)
|
@@ -648,7 +648,7 @@ RSpec.describe Payload::ARMRequest do
|
|
648
648
|
|
649
649
|
expect_any_instance_of(Payload::ARMRequest).to receive(:_execute_request) do |inst, http, request|
|
650
650
|
expect(request.method).to eq("DELETE")
|
651
|
-
expect(http.address).to eq("api.payload.
|
651
|
+
expect(http.address).to eq("api.payload.com")
|
652
652
|
expect(Base64.decode64(request['authorization'].split(' ')[1]).split(':')[0]).to eq('test_key')
|
653
653
|
expect(request.path).to eq("/customers?")
|
654
654
|
expect(request.body).to eq("{\"object\":\"list\",\"values\":[{\"id\":\"" + $test_id_a + "\"},{\"id\":\"" + $test_id_b + "\"},{\"id\":\"" + $test_id_c + "\"}]}")
|
@@ -711,7 +711,7 @@ RSpec.describe Payload::ARMRequest do
|
|
711
711
|
|
712
712
|
expect_any_instance_of(Payload::ARMRequest).to receive(:_execute_request) do |inst, http, request|
|
713
713
|
expect(request.method).to eq("DELETE")
|
714
|
-
expect(http.address).to eq("api.payload.
|
714
|
+
expect(http.address).to eq("api.payload.com")
|
715
715
|
expect(Base64.decode64(request['authorization'].split(' ')[1]).split(':')[0]).to eq('test_key')
|
716
716
|
expect(request.path).to eq("/customers?name=John+Smith&mode=query")
|
717
717
|
expect(request.body).to eq(nil)
|
@@ -759,4 +759,4 @@ RSpec.describe Payload::ARMRequest do
|
|
759
759
|
end
|
760
760
|
end
|
761
761
|
end
|
762
|
-
end
|
762
|
+
end
|
@@ -10,7 +10,7 @@ RSpec.describe Payload::Session do
|
|
10
10
|
|
11
11
|
it "sets the api key and uses default url" do
|
12
12
|
expect(instance1.api_key).to eq('test_key')
|
13
|
-
expect(instance1.api_url).to eq('https://api.payload.
|
13
|
+
expect(instance1.api_url).to eq('https://api.payload.com')
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
@@ -32,7 +32,7 @@ RSpec.describe Payload::Session do
|
|
32
32
|
$test_id = 'acct_' + rand(9000000...9999999).to_s
|
33
33
|
|
34
34
|
Payload::api_key = 'test_key'
|
35
|
-
instance = Payload::Session.new('session_key', 'https://sandbox.payload.
|
35
|
+
instance = Payload::Session.new('session_key', 'https://sandbox.payload.com')
|
36
36
|
|
37
37
|
arm_request = instance.query(Payload::Customer)
|
38
38
|
|
@@ -41,7 +41,7 @@ RSpec.describe Payload::Session do
|
|
41
41
|
|
42
42
|
expect(arm_request).to receive(:_execute_request) do |http, request|
|
43
43
|
expect(request.method).to eq("GET")
|
44
|
-
expect(http.address).to eq("sandbox.payload.
|
44
|
+
expect(http.address).to eq("sandbox.payload.com")
|
45
45
|
expect(Base64.decode64(request['authorization'].split(' ')[1]).split(':')[0]).to eq('session_key')
|
46
46
|
expect(request.path).to eq("/customers?fields=name%2Cage")
|
47
47
|
|
@@ -88,7 +88,7 @@ RSpec.describe Payload::Session do
|
|
88
88
|
|
89
89
|
it "builds the appropriate ARMRequest" do
|
90
90
|
Payload::api_key = 'test_key'
|
91
|
-
instance = Payload::Session.new('session_key', 'https://sandbox.payload.
|
91
|
+
instance = Payload::Session.new('session_key', 'https://sandbox.payload.com')
|
92
92
|
|
93
93
|
cust = Payload::Customer.new({})
|
94
94
|
|
@@ -108,7 +108,7 @@ RSpec.describe Payload::Session do
|
|
108
108
|
|
109
109
|
it "builds the appropriate ARMRequest" do
|
110
110
|
Payload::api_key = 'test_key'
|
111
|
-
instance = Payload::Session.new('session_key', 'https://sandbox.payload.
|
111
|
+
instance = Payload::Session.new('session_key', 'https://sandbox.payload.com')
|
112
112
|
|
113
113
|
cust = Payload::Customer.new({})
|
114
114
|
|
@@ -128,7 +128,7 @@ RSpec.describe Payload::Session do
|
|
128
128
|
|
129
129
|
it "builds the appropriate ARMRequest" do
|
130
130
|
Payload::api_key = 'test_key'
|
131
|
-
instance = Payload::Session.new('session_key', 'https://sandbox.payload.
|
131
|
+
instance = Payload::Session.new('session_key', 'https://sandbox.payload.com')
|
132
132
|
|
133
133
|
cust = Payload::Customer.new({})
|
134
134
|
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: payload-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Payload
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description: A simple library to interface with the Payload API. See https://docs.payload.
|
13
|
+
description: A simple library to interface with the Payload API. See https://docs.payload.com
|
14
14
|
for details.
|
15
15
|
email: help@payload.co
|
16
16
|
executables: []
|
@@ -32,7 +32,7 @@ files:
|
|
32
32
|
- payload.gemspec
|
33
33
|
- spec/payload/arm/request_spec.rb
|
34
34
|
- spec/payload/arm/session_spec.rb
|
35
|
-
homepage: https://docs.payload.
|
35
|
+
homepage: https://docs.payload.com
|
36
36
|
licenses:
|
37
37
|
- MIT
|
38
38
|
metadata: {}
|