easypost 3.4.0 → 3.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 31efd6b963670a4dc229385c0ca537e37c55adaeb8174b7a55d048fcb66ee09d
4
- data.tar.gz: 724dfd0bc8dc98ff5c5a7a9c91e1be3adc2f5160f9a7d32827c55e2b0b029993
3
+ metadata.gz: 61c0e0c8eb25bf4d96db43cd812a71df8648e2b1a77f2eef5d651bb4c1275cbf
4
+ data.tar.gz: ac36be5df27407e988d4fcc50c93a312fe8e1465cba96e85c8120d36acdfcf65
5
5
  SHA512:
6
- metadata.gz: 1bcb89b64cade19b65e91b29223329d3d0353b856b056e65690cd3d0e1ea155a548a73fc8c7e5b4a17ffae034b7bd23f5c36abf76ff974a5e615c7fa6fb05dc0
7
- data.tar.gz: cfe4bb3cc5cc89e4e9f165cc17d1bfe91f4f583d535883510d3ed8088ce690709acca8de0d66573dfd5e8f6cc10fc97a21586b2f4dbb61c34854cc3ca089cb23
6
+ metadata.gz: cd011f19406e4f5187f6daac73c490621052605610160992ce4ec42db0b9a4e1b3f64f90123f2b8a7399f32f3b54c7d6515e03c882e01acbc913d611dce9f0a2
7
+ data.tar.gz: 3bb63bfce116fa8e1504cde77b38019c68bd4269770246e78aad8916b3e04e29877926550ddaf17fe5fa8489e071069a5e2b0e1432a0fdb52bc0f55e4a981af5
data/CHANGELOG.md CHANGED
@@ -1,6 +1,11 @@
1
1
  # CHANGELOG
2
2
 
3
3
 
