Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License

Copyright (c) 2017 RentShare (http://rentshare.com)
Copyright (c) 2024 Payload (http://payload.com)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Payload RubyGem

A RubyGem for integrating [Payload](https://payload.co).
A RubyGem for integrating [Payload](https://payload.com).

## Installation

Expand Down Expand Up @@ -91,4 +91,4 @@ customers = Payload::Customer.filter_by(
## Documentation

To get further information on Payload's RubyGem and API capabilities,
visit the unabridged [Payload Documentation](https://docs.payload.co/?ruby).
visit the unabridged [Payload Documentation](https://docs.payload.com/?ruby).
2 changes: 1 addition & 1 deletion lib/payload.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require "payload/arm/session"

module Payload
@URL = "https://api.payload.co"
@URL = "https://api.payload.com"

class << self
def api_key=(value)
Expand Down
2 changes: 1 addition & 1 deletion lib/payload/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Payload
VERSION = '0.3.4'
VERSION = '0.3.5'
end
4 changes: 2 additions & 2 deletions payload.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ Gem::Specification.new do |spec|
spec.version = Payload::VERSION
spec.required_ruby_version = ">= 2.0.0"
spec.summary = "Payload ruby library"
spec.description = "A simple library to interface with the Payload API. See https://docs.payload.co for details."
spec.description = "A simple library to interface with the Payload API. See https://docs.payload.com for details."
spec.author = "Payload"
spec.email = "help@payload.co"
spec.homepage = "https://docs.payload.co"
spec.homepage = "https://docs.payload.com"
spec.license = "MIT"

spec.files = `git ls-files`.split("\n")
Expand Down
34 changes: 17 additions & 17 deletions spec/payload/arm/request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

expect(instance).to receive(:_execute_request) do |http, request|
expect(request.method).to eq("GET")
expect(http.address).to eq("api.payload.co")
expect(http.address).to eq("api.payload.com")
expect(Base64.decode64(request['authorization'].split(' ')[1]).split(':')[0]).to eq('test_key')
expect(request.path).to eq("/customers?fields=name%2Cage")

Expand Down Expand Up @@ -81,7 +81,7 @@ class TestObject < Payload::ARMObject

expect(instance).to receive(:_execute_request) do |http, request|
expect(request.method).to eq("GET")
expect(http.address).to eq("api.payload.co")
expect(http.address).to eq("api.payload.com")
expect(Base64.decode64(request['authorization'].split(' ')[1]).split(':')[0]).to eq('test_key')
expect(request.path).to eq("/customers?name=John&age=30")

Expand Down Expand Up @@ -144,7 +144,7 @@ class TestObject < Payload::ARMObject

expect(instance).to receive(:_execute_request) do |http, request|
expect(request.method).to eq("POST")
expect(http.address).to eq("api.payload.co")
expect(http.address).to eq("api.payload.com")
expect(Base64.decode64(request['authorization'].split(' ')[1]).split(':')[0]).to eq('test_key')
expect(request.path).to eq("/customers?")
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\"}")
Expand Down Expand Up @@ -198,7 +198,7 @@ def body

expect(instance).to receive(:_execute_request) do |http, request|
expect(request.method).to eq("POST")
expect(http.address).to eq("api.payload.co")
expect(http.address).to eq("api.payload.com")
expect(Base64.decode64(request['authorization'].split(' ')[1]).split(':')[0]).to eq('test_key')
expect(request.path).to eq("/customers?")
expect(request.body).to eq("{\"object\":\"list\",\"values\":[{\"name\":\"John\",\"age\":30},{\"name\":\"Alice\",\"age\":25},{\"name\":\"Bob\",\"age\":35}]}")
Expand Down Expand Up @@ -255,7 +255,7 @@ def body

expect(instance).to receive(:_execute_request) do |http, request|
expect(request.method).to eq("POST")
expect(http.address).to eq("api.payload.co")
expect(http.address).to eq("api.payload.com")
expect(Base64.decode64(request['authorization'].split(' ')[1]).split(':')[0]).to eq('test_key')
expect(request.path).to eq("/customers?")
expect(request.body).to eq("{\"object\":\"list\",\"values\":[{\"name\":\"John\",\"age\":30},{\"name\":\"Alice\",\"age\":25},{\"name\":\"Bob\",\"age\":35}]}")
Expand Down Expand Up @@ -316,7 +316,7 @@ def body

expect(instance).to receive(:_execute_request) do |http, request|
expect(request.method).to eq("GET")
expect(http.address).to eq("api.payload.co")
expect(http.address).to eq("api.payload.com")
expect(Base64.decode64(request['authorization'].split(' ')[1]).split(':')[0]).to eq('test_key')
expect(request.path).to eq("/customers/" + $test_id + "?")

Expand Down Expand Up @@ -362,7 +362,7 @@ def body

expect_any_instance_of(Payload::ARMRequest).to receive(:_execute_request) do |inst, http, request|
expect(request.method).to eq("PUT")
expect(http.address).to eq("api.payload.co")
expect(http.address).to eq("api.payload.com")
expect(Base64.decode64(request['authorization'].split(' ')[1]).split(':')[0]).to eq('test_key')
expect(request.path).to eq("/customers/" + $test_id + "?")
expect(request.body).to eq("{\"name\":\"John\",\"age\":30}")
Expand Down Expand Up @@ -400,14 +400,14 @@ def body
$test_id = 'acct_' + rand(9000000...9999999).to_s

Payload::api_key = 'test_key'
instance = Payload::Session.new('session_key', 'https://sandbox.payload.co')
instance = Payload::Session.new('session_key', 'https://sandbox.payload.com')

cust = Payload::Customer.new({id: $test_id})
cust.set_session(instance)

expect_any_instance_of(Payload::ARMRequest).to receive(:_execute_request) do |inst, http, request|
expect(request.method).to eq("PUT")
expect(http.address).to eq("sandbox.payload.co")
expect(http.address).to eq("sandbox.payload.com")
expect(Base64.decode64(request['authorization'].split(' ')[1]).split(':')[0]).to eq('session_key')
expect(request.path).to eq("/customers/" + $test_id + "?")
expect(request.body).to eq("{\"name\":\"John\",\"age\":30}")
Expand Down Expand Up @@ -448,7 +448,7 @@ def body

expect_any_instance_of(Payload::ARMRequest).to receive(:_execute_request) do |inst, http, request|
expect(request.method).to eq("PUT")
expect(http.address).to eq("api.payload.co")
expect(http.address).to eq("api.payload.com")
expect(Base64.decode64(request['authorization'].split(' ')[1]).split(':')[0]).to eq('test_key')
expect(request.path).to eq("/customers?")
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 + "\"}]}")
Expand Down Expand Up @@ -509,7 +509,7 @@ def body

expect_any_instance_of(Payload::ARMRequest).to receive(:_execute_request) do |inst, http, request|
expect(request.method).to eq("PUT")
expect(http.address).to eq("api.payload.co")
expect(http.address).to eq("api.payload.com")
expect(Base64.decode64(request['authorization'].split(' ')[1]).split(':')[0]).to eq('test_key')
expect(request.path).to eq("/customers?name=John+Smith&mode=query")
expect(request.body).to eq("{\"name\":\"John\",\"age\":30}")
Expand Down Expand Up @@ -562,7 +562,7 @@ def body

expect_any_instance_of(Payload::ARMRequest).to receive(:_execute_request) do |inst, http, request|
expect(request.method).to eq("DELETE")
expect(http.address).to eq("api.payload.co")
expect(http.address).to eq("api.payload.com")
expect(Base64.decode64(request['authorization'].split(' ')[1]).split(':')[0]).to eq('test_key')
expect(request.path).to eq("/customers/" + $test_id + "?")
expect(request.body).to eq(nil)
Expand Down Expand Up @@ -600,14 +600,14 @@ def body
$test_id = 'acct_' + rand(9000000...9999999).to_s

Payload::api_key = 'test_key'
instance = Payload::Session.new('session_key', 'https://sandbox.payload.co')
instance = Payload::Session.new('session_key', 'https://sandbox.payload.com')

cust = Payload::Customer.new({id: $test_id})
cust.set_session(instance)

expect_any_instance_of(Payload::ARMRequest).to receive(:_execute_request) do |inst, http, request|
expect(request.method).to eq("DELETE")
expect(http.address).to eq("sandbox.payload.co")
expect(http.address).to eq("sandbox.payload.com")
expect(Base64.decode64(request['authorization'].split(' ')[1]).split(':')[0]).to eq('session_key')
expect(request.path).to eq("/customers/" + $test_id + "?")
expect(request.body).to eq(nil)
Expand Down Expand Up @@ -648,7 +648,7 @@ def body

expect_any_instance_of(Payload::ARMRequest).to receive(:_execute_request) do |inst, http, request|
expect(request.method).to eq("DELETE")
expect(http.address).to eq("api.payload.co")
expect(http.address).to eq("api.payload.com")
expect(Base64.decode64(request['authorization'].split(' ')[1]).split(':')[0]).to eq('test_key')
expect(request.path).to eq("/customers?")
expect(request.body).to eq("{\"object\":\"list\",\"values\":[{\"id\":\"" + $test_id_a + "\"},{\"id\":\"" + $test_id_b + "\"},{\"id\":\"" + $test_id_c + "\"}]}")
Expand Down Expand Up @@ -711,7 +711,7 @@ def body

expect_any_instance_of(Payload::ARMRequest).to receive(:_execute_request) do |inst, http, request|
expect(request.method).to eq("DELETE")
expect(http.address).to eq("api.payload.co")
expect(http.address).to eq("api.payload.com")
expect(Base64.decode64(request['authorization'].split(' ')[1]).split(':')[0]).to eq('test_key')
expect(request.path).to eq("/customers?name=John+Smith&mode=query")
expect(request.body).to eq(nil)
Expand Down Expand Up @@ -759,4 +759,4 @@ def body
end
end
end
end
end
12 changes: 6 additions & 6 deletions spec/payload/arm/session_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

it "sets the api key and uses default url" do
expect(instance1.api_key).to eq('test_key')
expect(instance1.api_url).to eq('https://api.payload.co')
expect(instance1.api_url).to eq('https://api.payload.com')
end
end

Expand All @@ -32,7 +32,7 @@
$test_id = 'acct_' + rand(9000000...9999999).to_s

Payload::api_key = 'test_key'
instance = Payload::Session.new('session_key', 'https://sandbox.payload.co')
instance = Payload::Session.new('session_key', 'https://sandbox.payload.com')

arm_request = instance.query(Payload::Customer)

Expand All @@ -41,7 +41,7 @@

expect(arm_request).to receive(:_execute_request) do |http, request|
expect(request.method).to eq("GET")
expect(http.address).to eq("sandbox.payload.co")
expect(http.address).to eq("sandbox.payload.com")
expect(Base64.decode64(request['authorization'].split(' ')[1]).split(':')[0]).to eq('session_key')
expect(request.path).to eq("/customers?fields=name%2Cage")

Expand Down Expand Up @@ -88,7 +88,7 @@ def body

it "builds the appropriate ARMRequest" do
Payload::api_key = 'test_key'
instance = Payload::Session.new('session_key', 'https://sandbox.payload.co')
instance = Payload::Session.new('session_key', 'https://sandbox.payload.com')

cust = Payload::Customer.new({})

Expand All @@ -108,7 +108,7 @@ def body

it "builds the appropriate ARMRequest" do
Payload::api_key = 'test_key'
instance = Payload::Session.new('session_key', 'https://sandbox.payload.co')
instance = Payload::Session.new('session_key', 'https://sandbox.payload.com')

cust = Payload::Customer.new({})

Expand All @@ -128,7 +128,7 @@ def body

it "builds the appropriate ARMRequest" do
Payload::api_key = 'test_key'
instance = Payload::Session.new('session_key', 'https://sandbox.payload.co')
instance = Payload::Session.new('session_key', 'https://sandbox.payload.com')

cust = Payload::Customer.new({})

Expand Down