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,34 @@
1
+ # This file was automatically generated by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MundiApi
5
+ # Base model.
6
+ class BaseModel
7
+ # Returns a Hash representation of the current object.
8
+ def to_hash
9
+ hash = {}
10
+ instance_variables.each do |name|
11
+ value = instance_variable_get(name)
12
+ name = name[1..-1]
13
+ key = self.class.names.key?(name) ? self.class.names[name] : name
14
+ if value.instance_of? Array
15
+ hash[key] = value.map { |v| v.is_a?(BaseModel) ? v.to_hash : v }
16
+ elsif value.instance_of? Hash
17
+ hash[key] = {}
18
+ value.each do |k, v|
19
+ hash[key][k] = v.is_a?(BaseModel) ? v.to_hash : v
20
+ end
21
+ else
22
+ hash[key] = value.is_a?(BaseModel) ? value.to_hash : value
23
+ end
24
+ end
25
+ hash
26
+ end
27
+
28
+ # Returns a JSON representation of the curent object.
29
+ def to_json(options = {})
30
+ hash = to_hash
31
+ hash.to_json(options)
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,35 @@
1
+ # This file was automatically generated by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MundiApi
5
+ # Request for creating a new Access Token
6
+ class CreateAccessTokenRequest < BaseModel
7
+ # Minutes to expire the token
8
+ # @return [Integer]
9
+ attr_accessor :esxpires_in
10
+
11
+ # A mapping from model property names to API property names.
12
+ def self.names
13
+ if @_hash.nil?
14
+ @_hash = {}
15
+ @_hash['esxpires_in'] = 'esxpires_in'
16
+ end
17
+ @_hash
18
+ end
19
+
20
+ def initialize(esxpires_in = nil)
21
+ @esxpires_in = esxpires_in
22
+ end
23
+
24
+ # Creates an instance of the object from a hash.
25
+ def self.from_hash(hash)
26
+ return nil unless hash
27
+
28
+ # Extract variables from the hash.
29
+ esxpires_in = hash['esxpires_in']
30
+
31
+ # Create object from extracted values.
32
+ CreateAccessTokenRequest.new(esxpires_in)
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,108 @@
1
+ # This file was automatically generated by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MundiApi
5
+ # Request for creating a new Address
6
+ class CreateAddressRequest < BaseModel
7
+ # Street
8
+ # @return [String]
9
+ attr_accessor :street
10
+
11
+ # Number
12
+ # @return [String]
13
+ attr_accessor :number
14
+
15
+ # The zip code containing only numbers. No special characters or spaces.
16
+ # @return [String]
17
+ attr_accessor :zip_code
18
+
19
+ # Neighborhood
20
+ # @return [String]
21
+ attr_accessor :neighborhood
22
+
23
+ # City
24
+ # @return [String]
25
+ attr_accessor :city
26
+
27
+ # State
28
+ # @return [String]
29
+ attr_accessor :state
30
+
31
+ # Country. Must be entered using ISO 3166-1 alpha-2 format. See
32
+ # https://pt.wikipedia.org/wiki/ISO_3166-1_alfa-2
33
+ # @return [String]
34
+ attr_accessor :country
35
+
36
+ # Complement
37
+ # @return [String]
38
+ attr_accessor :complement
39
+
40
+ # Metadata
41
+ # @return [Array<String, String>]
42
+ attr_accessor :metadata
43
+
44
+ # A mapping from model property names to API property names.
45
+ def self.names
46
+ if @_hash.nil?
47
+ @_hash = {}
48
+ @_hash['street'] = 'street'
49
+ @_hash['number'] = 'number'
50
+ @_hash['zip_code'] = 'zip_code'
51
+ @_hash['neighborhood'] = 'neighborhood'
52
+ @_hash['city'] = 'city'
53
+ @_hash['state'] = 'state'
54
+ @_hash['country'] = 'country'
55
+ @_hash['complement'] = 'complement'
56
+ @_hash['metadata'] = 'metadata'
57
+ end
58
+ @_hash
59
+ end
60
+
61
+ def initialize(street = nil,
62
+ number = nil,
63
+ zip_code = nil,
64
+ neighborhood = nil,
65
+ city = nil,
66
+ state = nil,
67
+ country = nil,
68
+ complement = nil,
69
+ metadata = nil)
70
+ @street = street
71
+ @number = number
72
+ @zip_code = zip_code
73
+ @neighborhood = neighborhood
74
+ @city = city
75
+ @state = state
76
+ @country = country
77
+ @complement = complement
78
+ @metadata = metadata
79
+ end
80
+
81
+ # Creates an instance of the object from a hash.
82
+ def self.from_hash(hash)
83
+ return nil unless hash
84
+
85
+ # Extract variables from the hash.
86
+ street = hash['street']
87
+ number = hash['number']
88
+ zip_code = hash['zip_code']
89
+ neighborhood = hash['neighborhood']
90
+ city = hash['city']
91
+ state = hash['state']
92
+ country = hash['country']
93
+ complement = hash['complement']
94
+ metadata = hash['metadata']
95
+
96
+ # Create object from extracted values.
97
+ CreateAddressRequest.new(street,
98
+ number,
99
+ zip_code,
100
+ neighborhood,
101
+ city,
102
+ state,
103
+ country,
104
+ complement,
105
+ metadata)
106
+ end
107
+ end
108
+ end
@@ -0,0 +1,44 @@
1
+ # This file was automatically generated by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MundiApi
5
+ # Request for creating a bank transfer payment
6
+ class CreateBankTransferPaymentRequest < BaseModel
7
+ # Bank
8
+ # @return [String]
9
+ attr_accessor :bank
10
+
11
+ # Number of retries
12
+ # @return [Integer]
13
+ attr_accessor :retries
14
+
15
+ # A mapping from model property names to API property names.
16
+ def self.names
17
+ if @_hash.nil?
18
+ @_hash = {}
19
+ @_hash['bank'] = 'bank'
20
+ @_hash['retries'] = 'retries'
21
+ end
22
+ @_hash
23
+ end
24
+
25
+ def initialize(bank = nil,
26
+ retries = nil)
27
+ @bank = bank
28
+ @retries = retries
29
+ end
30
+
31
+ # Creates an instance of the object from a hash.
32
+ def self.from_hash(hash)
33
+ return nil unless hash
34
+
35
+ # Extract variables from the hash.
36
+ bank = hash['bank']
37
+ retries = hash['retries']
38
+
39
+ # Create object from extracted values.
40
+ CreateBankTransferPaymentRequest.new(bank,
41
+ retries)
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,83 @@
1
+ # This file was automatically generated by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ require 'date'
5
+ module MundiApi
6
+ # Contains the settings for creating a boleto payment
7
+ class CreateBoletoPaymentRequest < BaseModel
8
+ # Number of retries
9
+ # @return [Integer]
10
+ attr_accessor :retries
11
+
12
+ # The bank code, containing three characters. The available codes are on the
13
+ # API specification
14
+ # @return [String]
15
+ attr_accessor :bank
16
+
17
+ # The instructions field that will be printed on the boleto.
18
+ # @return [String]
19
+ attr_accessor :instructions
20
+
21
+ # Boleto due date
22
+ # @return [DateTime]
23
+ attr_accessor :due_at
24
+
25
+ # Card's billing address
26
+ # @return [CreateAddressRequest]
27
+ attr_accessor :billing_address
28
+
29
+ # The address id for the billing address
30
+ # @return [String]
31
+ attr_accessor :billing_address_id
32
+
33
+ # A mapping from model property names to API property names.
34
+ def self.names
35
+ if @_hash.nil?
36
+ @_hash = {}
37
+ @_hash['retries'] = 'retries'
38
+ @_hash['bank'] = 'bank'
39
+ @_hash['instructions'] = 'instructions'
40
+ @_hash['due_at'] = 'due_at'
41
+ @_hash['billing_address'] = 'billing_address'
42
+ @_hash['billing_address_id'] = 'billing_address_id'
43
+ end
44
+ @_hash
45
+ end
46
+
47
+ def initialize(retries = nil,
48
+ bank = nil,
49
+ instructions = nil,
50
+ due_at = nil,
51
+ billing_address = nil,
52
+ billing_address_id = nil)
53
+ @retries = retries
54
+ @bank = bank
55
+ @instructions = instructions
56
+ @due_at = due_at
57
+ @billing_address = billing_address
58
+ @billing_address_id = billing_address_id
59
+ end
60
+
61
+ # Creates an instance of the object from a hash.
62
+ def self.from_hash(hash)
63
+ return nil unless hash
64
+
65
+ # Extract variables from the hash.
66
+ retries = hash['retries']
67
+ bank = hash['bank']
68
+ instructions = hash['instructions']
69
+ due_at = DateTime.rfc3339(hash['due_at']) if hash['due_at']
70
+ billing_address = CreateAddressRequest.from_hash(hash['billing_address']) if
71
+ hash['billing_address']
72
+ billing_address_id = hash['billing_address_id']
73
+
74
+ # Create object from extracted values.
75
+ CreateBoletoPaymentRequest.new(retries,
76
+ bank,
77
+ instructions,
78
+ due_at,
79
+ billing_address,
80
+ billing_address_id)
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,35 @@
1
+ # This file was automatically generated by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MundiApi
5
+ # Request for canceling a charge.
6
+ class CreateCancelChargeRequest < BaseModel
7
+ # The amount that will be canceled.
8
+ # @return [Integer]
9
+ attr_accessor :amount
10
+
11
+ # A mapping from model property names to API property names.
12
+ def self.names
13
+ if @_hash.nil?
14
+ @_hash = {}
15
+ @_hash['amount'] = 'amount'
16
+ end
17
+ @_hash
18
+ end
19
+
20
+ def initialize(amount = nil)
21
+ @amount = amount
22
+ end
23
+
24
+ # Creates an instance of the object from a hash.
25
+ def self.from_hash(hash)
26
+ return nil unless hash
27
+
28
+ # Extract variables from the hash.
29
+ amount = hash['amount']
30
+
31
+ # Create object from extracted values.
32
+ CreateCancelChargeRequest.new(amount)
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,35 @@
1
+ # This file was automatically generated by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MundiApi
5
+ # Request for canceling a subscription
6
+ class CreateCancelSubscriptionRequest < BaseModel
7
+ # Indicates if the pending invoices must also be canceled.
8
+ # @return [Boolean]
9
+ attr_accessor :cancel_pending_invoices
10
+
11
+ # A mapping from model property names to API property names.
12
+ def self.names
13
+ if @_hash.nil?
14
+ @_hash = {}
15
+ @_hash['cancel_pending_invoices'] = 'cancel_pending_invoices'
16
+ end
17
+ @_hash
18
+ end
19
+
20
+ def initialize(cancel_pending_invoices = true)
21
+ @cancel_pending_invoices = cancel_pending_invoices
22
+ end
23
+
24
+ # Creates an instance of the object from a hash.
25
+ def self.from_hash(hash)
26
+ return nil unless hash
27
+
28
+ # Extract variables from the hash.
29
+ cancel_pending_invoices = hash['cancel_pending_invoices'] ||= true
30
+
31
+ # Create object from extracted values.
32
+ CreateCancelSubscriptionRequest.new(cancel_pending_invoices)
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,45 @@
1
+ # This file was automatically generated by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MundiApi
5
+ # Request for capturing a charge
6
+ class CreateCaptureChargeRequest < BaseModel
7
+ # Code for the charge. Sending this field will update the code send on the
8
+ # charge and order creation.
9
+ # @return [String]
10
+ attr_accessor :code
11
+
12
+ # The amount that will be captured
13
+ # @return [Integer]
14
+ attr_accessor :amount
15
+
16
+ # A mapping from model property names to API property names.
17
+ def self.names
18
+ if @_hash.nil?
19
+ @_hash = {}
20
+ @_hash['code'] = 'code'
21
+ @_hash['amount'] = 'amount'
22
+ end
23
+ @_hash
24
+ end
25
+
26
+ def initialize(code = nil,
27
+ amount = nil)
28
+ @code = code
29
+ @amount = amount
30
+ end
31
+
32
+ # Creates an instance of the object from a hash.
33
+ def self.from_hash(hash)
34
+ return nil unless hash
35
+
36
+ # Extract variables from the hash.
37
+ code = hash['code']
38
+ amount = hash['amount']
39
+
40
+ # Create object from extracted values.
41
+ CreateCaptureChargeRequest.new(code,
42
+ amount)
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,36 @@
1
+ # This file was automatically generated by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MundiApi
5
+ # Options for creating the card
6
+ class CreateCardOptionsRequest < BaseModel
7
+ # Indicates if the card should be verified before creation. If true,
8
+ # executes an authorization before saving the card.
9
+ # @return [Boolean]
10
+ attr_accessor :verify_card
11
+
12
+ # A mapping from model property names to API property names.
13
+ def self.names
14
+ if @_hash.nil?
15
+ @_hash = {}
16
+ @_hash['verify_card'] = 'verify_card'
17
+ end
18
+ @_hash
19
+ end
20
+
21
+ def initialize(verify_card = nil)
22
+ @verify_card = verify_card
23
+ end
24
+
25
+ # Creates an instance of the object from a hash.
26
+ def self.from_hash(hash)
27
+ return nil unless hash
28
+
29
+ # Extract variables from the hash.
30
+ verify_card = hash['verify_card']
31
+
32
+ # Create object from extracted values.
33
+ CreateCardOptionsRequest.new(verify_card)
34
+ end
35
+ end
36
+ end