4
+ ## 3.5.0 2021-12-06
5
+
6
+ * Adds the `update_brand` method to the user object (closes #122)
7
+
8
+
4
9
  ## 3.4.0 2021-07-13
5
10
 
6
11
  * Removed deprecated `Item` object
data/README.md CHANGED
@@ -101,7 +101,7 @@ Up-to-date documentation at: https://easypost.com/docs
101
101
 
102
102
  ```bash
103
103
  # Run tests
104
- bundle exec rspec
104
+ API_KEY=123... bundle exec rspec
105
105
  ```
106
106
 
107
107
  ## Releasing
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.4.0
1
+ 3.5.0
@@ -0,0 +1,9 @@
1
+ class EasyPost::Brand < EasyPost::Resource
2
+ def url
3
+ if user_id.nil? || user_id.empty?
4
+ raise EasyPost::Error, "Missing user_id: #{self.class} instance is missing user_id"
5
+ end
6
+
7
+ "#{::EasyPost::User.url}/#{CGI.escape(user_id)}/brand"
8
+ end
9
+ end
@@ -0,0 +1,2 @@
1
+ class EasyPost::TaxIdentifier < EasyPost::Resource
2
+ end
data/lib/easypost/user.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  class EasyPost::User < EasyPost::Resource
2
- def self.create(params={}, api_key=nil)
3
- response = EasyPost.make_request(:post, self.url, api_key, {self.class_name.to_sym => params})
4
- return EasyPost::Util.convert_to_easypost_object(response, api_key)
2
+ def self.create(params = {}, api_key = nil)
3
+ response = EasyPost.make_request(:post, url, api_key, {class_name.to_sym => params})
4
+ EasyPost::Util.convert_to_easypost_object(response, api_key)
5
5
  end
6
6
 
7
7
  def save
@@ -14,11 +14,11 @@ class EasyPost::User < EasyPost::Resource
14
14
  response = EasyPost.make_request(:put, url, @api_key, wrapped_params)
15
15
  refresh_from(response, api_key)
16
16
  end
17
- return self
17
+ self
18
18
  end
19
19
 
20
20
  def self.retrieve_me
21
- self.all
21
+ all
22
22
  end
23
23
 
24
24
  def self.all_api_keys
@@ -28,11 +28,11 @@ class EasyPost::User < EasyPost::Resource
28
28
  def api_keys
29
29
  api_keys = EasyPost::User.all_api_keys
30
30
 
31
- if api_keys.id == self.id
31
+ if api_keys.id == id
32
32
  my_api_keys = api_keys.keys
33
33
  else
34
- for child in api_keys.children
35
- if child.id == self.id
34
+ api_keys.children.each do |child|
35
+ if child.id == id
36
36
  my_api_keys = child.keys
37
37
  break
38
38
  end
@@ -41,4 +41,16 @@ class EasyPost::User < EasyPost::Resource
41
41
 
42
42
  my_api_keys
43
43
  end
44
+
45
+ def update_brand(**attrs)
46
+ brand = EasyPost::Brand.new
47
+ data = {object: "Brand", user_id: id, **attrs}
48
+ # Add accessors manually because there's no API to retrieve a brand
49
+ brand.add_accessors(data.keys)
50
+ # Assigning values with accessors defined above
51
+ data.each do |key, val|
52
+ brand.send("#{key}=", val)
53
+ end
54
+ brand.save
55
+ end
44
56
  end
data/lib/easypost/util.rb CHANGED
@@ -42,6 +42,7 @@ module EasyPost::Util
42
42
  'Report' => EasyPost::Report,
43
43
  'ScanForm' => EasyPost::ScanForm,
44
44
  'Shipment' => EasyPost::Shipment,
45
+ 'TaxIdentifier' => EasyPost::TaxIdentifier,
45
46
  'ShipmentInvoiceReport' => EasyPost::Report,
46
47
  'ShipmentReport' => EasyPost::Report,
47
48
  'Tracker' => EasyPost::Tracker,
data/lib/easypost.rb CHANGED
@@ -12,6 +12,7 @@ require "easypost/error"
12
12
  require "easypost/address"
13
13
  require "easypost/api_key"
14
14
  require "easypost/batch"
15
+ require "easypost/brand"
15
16
  require "easypost/carrier_account"
16
17
  require "easypost/carrier_type"
17
18
  require "easypost/customs_info"
@@ -30,6 +31,7 @@ require "easypost/refund"
30
31
  require "easypost/report"
31
32
  require "easypost/scan_form"
32
33
  require "easypost/shipment"
34
+ require "easypost/tax_identifier"
33
35
  require "easypost/tracker"
34
36
  require "easypost/user"
35
37
  require "easypost/webhook"
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easypost
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.0
4
+ version: 3.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jake Epstein
8
8
  - Andrew Tribone
9
9
  - James Brown
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-07-13 00:00:00.000000000 Z
13
+ date: 2021-12-06 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: pry
@@ -103,6 +103,7 @@ files:
103
103
  - lib/easypost/address.rb
104
104
  - lib/easypost/api_key.rb
105
105
  - lib/easypost/batch.rb
106
+ - lib/easypost/brand.rb
106
107
  - lib/easypost/carrier_account.rb
107
108
  - lib/easypost/carrier_type.rb
108
109
  - lib/easypost/customs_info.rb
@@ -124,6 +125,7 @@ files:
124
125
  - lib/easypost/resource.rb
125
126
  - lib/easypost/scan_form.rb
126
127
  - lib/easypost/shipment.rb
128
+ - lib/easypost/tax_identifier.rb
127
129
  - lib/easypost/tracker.rb
128
130
  - lib/easypost/user.rb
129
131
  - lib/easypost/util.rb
@@ -133,7 +135,7 @@ homepage: https://www.easypost.com/docs
133
135
  licenses:
134
136
  - MIT
135
137
  metadata: {}
136
- post_install_message:
138
+ post_install_message:
137
139
  rdoc_options: []
138
140
  require_paths:
139
141
  - lib
@@ -148,8 +150,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
148
150
  - !ruby/object:Gem::Version
149
151
  version: '0'
150
152
  requirements: []
151
- rubygems_version: 3.0.3
152
- signing_key:
153
+ rubygems_version: 3.0.3.1
154
+ signing_key:
153
155
  specification_version: 4
154
156
  summary: EasyPost Ruby Client Library
155
157
  test_files: []