mundi_api 0.9.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.
Files changed (123) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +2186 -0
  4. data/lib/mundi_api.rb +137 -0
  5. data/lib/mundi_api/api_helper.rb +209 -0
  6. data/lib/mundi_api/configuration.rb +25 -0
  7. data/lib/mundi_api/controllers/base_controller.rb +61 -0
  8. data/lib/mundi_api/controllers/charges_controller.rb +359 -0
  9. data/lib/mundi_api/controllers/customers_controller.rb +758 -0
  10. data/lib/mundi_api/controllers/invoices_controller.rb +184 -0
  11. data/lib/mundi_api/controllers/orders_controller.rb +171 -0
  12. data/lib/mundi_api/controllers/plans_controller.rb +387 -0
  13. data/lib/mundi_api/controllers/subscriptions_controller.rb +648 -0
  14. data/lib/mundi_api/controllers/tokens_controller.rb +87 -0
  15. data/lib/mundi_api/exceptions/api_exception.rb +18 -0
  16. data/lib/mundi_api/exceptions/error_exception.rb +37 -0
  17. data/lib/mundi_api/http/auth/basic_auth.rb +20 -0
  18. data/lib/mundi_api/http/faraday_client.rb +55 -0
  19. data/lib/mundi_api/http/http_call_back.rb +22 -0
  20. data/lib/mundi_api/http/http_client.rb +92 -0
  21. data/lib/mundi_api/http/http_context.rb +18 -0
  22. data/lib/mundi_api/http/http_method_enum.rb +11 -0
  23. data/lib/mundi_api/http/http_request.rb +48 -0
  24. data/lib/mundi_api/http/http_response.rb +21 -0
  25. data/lib/mundi_api/models/base_model.rb +34 -0
  26. data/lib/mundi_api/models/create_access_token_request.rb +35 -0
  27. data/lib/mundi_api/models/create_address_request.rb +108 -0
  28. data/lib/mundi_api/models/create_bank_transfer_payment_request.rb +44 -0
  29. data/lib/mundi_api/models/create_boleto_payment_request.rb +83 -0
  30. data/lib/mundi_api/models/create_cancel_charge_request.rb +35 -0
  31. data/lib/mundi_api/models/create_cancel_subscription_request.rb +35 -0
  32. data/lib/mundi_api/models/create_capture_charge_request.rb +45 -0
  33. data/lib/mundi_api/models/create_card_options_request.rb +36 -0
  34. data/lib/mundi_api/models/create_card_request.rb +136 -0
  35. data/lib/mundi_api/models/create_card_token_request.rb +80 -0
  36. data/lib/mundi_api/models/create_charge_request.rb +92 -0
  37. data/lib/mundi_api/models/create_checkout_boleto_payment_request.rb +54 -0
  38. data/lib/mundi_api/models/create_checkout_card_installment_option_request.rb +44 -0
  39. data/lib/mundi_api/models/create_checkout_card_payment_request.rb +51 -0
  40. data/lib/mundi_api/models/create_checkout_payment_request.rb +82 -0
  41. data/lib/mundi_api/models/create_credit_card_payment_request.rb +108 -0
  42. data/lib/mundi_api/models/create_customer_request.rb +108 -0
  43. data/lib/mundi_api/models/create_discount_request.rb +62 -0
  44. data/lib/mundi_api/models/create_order_item_request.rb +71 -0
  45. data/lib/mundi_api/models/create_order_request.rb +114 -0
  46. data/lib/mundi_api/models/create_payment_request.rb +121 -0
  47. data/lib/mundi_api/models/create_phone_request.rb +53 -0
  48. data/lib/mundi_api/models/create_phones_request.rb +46 -0
  49. data/lib/mundi_api/models/create_plan_item_request.rb +81 -0
  50. data/lib/mundi_api/models/create_plan_request.rb +199 -0
  51. data/lib/mundi_api/models/create_price_bracket_request.rb +62 -0
  52. data/lib/mundi_api/models/create_pricing_scheme_request.rb +69 -0
  53. data/lib/mundi_api/models/create_seller_request.rb +90 -0
  54. data/lib/mundi_api/models/create_setup_request.rb +55 -0
  55. data/lib/mundi_api/models/create_shipping_request.rb +81 -0
  56. data/lib/mundi_api/models/create_subscription_item_request.rb +106 -0
  57. data/lib/mundi_api/models/create_subscription_request.rb +269 -0
  58. data/lib/mundi_api/models/create_token_request.rb +44 -0
  59. data/lib/mundi_api/models/create_usage_request.rb +54 -0
  60. data/lib/mundi_api/models/create_voucher_payment_request.rb +72 -0
  61. data/lib/mundi_api/models/get_access_token_response.rb +73 -0
  62. data/lib/mundi_api/models/get_address_response.rb +163 -0
  63. data/lib/mundi_api/models/get_bank_transfer_transaction_response.rb +118 -0
  64. data/lib/mundi_api/models/get_billing_address_response.rb +98 -0
  65. data/lib/mundi_api/models/get_boleto_transaction_response.rb +137 -0
  66. data/lib/mundi_api/models/get_card_response.rb +164 -0
  67. data/lib/mundi_api/models/get_card_token_response.rb +89 -0
  68. data/lib/mundi_api/models/get_charge_response.rb +184 -0
  69. data/lib/mundi_api/models/get_checkout_payment_settings_response.rb +99 -0
  70. data/lib/mundi_api/models/get_credit_card_transaction_response.rb +163 -0
  71. data/lib/mundi_api/models/get_customer_response.rb +145 -0
  72. data/lib/mundi_api/models/get_discount_response.rb +100 -0
  73. data/lib/mundi_api/models/get_invoice_item_response.rb +73 -0
  74. data/lib/mundi_api/models/get_invoice_response.rb +210 -0
  75. data/lib/mundi_api/models/get_order_item_response.rb +63 -0
  76. data/lib/mundi_api/models/get_order_response.rb +167 -0
  77. data/lib/mundi_api/models/get_period_response.rb +73 -0
  78. data/lib/mundi_api/models/get_phone_response.rb +53 -0
  79. data/lib/mundi_api/models/get_phones_response.rb +46 -0
  80. data/lib/mundi_api/models/get_plan_item_response.rb +127 -0
  81. data/lib/mundi_api/models/get_plan_response.rb +223 -0
  82. data/lib/mundi_api/models/get_price_bracket_response.rb +62 -0
  83. data/lib/mundi_api/models/get_pricing_scheme_response.rb +69 -0
  84. data/lib/mundi_api/models/get_safety_pay_transaction_response.rb +109 -0
  85. data/lib/mundi_api/models/get_seller_response.rb +126 -0
  86. data/lib/mundi_api/models/get_setup_response.rb +62 -0
  87. data/lib/mundi_api/models/get_shipping_response.rb +72 -0
  88. data/lib/mundi_api/models/get_subscription_item_response.rb +135 -0
  89. data/lib/mundi_api/models/get_subscription_response.rb +261 -0
  90. data/lib/mundi_api/models/get_token_response.rb +72 -0
  91. data/lib/mundi_api/models/get_transaction_response.rb +136 -0
  92. data/lib/mundi_api/models/get_usage_response.rb +82 -0
  93. data/lib/mundi_api/models/get_voucher_transaction_response.rb +163 -0
  94. data/lib/mundi_api/models/list_access_tokens_response.rb +51 -0
  95. data/lib/mundi_api/models/list_addresses_response.rb +51 -0
  96. data/lib/mundi_api/models/list_cards_response.rb +51 -0
  97. data/lib/mundi_api/models/list_charges_response.rb +51 -0
  98. data/lib/mundi_api/models/list_customers_response.rb +51 -0
  99. data/lib/mundi_api/models/list_invoices_response.rb +51 -0
  100. data/lib/mundi_api/models/list_order_response.rb +51 -0
  101. data/lib/mundi_api/models/list_plans_response.rb +51 -0
  102. data/lib/mundi_api/models/list_subscription_items_response.rb +51 -0
  103. data/lib/mundi_api/models/list_subscriptions_response.rb +51 -0
  104. data/lib/mundi_api/models/list_transactions_response.rb +51 -0
  105. data/lib/mundi_api/models/list_usages_response.rb +51 -0
  106. data/lib/mundi_api/models/paging_response.rb +53 -0
  107. data/lib/mundi_api/models/update_address_request.rb +53 -0
  108. data/lib/mundi_api/models/update_card_request.rb +81 -0
  109. data/lib/mundi_api/models/update_charge_card_request.rb +62 -0
  110. data/lib/mundi_api/models/update_charge_due_date_request.rb +36 -0
  111. data/lib/mundi_api/models/update_charge_payment_method_request.rb +74 -0
  112. data/lib/mundi_api/models/update_customer_request.rb +90 -0
  113. data/lib/mundi_api/models/update_metadata_request.rb +35 -0
  114. data/lib/mundi_api/models/update_plan_item_request.rb +81 -0
  115. data/lib/mundi_api/models/update_plan_request.rb +161 -0
  116. data/lib/mundi_api/models/update_price_bracket_request.rb +62 -0
  117. data/lib/mundi_api/models/update_pricing_scheme_request.rb +69 -0
  118. data/lib/mundi_api/models/update_subscription_billing_date_request.rb +37 -0
  119. data/lib/mundi_api/models/update_subscription_card_request.rb +44 -0
  120. data/lib/mundi_api/models/update_subscription_item_request.rb +81 -0
  121. data/lib/mundi_api/models/update_subscription_payment_method_request.rb +53 -0
  122. data/lib/mundi_api/mundi_api_client.rb +63 -0
  123. metadata +246 -0
