easypost 4.6.0 → 4.7.0
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/.github/workflows/ci.yml +3 -1
- data/.gitignore +1 -0
- data/.gitmodules +3 -0
- data/CHANGELOG.md +5 -0
- data/Makefile +24 -10
- data/README.md +12 -3
- data/VERSION +1 -1
- data/lib/easypost/beta/end_shipper.rb +5 -1
- data/lib/easypost/end_shipper.rb +24 -0
- data/lib/easypost/object.rb +6 -2
- data/lib/easypost/util.rb +2 -2
- data/lib/easypost.rb +1 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e9995cfcc5bc7cce1ebefa6343fc31ba18f6f0f4b36dfb7502225b7abb1b40f8
|
4
|
+
data.tar.gz: 64d814764933ba53e3de2b01f39ba6fd2195a3a65ec4ec6c01b720078750fc42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44179f3818dd5d9098eed96f3263b12a67dd7ec415c49fb9efc976b07b858e63ed326c68b0a07415a62da8311cd5b4e72c406bf6650e197ad69956c674b03d76
|
7
|
+
data.tar.gz: 86007bac46665593dc205c9c231409698401af9b58da3d2d22049c0510b29528303a625c2be2945814ceffd7ee93838049dba5a8a34dcbf3afe3879f583cee80
|
data/.github/workflows/ci.yml
CHANGED
@@ -19,6 +19,8 @@ jobs:
|
|
19
19
|
with:
|
20
20
|
ruby-version: ${{ matrix.rubyversion }}
|
21
21
|
bundler-cache: true
|
22
|
+
- name: Install Dependencies
|
23
|
+
run: make install
|
22
24
|
- name: run tests
|
23
25
|
run: EASYPOST_TEST_API_KEY=123 EASYPOST_PROD_API_KEY=123 make test
|
24
26
|
lint:
|
@@ -35,4 +37,4 @@ jobs:
|
|
35
37
|
- name: Lint Project
|
36
38
|
run: make lint
|
37
39
|
- name: Run security analysis
|
38
|
-
run: make
|
40
|
+
run: make scan
|
data/.gitignore
CHANGED
data/.gitmodules
ADDED
data/CHANGELOG.md
CHANGED
data/Makefile
CHANGED
@@ -2,17 +2,15 @@
|
|
2
2
|
help:
|
3
3
|
@cat Makefile | grep '^## ' --color=never | cut -c4- | sed -e "`printf 's/ - /\t- /;'`" | column -s "`printf '\t'`" -t
|
4
4
|
|
5
|
-
## brakeman - Runs security analysis on the project with Brakeman
|
6
|
-
brakeman:
|
7
|
-
brakeman lib --force
|
8
|
-
|
9
5
|
## build - Builds the project
|
10
6
|
build:
|
11
|
-
gem build easypost.gemspec
|
7
|
+
gem build easypost.gemspec --strict
|
8
|
+
mkdir -p dist
|
9
|
+
mv *.gem dist/
|
12
10
|
|
13
11
|
## clean - Cleans the project
|
14
12
|
clean:
|
15
|
-
rm -rf coverage doc *.gem
|
13
|
+
rm -rf coverage doc *.gem dist
|
16
14
|
|
17
15
|
## fix - Fix Rubocop errors
|
18
16
|
fix:
|
@@ -20,18 +18,34 @@ fix:
|
|
20
18
|
|
21
19
|
## install - Install globally from source
|
22
20
|
install:
|
21
|
+
git submodule init
|
22
|
+
git submodule update
|
23
23
|
bundle install
|
24
24
|
|
25
25
|
## lint - Lint the project
|
26
26
|
lint:
|
27
27
|
rubocop
|
28
28
|
|
29
|
-
##
|
30
|
-
|
31
|
-
gem push
|
29
|
+
## publish - Publishes the built gem to Rubygems
|
30
|
+
publish:
|
31
|
+
gem push dist/*.gem
|
32
|
+
|
33
|
+
## release - Cuts a release for the project on GitHub (requires GitHub CLI)
|
34
|
+
# tag = The associated tag title of the release
|
35
|
+
release:
|
36
|
+
gh release create ${tag} dist/*
|
37
|
+
|
38
|
+
## scan - Runs security analysis on the project with Brakeman
|
39
|
+
scan:
|
40
|
+
brakeman lib --force
|
32
41
|
|
33
42
|
## test - Test the project
|
34
43
|
test:
|
35
44
|
bundle exec rspec
|
36
45
|
|
37
|
-
|
46
|
+
## update - Updates dependencies
|
47
|
+
update:
|
48
|
+
git submodule init
|
49
|
+
git submodule update --remote
|
50
|
+
|
51
|
+
.PHONY: help build clean fix install lint publish release scan test update
|
data/README.md
CHANGED
@@ -121,8 +121,18 @@ make install
|
|
121
121
|
# Lint project
|
122
122
|
make lint
|
123
123
|
|
124
|
+
# Fix linting errors
|
125
|
+
make fix
|
126
|
+
|
124
127
|
# Run tests (coverage is generated on a successful test suite run)
|
125
128
|
EASYPOST_TEST_API_KEY=123... EASYPOST_PROD_API_KEY=123... make test
|
129
|
+
|
130
|
+
# Run security analysis
|
131
|
+
make scan
|
132
|
+
|
133
|
+
# Update submodules
|
134
|
+
git submodule init
|
135
|
+
git submodule update --remote
|
126
136
|
```
|
127
137
|
|
128
138
|
### Testing
|
@@ -142,9 +152,8 @@ The following are required on every test run:
|
|
142
152
|
- `EASYPOST_TEST_API_KEY`
|
143
153
|
- `EASYPOST_PROD_API_KEY`
|
144
154
|
|
145
|
-
The following are required when you need to re-record cassettes for applicable tests
|
155
|
+
Some tests may require an EasyPost user with a particular set of enabled features such as a `Partner` user when creating referrals. We have attempted to call out these functions in their respective docstrings. The following are required when you need to re-record cassettes for applicable tests:
|
146
156
|
|
147
157
|
- `USPS_CARRIER_ACCOUNT_ID` (eg: one-call buying a shipment for non-EasyPost employees)
|
158
|
+
- `PARTNER_USER_PROD_API_KEY` (eg: creating a referral user)
|
148
159
|
- `REFERRAL_USER_PROD_API_KEY` (eg: adding a credit card to a referral user)
|
149
|
-
|
150
|
-
Some tests may require a user with a particular set of enabled features such as a `Partner` user when creating referrals. We have attempted to call out these functions in their respective docstrings.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
4.
|
1
|
+
4.7.0
|
@@ -2,26 +2,30 @@
|
|
2
2
|
|
3
3
|
# EndShipper objects are fully-qualified Address objects that require all parameters and get verified upon creation.
|
4
4
|
class EasyPost::Beta::EndShipper < EasyPost::Resource
|
5
|
-
#
|
5
|
+
# <b>DEPRECATED:</b> Please use <tt>EndShipper</tt> in the main namespace instead.
|
6
6
|
def self.create(params = {}, api_key = nil)
|
7
|
+
warn '[DEPRECATION] Please use `EndShipper.create` in the main namespace instead.'
|
7
8
|
response = EasyPost.make_request(:post, '/beta/end_shippers', api_key, { address: params })
|
8
9
|
EasyPost::Util.convert_to_easypost_object(response, api_key)
|
9
10
|
end
|
10
11
|
|
11
12
|
# Retrieves an EndShipper object.
|
12
13
|
def self.retrieve(id, params = {}, api_key = nil)
|
14
|
+
warn '[DEPRECATION] Please use `EndShipper.retrieve` in the main namespace instead.'
|
13
15
|
response = EasyPost.make_request(:get, "/beta/end_shippers/#{id}", api_key, params)
|
14
16
|
EasyPost::Util.convert_to_easypost_object(response, api_key)
|
15
17
|
end
|
16
18
|
|
17
19
|
# Retrieves a list of EndShipper objects.
|
18
20
|
def self.all(params = {}, api_key = nil)
|
21
|
+
warn '[DEPRECATION] Please use `EndShipper.all` in the main namespace instead.'
|
19
22
|
response = EasyPost.make_request(:get, '/beta/end_shippers', api_key, params)
|
20
23
|
EasyPost::Util.convert_to_easypost_object(response, api_key)
|
21
24
|
end
|
22
25
|
|
23
26
|
# Updates (saves) an EndShipper object. This requires all parameters to be set.
|
24
27
|
def save
|
28
|
+
warn '[DEPRECATION] Please use `endShipper.save` in the main namespace instead.'
|
25
29
|
if @unsaved_values.length.positive?
|
26
30
|
values = {}
|
27
31
|
@unsaved_values.each { |k| values[k] = @values[k] }
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# EndShipper objects are fully-qualified Address objects that require all parameters and get verified upon creation.
|
4
|
+
class EasyPost::EndShipper < EasyPost::Resource
|
5
|
+
# Create an EndShipper object.
|
6
|
+
def self.create(params = {}, api_key = nil)
|
7
|
+
response = EasyPost.make_request(:post, url, api_key, { address: params })
|
8
|
+
EasyPost::Util.convert_to_easypost_object(response, api_key)
|
9
|
+
end
|
10
|
+
|
11
|
+
# Updates (saves) an EndShipper object. This requires all parameters to be set.
|
12
|
+
def save
|
13
|
+
if @unsaved_values.length.positive?
|
14
|
+
values = {}
|
15
|
+
@unsaved_values.each { |k| values[k] = @values[k] }
|
16
|
+
|
17
|
+
wrapped_params = { address: values }
|
18
|
+
|
19
|
+
response = EasyPost.make_request(:put, url, @api_key, wrapped_params)
|
20
|
+
refresh_from(response, api_key)
|
21
|
+
end
|
22
|
+
self
|
23
|
+
end
|
24
|
+
end
|
data/lib/easypost/object.rb
CHANGED
@@ -49,14 +49,18 @@ class EasyPost::EasyPostObject
|
|
49
49
|
add_accessors(added)
|
50
50
|
end
|
51
51
|
|
52
|
-
# IDs
|
53
|
-
@values.delete(:id)
|
52
|
+
# IDs should never change. But to be safe, only delete if they are different.
|
53
|
+
@values.delete(:id) if values[:id] != @values[:id]
|
54
54
|
|
55
55
|
values.each do |k, v|
|
56
56
|
@values[k.to_s] = EasyPost::Util.convert_to_easypost_object(v, api_key, self, k)
|
57
57
|
@transient_values.delete(k)
|
58
58
|
@unsaved_values.delete(k)
|
59
59
|
end
|
60
|
+
|
61
|
+
return if @values[:id] || (values[:id].nil? && values['id'].nil?)
|
62
|
+
|
63
|
+
@values[:id] = values[:id] || values['id']
|
60
64
|
end
|
61
65
|
|
62
66
|
# Get element of an array.
|
data/lib/easypost/util.rb
CHANGED
@@ -11,7 +11,7 @@ module EasyPost::Util
|
|
11
11
|
'ca' => EasyPost::CarrierAccount,
|
12
12
|
'cstinfo' => EasyPost::CustomsInfo,
|
13
13
|
'cstitem' => EasyPost::CustomsItem,
|
14
|
-
'es' => EasyPost::
|
14
|
+
'es' => EasyPost::EndShipper,
|
15
15
|
'evt' => EasyPost::Event,
|
16
16
|
'hook' => EasyPost::Webhook,
|
17
17
|
'ins' => EasyPost::Insurance,
|
@@ -41,7 +41,7 @@ module EasyPost::Util
|
|
41
41
|
'CarrierAccount' => EasyPost::CarrierAccount,
|
42
42
|
'CustomsInfo' => EasyPost::CustomsInfo,
|
43
43
|
'CustomsItem' => EasyPost::CustomsItem,
|
44
|
-
'EndShipper' => EasyPost::
|
44
|
+
'EndShipper' => EasyPost::EndShipper,
|
45
45
|
'Event' => EasyPost::Event,
|
46
46
|
'Insurance' => EasyPost::Insurance,
|
47
47
|
'Order' => EasyPost::Order,
|
data/lib/easypost.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: easypost
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- EasyPost Developers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-08-
|
11
|
+
date: 2022-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: brakeman
|
@@ -164,6 +164,7 @@ files:
|
|
164
164
|
- ".github/PULL_REQUEST_TEMPLATE.md"
|
165
165
|
- ".github/workflows/ci.yml"
|
166
166
|
- ".gitignore"
|
167
|
+
- ".gitmodules"
|
167
168
|
- ".rubocop.yml"
|
168
169
|
- CHANGELOG.md
|
169
170
|
- CODE_OF_CONDUCT.md
|
@@ -195,6 +196,7 @@ files:
|
|
195
196
|
- lib/easypost/connection.rb
|
196
197
|
- lib/easypost/customs_info.rb
|
197
198
|
- lib/easypost/customs_item.rb
|
199
|
+
- lib/easypost/end_shipper.rb
|
198
200
|
- lib/easypost/error.rb
|
199
201
|
- lib/easypost/event.rb
|
200
202
|
- lib/easypost/insurance.rb
|