Class: EasyPost::Services::FedexRegistration

Inherits:
Service
  • Object
show all
Defined in:
lib/easypost/services/fedex_registration.rb

Instance Method Summary collapse

Methods inherited from Service

#initialize

Constructor Details

This class inherits a constructor from EasyPost::Services::Service

Instance Method Details

#register_address(fedex_account_number, params = {}) ⇒ Object

Register the billing address for a FedEx account.



7
8
9
10
11
12
13
14
# File 'lib/easypost/services/fedex_registration.rb', line 7

def register_address(, params = {})
  wrapped_params = wrap_address_validation(params)
  endpoint = "fedex_registrations/#{}/address"

  response = @client.make_request(:post, endpoint, wrapped_params)

  EasyPost::InternalUtilities::Json.convert_json_to_object(response, EasyPost::Models::EasyPostObject)
end

#request_pin(fedex_account_number, pin_method_option) ⇒ Object

Request a PIN for FedEx account verification.



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/easypost/services/fedex_registration.rb', line 17

def request_pin(, pin_method_option)
  wrapped_params = {
    pin_method: {
      option: pin_method_option,
    },
  }
  endpoint = "fedex_registrations/#{}/pin"

  response = @client.make_request(:post, endpoint, wrapped_params)

  EasyPost::InternalUtilities::Json.convert_json_to_object(response, EasyPost::Models::EasyPostObject)
end

#submit_invoice(fedex_account_number, params = {}) ⇒ Object

Submit invoice information to complete FedEx account registration.



41
42
43
44
45
46
47
48
# File 'lib/easypost/services/fedex_registration.rb', line 41

def submit_invoice(, params = {})
  wrapped_params = wrap_invoice_validation(params)
  endpoint = "fedex_registrations/#{}/invoice"

  response = @client.make_request(:post, endpoint, wrapped_params)

  EasyPost::InternalUtilities::Json.convert_json_to_object(response, EasyPost::Models::EasyPostObject)
end

#validate_pin(fedex_account_number, params = {}) ⇒ Object

Validate the PIN entered by the user for FedEx account verification.



31
32
33
34
35
36
37
38
# File 'lib/easypost/services/fedex_registration.rb', line 31

def validate_pin(, params = {})
  wrapped_params = wrap_pin_validation(params)
  endpoint = "fedex_registrations/#{}/pin/validate"

  response = @client.make_request(:post, endpoint, wrapped_params)

  EasyPost::InternalUtilities::Json.convert_json_to_object(response, EasyPost::Models::EasyPostObject)
end