Skip to content

Commit 10efc94

Browse files
authored
Merge pull request #197 from EasyPost/v7-ruby-docs
feat: v7 ruby docs
2 parents 886bfc5 + f7c4303 commit 10efc94

File tree

121 files changed

+1383
-25
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+1383
-25
lines changed

Gemfile.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ PATH
22
remote: .
33
specs:
44
examples (0.1.0)
5-
easypost (~> 6)
5+
easypost (~> 7)
66

77
GEM
88
remote: https://rubygems.org/
99
specs:
1010
ast (2.4.2)
11-
easypost (6.4.1)
11+
easypost (7.0.0)
1212
json (2.10.2)
1313
language_server-protocol (3.17.0.4)
1414
lint_roller (1.1.0)
@@ -62,4 +62,4 @@ DEPENDENCIES
6262
rubocop-rspec (~> 2.31)
6363

6464
BUNDLED WITH
65-
2.5.11
65+
2.6.8

examples.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
1111
spec.homepage = 'https://github.com/easypost/examples'
1212
spec.license = 'MIT'
1313

14-
spec.add_dependency 'easypost', '~> 6'
14+
spec.add_dependency 'easypost', '~> 7'
1515

1616
spec.add_development_dependency 'rubocop', '= 1.73'
1717
spec.add_development_dependency 'rubocop-rspec', '~> 2.31' # Can't upgrade to v3 until we drop Ruby 2.7
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
require 'easypost'
2+
3+
client = EasyPost::Client.new(api_key: 'EASYPOST_API_KEY')
4+
5+
payment_method = client.referral_customer.add_bank_account_from_stripe(
6+
'REFERRAL_USER_API_KEY',
7+
'fca_...',
8+
{
9+
ip_address: '127.0.0.1',
10+
user_agent: 'Mozilla/5.0',
11+
accepted_at: 172_251_073,
12+
},
13+
'primary',
14+
)
15+
16+
puts payment_method
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
require 'easypost'
2+
3+
client = EasyPost::Client.new(api_key: 'EASYPOST_API_KEY')
4+
5+
payment_method = client.referral_customer.add_credit_card_from_stripe(
6+
'REFERRAL_USER_API_KEY',
7+
'seti_...',
8+
'primary',
9+
)
10+
11+
puts payment_method
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
require 'easypost'
2+
3+
client = EasyPost::Client.new(api_key: 'EASYPOST_API_KEY')
4+
5+
response = client.beta_referral_customer.create_bank_account_client_secret
6+
7+
puts response
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
require 'easypost'
2+
3+
client = EasyPost::Client.new(api_key: 'EASYPOST_API_KEY')
4+
5+
response = client.beta_referral_customer.create_credit_card_client_secret
6+
7+
puts response

official/docs/ruby/current/endshipper/update.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
end_shipper = client.end_shipper.update(
66
'es_...',
77
{
8-
'name' => 'New Name',
9-
'street1' => '388 Townsend St',
10-
'street2' => 'Apt 20',
11-
'city' => 'San Francisco',
12-
'state' => 'CA',
13-
'zip' => '94107',
14-
'country' => 'US',
15-
'email' => 'test@example.com',
16-
'phone' => '5555555555',
8+
name: 'New Name',
9+
street1: '388 Townsend St',
10+
street2: 'Apt 20',
11+
city: 'San Francisco',
12+
state: 'CA',
13+
zip: '94107',
14+
country: 'US',
15+
email: 'test@example.com',
16+
phone: '5555555555',
1717
},
1818
)
1919

official/docs/ruby/current/webhooks/create.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
webhook = client.webhook.create(
66
url: 'example.com',
77
webhook_secret: 'A1B2C3',
8+
custom_headers: {
9+
'X-Header-Name' => 'header_value',
10+
},
811
)
912

1013
puts webhook

official/docs/ruby/current/webhooks/update.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
client = EasyPost::Client.new(api_key: 'EASYPOST_API_KEY')
44

5-
webhook = client.webhook.update('hook_...')
5+
webhook = client.webhook.update(
6+
'hook_...', {
7+
webhook_secret: 'A1B2C3',
8+
custom_headers: {
9+
'X-Header-Name' => 'header_value',
10+
},
11+
},
12+
)
613

714
puts webhook

official/docs/ruby/v5/endshipper/update.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
retrieved_endshipper = client.end_shipper.retrieve('es_...')
66

77
update_data = {
8-
'name' => 'New Name',
9-
'street1' => '388 Townsend St',
10-
'street2' => 'Apt 20',
11-
'city' => 'San Francisco',
12-
'state' => 'CA',
13-
'zip' => '94107',
14-
'country' => 'US',
15-
'email' => 'test@example.com',
16-
'phone' => '5555555555',
8+
name: 'New Name',
9+
street1: '388 Townsend St',
10+
street2: 'Apt 20',
11+
city: 'San Francisco',
12+
state: 'CA',
13+
zip: '94107',
14+
country: 'US',
15+
email: 'test@example.com',
16+
phone: '5555555555',
1717
}
1818

1919
end_shipper = client.end_shipper.update(retrieved_endshipper.id, update_data)

0 commit comments

Comments
 (0)