44
55class EasyPost ::Services ::FedexRegistration < EasyPost ::Services ::Service
66 # Register the billing address for a FedEx account.
7- # Advanced method for custom parameter structures.
8- #
9- # @param fedex_account_number [String] The FedEx account number.
10- # @param params [Hash] Map of parameters.
11- # @return [EasyPost::Models::FedExAccountValidationResponse] object with next steps (PIN or invoice validation).
127 def register_address ( fedex_account_number , params = { } )
138 wrapped_params = wrap_address_validation ( params )
149 endpoint = "fedex_registrations/#{ fedex_account_number } /address"
@@ -19,10 +14,6 @@ def register_address(fedex_account_number, params = {})
1914 end
2015
2116 # Request a PIN for FedEx account verification.
22- #
23- # @param fedex_account_number [String] The FedEx account number.
24- # @param pin_method_option [String] The PIN delivery method: "SMS", "CALL", or "EMAIL".
25- # @return [EasyPost::Models::FedExRequestPinResponse] object confirming PIN was sent.
2617 def request_pin ( fedex_account_number , pin_method_option )
2718 wrapped_params = {
2819 pin_method : {
@@ -33,44 +24,33 @@ def request_pin(fedex_account_number, pin_method_option)
3324
3425 response = @client . make_request ( :post , endpoint , wrapped_params )
3526
36- EasyPost ::InternalUtilities ::Json . convert_json_to_object ( response , EasyPost ::Models ::FedExRequestPinResponse )
27+ EasyPost ::InternalUtilities ::Json . convert_json_to_object ( response , EasyPost ::Models ::EasyPostObject )
3728 end
3829
3930 # Validate the PIN entered by the user for FedEx account verification.
40- #
41- # @param fedex_account_number [String] The FedEx account number.
42- # @param params [Hash] Map of parameters.
43- # @return [EasyPost::Models::FedExAccountValidationResponse] object.
4431 def validate_pin ( fedex_account_number , params = { } )
4532 wrapped_params = wrap_pin_validation ( params )
4633 endpoint = "fedex_registrations/#{ fedex_account_number } /pin/validate"
4734
4835 response = @client . make_request ( :post , endpoint , wrapped_params )
4936
50- EasyPost ::InternalUtilities ::Json . convert_json_to_object ( response , EasyPost ::Models ::FedExAccountValidationResponse )
37+ EasyPost ::InternalUtilities ::Json . convert_json_to_object ( response , EasyPost ::Models ::EasyPostObject )
5138 end
5239
5340 # Submit invoice information to complete FedEx account registration.
54- #
55- # @param fedex_account_number [String] The FedEx account number.
56- # @param params [Hash] Map of parameters.
57- # @return [EasyPost::Models::FedExAccountValidationResponse] object.
5841 def submit_invoice ( fedex_account_number , params = { } )
5942 wrapped_params = wrap_invoice_validation ( params )
6043 endpoint = "fedex_registrations/#{ fedex_account_number } /invoice"
6144
6245 response = @client . make_request ( :post , endpoint , wrapped_params )
6346
64- EasyPost ::InternalUtilities ::Json . convert_json_to_object ( response , EasyPost ::Models ::FedExAccountValidationResponse )
47+ EasyPost ::InternalUtilities ::Json . convert_json_to_object ( response , EasyPost ::Models ::EasyPostObject )
6548 end
6649
6750 private
6851
6952 # Wraps address validation parameters and ensures the "name" field exists.
7053 # If not present, generates a UUID (with hyphens removed) as the name.
71- #
72- # @param params [Hash] The original parameters hash.
73- # @return [Hash] A new hash with properly wrapped address_validation and easypost_details.
7454 def wrap_address_validation ( params )
7555 wrapped_params = { }
7656
@@ -87,9 +67,6 @@ def wrap_address_validation(params)
8767
8868 # Wraps PIN validation parameters and ensures the "name" field exists.
8969 # If not present, generates a UUID (with hyphens removed) as the name.
90- #
91- # @param params [Hash] The original parameters hash.
92- # @return [Hash] A new hash with properly wrapped pin_validation and easypost_details.
9370 def wrap_pin_validation ( params )
9471 wrapped_params = { }
9572
@@ -106,9 +83,6 @@ def wrap_pin_validation(params)
10683
10784 # Wraps invoice validation parameters and ensures the "name" field exists.
10885 # If not present, generates a UUID (with hyphens removed) as the name.
109- #
110- # @param params [Hash] The original parameters hash.
111- # @return [Hash] A new hash with properly wrapped invoice_validation and easypost_details.
11286 def wrap_invoice_validation ( params )
11387 wrapped_params = { }
11488
@@ -126,8 +100,6 @@ def wrap_invoice_validation(params)
126100 # Ensures the "name" field exists in the provided hash.
127101 # If not present, generates a UUID (with hyphens removed) as the name.
128102 # This follows the pattern used in the web UI implementation.
129- #
130- # @param hash [Hash] The hash to ensure the "name" field in.
131103 def ensure_name_field ( hash )
132104 return if hash . key? ( :name ) && !hash [ :name ] . nil?
133105
0 commit comments