@@ -0,0 +1,62 @@
1
+ # This file was automatically generated by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MundiApi
5
+ # Response object for getting a price bracket
6
+ class GetPriceBracketResponse < BaseModel
7
+ # TODO: Write general description for this method
8
+ # @return [Integer]
9
+ attr_accessor :start_quantity
10
+
11
+ # TODO: Write general description for this method
12
+ # @return [Integer]
13
+ attr_accessor :price
14
+
15
+ # TODO: Write general description for this method
16
+ # @return [Integer]
17
+ attr_accessor :end_quantity
18
+
19
+ # TODO: Write general description for this method
20
+ # @return [Integer]
21
+ attr_accessor :overage_price
22
+
23
+ # A mapping from model property names to API property names.
24
+ def self.names
25
+ if @_hash.nil?
26
+ @_hash = {}
27
+ @_hash['start_quantity'] = 'start_quantity'
28
+ @_hash['price'] = 'price'
29
+ @_hash['end_quantity'] = 'end_quantity'
30
+ @_hash['overage_price'] = 'overage_price'
31
+ end
32
+ @_hash
33
+ end
34
+
35
+ def initialize(start_quantity = nil,
36
+ price = nil,
37
+ end_quantity = nil,
38
+ overage_price = nil)
39
+ @start_quantity = start_quantity
40
+ @price = price
41
+ @end_quantity = end_quantity
42
+ @overage_price = overage_price
43
+ end
44
+
45
+ # Creates an instance of the object from a hash.
46
+ def self.from_hash(hash)
47
+ return nil unless hash
48
+
49
+ # Extract variables from the hash.
50
+ start_quantity = hash['start_quantity']
51
+ price = hash['price']
52
+ end_quantity = hash['end_quantity']
53
+ overage_price = hash['overage_price']
54
+
55
+ # Create object from extracted values.
56
+ GetPriceBracketResponse.new(start_quantity,
57
+ price,
58
+ end_quantity,
59
+ overage_price)
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,69 @@
1
+ # This file was automatically generated by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MundiApi
5
+ # Response object for getting a pricing scheme
6
+ class GetPricingSchemeResponse < BaseModel
7
+ # TODO: Write general description for this method
8
+ # @return [Integer]
9
+ attr_accessor :price
10
+
11
+ # TODO: Write general description for this method
12
+ # @return [String]
13
+ attr_accessor :scheme_type
14
+
15
+ # TODO: Write general description for this method
16
+ # @return [List of GetPriceBracketResponse]
17
+ attr_accessor :price_brackets
18
+
19
+ # TODO: Write general description for this method
20
+ # @return [Integer]
21
+ attr_accessor :minimum_price
22
+
23
+ # A mapping from model property names to API property names.
24
+ def self.names
25
+ if @_hash.nil?
26
+ @_hash = {}
27
+ @_hash['price'] = 'price'
28
+ @_hash['scheme_type'] = 'scheme_type'
29
+ @_hash['price_brackets'] = 'price_brackets'
30
+ @_hash['minimum_price'] = 'minimum_price'
31
+ end
32
+ @_hash
33
+ end
34
+
35
+ def initialize(price = nil,
36
+ scheme_type = nil,
37
+ price_brackets = nil,
38
+ minimum_price = nil)
39
+ @price = price
40
+ @scheme_type = scheme_type
41
+ @price_brackets = price_brackets
42
+ @minimum_price = minimum_price
43
+ end
44
+
45
+ # Creates an instance of the object from a hash.
46
+ def self.from_hash(hash)
47
+ return nil unless hash
48
+
49
+ # Extract variables from the hash.
50
+ price = hash['price']
51
+ scheme_type = hash['scheme_type']
52
+ # Parameter is an array, so we need to iterate through it
53
+ price_brackets = nil
54
+ unless hash['price_brackets'].nil?
55
+ price_brackets = []
56
+ hash['price_brackets'].each do |structure|
57
+ price_brackets << (GetPriceBracketResponse.from_hash(structure) if structure)
58
+ end
59
+ end
60
+ minimum_price = hash['minimum_price']
61
+
62
+ # Create object from extracted values.
63
+ GetPricingSchemeResponse.new(price,
64
+ scheme_type,
65
+ price_brackets,
66
+ minimum_price)
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,109 @@
1
+ # This file was automatically generated by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ require 'date'
5
+ require_relative 'get_transaction_response'
6
+
7
+ module MundiApi
8
+ # Response object for getting a safety pay transaction
9
+ class GetSafetyPayTransactionResponse < GetTransactionResponse
10
+ # Payment url
11
+ # @return [String]
12
+ attr_accessor :url
13
+
14
+ # Transaction identifier on bank
15
+ # @return [String]
16
+ attr_accessor :bank_tid
17
+
18
+ # Payment date
19
+ # @return [DateTime]
20
+ attr_accessor :paid_at
21
+
22
+ # Paid amount
23
+ # @return [Integer]
24
+ attr_accessor :paid_amount
25
+
26
+ # A mapping from model property names to API property names.
27
+ def self.names
28
+ if @_hash.nil?
29
+ @_hash = {}
30
+ @_hash['url'] = 'url'
31
+ @_hash['bank_tid'] = 'bank_tid'
32
+ @_hash['paid_at'] = 'paid_at'
33
+ @_hash['paid_amount'] = 'paid_amount'
34
+ @_hash = super().merge(@_hash)
35
+ end
36
+ @_hash
37
+ end
38
+
39
+ def initialize(url = nil,
40
+ bank_tid = nil,
41
+ gateway_id = nil,
42
+ amount = nil,
43
+ status = nil,
44
+ success = nil,
45
+ created_at = nil,
46
+ updated_at = nil,
47
+ attempt_count = nil,
48
+ max_attempts = nil,
49
+ paid_at = nil,
50
+ paid_amount = nil,
51
+ next_attempt = nil,
52
+ transaction_type = nil)
53
+ @url = url
54
+ @bank_tid = bank_tid
55
+ @paid_at = paid_at
56
+ @paid_amount = paid_amount
57
+
58
+ # Call the constructor of the base class
59
+ super(gateway_id,
60
+ amount,
61
+ status,
62
+ success,
63
+ created_at,
64
+ updated_at,
65
+ attempt_count,
66
+ max_attempts,
67
+ next_attempt,
68
+ transaction_type)
69
+ end
70
+
71
+ # Creates an instance of the object from a hash.
72
+ def self.from_hash(hash)
73
+ return nil unless hash
74
+
75
+ # Extract variables from the hash.
76
+ url = hash['url']
77
+ bank_tid = hash['bank_tid']
78
+ gateway_id = hash['gateway_id']
79
+ amount = hash['amount']
80
+ status = hash['status']
81
+ success = hash['success']
82
+ created_at = DateTime.rfc3339(hash['created_at']) if hash['created_at']
83
+ updated_at = DateTime.rfc3339(hash['updated_at']) if hash['updated_at']
84
+ attempt_count = hash['attempt_count']
85
+ max_attempts = hash['max_attempts']
86
+ paid_at = DateTime.rfc3339(hash['paid_at']) if hash['paid_at']
87
+ paid_amount = hash['paid_amount']
88
+ next_attempt = DateTime.rfc3339(hash['next_attempt']) if
89
+ hash['next_attempt']
90
+ transaction_type = hash['transaction_type']
91
+
92
+ # Create object from extracted values.
93
+ GetSafetyPayTransactionResponse.new(url,
94
+ bank_tid,
95
+ gateway_id,
96
+ amount,
97
+ status,
98
+ success,
99
+ created_at,
100
+ updated_at,
101
+ attempt_count,
102
+ max_attempts,
103
+ paid_at,
104
+ paid_amount,
105
+ next_attempt,
106
+ transaction_type)
107
+ end
108
+ end
109
+ end
@@ -0,0 +1,126 @@
1
+ # This file was automatically generated by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MundiApi
5
+ # GetSellerResponse Model.
6
+ class GetSellerResponse < BaseModel
7
+ # Identification
8
+ # @return [String]
9
+ attr_accessor :id
10
+
11
+ # Identification
12
+ # @return [String]
13
+ attr_accessor :name
14
+
15
+ # Identification
16
+ # @return [String]
17
+ attr_accessor :code
18
+
19
+ # Identification
20
+ # @return [String]
21
+ attr_accessor :document
22
+
23
+ # Description
24
+ # @return [String]
25
+ attr_accessor :description
26
+
27
+ # Status
28
+ # @return [String]
29
+ attr_accessor :status
30
+
31
+ # Creation date
32
+ # @return [String]
33
+ attr_accessor :created_at
34
+
35
+ # Updated date
36
+ # @return [String]
37
+ attr_accessor :updated_at
38
+
39
+ # Address
40
+ # @return [GetAddressResponse]
41
+ attr_accessor :address
42
+
43
+ # Metadata
44
+ # @return [Object]
45
+ attr_accessor :metadata
46
+
47
+ # Deleted date
48
+ # @return [String]
49
+ attr_accessor :deleted_at
50
+
51
+ # A mapping from model property names to API property names.
52
+ def self.names
53
+ if @_hash.nil?
54
+ @_hash = {}
55
+ @_hash['id'] = 'id'
56
+ @_hash['name'] = 'name'
57
+ @_hash['code'] = 'code'
58
+ @_hash['document'] = 'document'
59
+ @_hash['description'] = 'description'
60
+ @_hash['status'] = 'Status'
61
+ @_hash['created_at'] = 'CreatedAt'
62
+ @_hash['updated_at'] = 'UpdatedAt'
63
+ @_hash['address'] = 'Address'
64
+ @_hash['metadata'] = 'Metadata'
65
+ @_hash['deleted_at'] = 'DeletedAt'
66
+ end
67
+ @_hash
68
+ end
69
+
70
+ def initialize(id = nil,
71
+ name = nil,
72
+ code = nil,
73
+ document = nil,
74
+ description = nil,
75
+ status = nil,
76
+ created_at = nil,
77
+ updated_at = nil,
78
+ address = nil,
79
+ metadata = nil,
80
+ deleted_at = nil)
81
+ @id = id
82
+ @name = name
83
+ @code = code
84
+ @document = document
85
+ @description = description
86
+ @status = status
87
+ @created_at = created_at
88
+ @updated_at = updated_at
89
+ @address = address
90
+ @metadata = metadata
91
+ @deleted_at = deleted_at
92
+ end
93
+
94
+ # Creates an instance of the object from a hash.
95
+ def self.from_hash(hash)
96
+ return nil unless hash
97
+
98
+ # Extract variables from the hash.
99
+ id = hash['id']
100
+ name = hash['name']
101
+ code = hash['code']
102
+ document = hash['document']
103
+ description = hash['description']
104
+ status = hash['Status']
105
+ created_at = hash['CreatedAt']
106
+ updated_at = hash['UpdatedAt']
107
+ address = GetAddressResponse.from_hash(hash['Address']) if
108
+ hash['Address']
109
+ metadata = hash['Metadata']
110
+ deleted_at = hash['DeletedAt']
111
+
112
+ # Create object from extracted values.
113
+ GetSellerResponse.new(id,
114
+ name,
115
+ code,
116
+ document,
117
+ description,
118
+ status,
119
+ created_at,
120
+ updated_at,
121
+ address,
122
+ metadata,
123
+ deleted_at)
124
+ end
125
+ end
126
+ end
@@ -0,0 +1,62 @@
1
+ # This file was automatically generated by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MundiApi
5
+ # Response object for getting the setup from a subscription
6
+ class GetSetupResponse < BaseModel
7
+ # TODO: Write general description for this method
8
+ # @return [String]
9
+ attr_accessor :id
10
+
11
+ # TODO: Write general description for this method
12
+ # @return [String]
13
+ attr_accessor :description
14
+
15
+ # TODO: Write general description for this method
16
+ # @return [Integer]
17
+ attr_accessor :amount
18
+
19
+ # TODO: Write general description for this method
20
+ # @return [String]
21
+ attr_accessor :status
22
+
23
+ # A mapping from model property names to API property names.
24
+ def self.names
25
+ if @_hash.nil?
26
+ @_hash = {}
27
+ @_hash['id'] = 'id'
28
+ @_hash['description'] = 'description'
29
+ @_hash['amount'] = 'amount'
30
+ @_hash['status'] = 'status'
31
+ end
32
+ @_hash
33
+ end
34
+
35
+ def initialize(id = nil,
36
+ description = nil,
37
+ amount = nil,
38
+ status = nil)
39
+ @id = id
40
+ @description = description
41
+ @amount = amount
42
+ @status = status
43
+ end
44
+
45
+ # Creates an instance of the object from a hash.
46
+ def self.from_hash(hash)
47
+ return nil unless hash
48
+
49
+ # Extract variables from the hash.
50
+ id = hash['id']
51
+ description = hash['description']
52
+ amount = hash['amount']
53
+ status = hash['status']
54
+
55
+ # Create object from extracted values.
56
+ GetSetupResponse.new(id,
57
+ description,
58
+ amount,
59
+ status)
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,72 @@
1
+ # This file was automatically generated by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MundiApi
5
+ # Response object for getting the shipping data
6
+ class GetShippingResponse < BaseModel
7
+ # TODO: Write general description for this method
8
+ # @return [Integer]
9
+ attr_accessor :amount
10
+
11
+ # TODO: Write general description for this method
12
+ # @return [String]
13
+ attr_accessor :description
14
+
15
+ # TODO: Write general description for this method
16
+ # @return [String]
17
+ attr_accessor :recipient_name
18
+
19
+ # TODO: Write general description for this method
20
+ # @return [String]
21
+ attr_accessor :recipient_phone
22
+
23
+ # TODO: Write general description for this method
24
+ # @return [GetAddressResponse]
25
+ attr_accessor :address
26
+
27
+ # A mapping from model property names to API property names.
28
+ def self.names
29
+ if @_hash.nil?
30
+ @_hash = {}
31
+ @_hash['amount'] = 'amount'
32
+ @_hash['description'] = 'description'
33
+ @_hash['recipient_name'] = 'recipient_name'
34
+ @_hash['recipient_phone'] = 'recipient_phone'
35
+ @_hash['address'] = 'address'
36
+ end
37
+ @_hash
38
+ end
39
+
40
+ def initialize(amount = nil,
41
+ description = nil,
42
+ recipient_name = nil,
43
+ recipient_phone = nil,
44
+ address = nil)
45
+ @amount = amount
46
+ @description = description
47
+ @recipient_name = recipient_name
48
+ @recipient_phone = recipient_phone
49
+ @address = address
50
+ end
51
+
52
+ # Creates an instance of the object from a hash.
53
+ def self.from_hash(hash)
54
+ return nil unless hash
55
+
56
+ # Extract variables from the hash.
57
+ amount = hash['amount']
58
+ description = hash['description']
59
+ recipient_name = hash['recipient_name']
60
+ recipient_phone = hash['recipient_phone']
61
+ address = GetAddressResponse.from_hash(hash['address']) if
62
+ hash['address']
63
+
64
+ # Create object from extracted values.
65
+ GetShippingResponse.new(amount,
66
+ description,
67
+ recipient_name,
68
+ recipient_phone,
69
+ address)
70
+ end
71
+ end
72
+ end