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,35 @@
1
+ # This file was automatically generated by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MundiApi
5
+ # Request for updating an metadata
6
+ class UpdateMetadataRequest < BaseModel
7
+ # Metadata
8
+ # @return [Array<String, String>]
9
+ attr_accessor :metadata
10
+
11
+ # A mapping from model property names to API property names.
12
+ def self.names
13
+ if @_hash.nil?
14
+ @_hash = {}
15
+ @_hash['metadata'] = 'metadata'
16
+ end
17
+ @_hash
18
+ end
19
+
20
+ def initialize(metadata = nil)
21
+ @metadata = metadata
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
+ metadata = hash['metadata']
30
+
31
+ # Create object from extracted values.
32
+ UpdateMetadataRequest.new(metadata)
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,81 @@
1
+ # This file was automatically generated by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MundiApi
5
+ # Request for updating a plan item
6
+ class UpdatePlanItemRequest < BaseModel
7
+ # Item name
8
+ # @return [String]
9
+ attr_accessor :name
10
+
11
+ # Description
12
+ # @return [String]
13
+ attr_accessor :description
14
+
15
+ # Item status
16
+ # @return [String]
17
+ attr_accessor :status
18
+
19
+ # Pricing scheme
20
+ # @return [UpdatePricingSchemeRequest]
21
+ attr_accessor :pricing_scheme
22
+
23
+ # Quantity
24
+ # @return [Integer]
25
+ attr_accessor :quantity
26
+
27
+ # Number of cycles that the item will be charged
28
+ # @return [Integer]
29
+ attr_accessor :cycles
30
+
31
+ # A mapping from model property names to API property names.
32
+ def self.names
33
+ if @_hash.nil?
34
+ @_hash = {}
35
+ @_hash['name'] = 'name'
36
+ @_hash['description'] = 'description'
37
+ @_hash['status'] = 'status'
38
+ @_hash['pricing_scheme'] = 'pricing_scheme'
39
+ @_hash['quantity'] = 'quantity'
40
+ @_hash['cycles'] = 'cycles'
41
+ end
42
+ @_hash
43
+ end
44
+
45
+ def initialize(name = nil,
46
+ description = nil,
47
+ status = nil,
48
+ pricing_scheme = nil,
49
+ quantity = nil,
50
+ cycles = nil)
51
+ @name = name
52
+ @description = description
53
+ @status = status
54
+ @pricing_scheme = pricing_scheme
55
+ @quantity = quantity
56
+ @cycles = cycles
57
+ end
58
+
59
+ # Creates an instance of the object from a hash.
60
+ def self.from_hash(hash)
61
+ return nil unless hash
62
+
63
+ # Extract variables from the hash.
64
+ name = hash['name']
65
+ description = hash['description']
66
+ status = hash['status']
67
+ pricing_scheme = UpdatePricingSchemeRequest.from_hash(hash['pricing_scheme']) if
68
+ hash['pricing_scheme']
69
+ quantity = hash['quantity']
70
+ cycles = hash['cycles']
71
+
72
+ # Create object from extracted values.
73
+ UpdatePlanItemRequest.new(name,
74
+ description,
75
+ status,
76
+ pricing_scheme,
77
+ quantity,
78
+ cycles)
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,161 @@
1
+ # This file was automatically generated by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MundiApi
5
+ # Request for updating a plan
6
+ class UpdatePlanRequest < BaseModel
7
+ # Plan's name
8
+ # @return [String]
9
+ attr_accessor :name
10
+
11
+ # Description
12
+ # @return [String]
13
+ attr_accessor :description
14
+
15
+ # Number os installments
16
+ # @return [List of Integer]
17
+ attr_accessor :installments
18
+
19
+ # Text that will be shown on the credit card's statement
20
+ # @return [String]
21
+ attr_accessor :statement_descriptor
22
+
23
+ # Currency
24
+ # @return [String]
25
+ attr_accessor :currency
26
+
27
+ # Interval
28
+ # @return [String]
29
+ attr_accessor :interval
30
+
31
+ # Interval count
32
+ # @return [Integer]
33
+ attr_accessor :interval_count
34
+
35
+ # Payment methods accepted by the plan
36
+ # @return [List of String]
37
+ attr_accessor :payment_methods
38
+
39
+ # Billing type
40
+ # @return [String]
41
+ attr_accessor :billing_type
42
+
43
+ # Plan status
44
+ # @return [String]
45
+ attr_accessor :status
46
+
47
+ # Indicates if the plan is shippable
48
+ # @return [Boolean]
49
+ attr_accessor :shippable
50
+
51
+ # Billing days accepted by the plan
52
+ # @return [List of Integer]
53
+ attr_accessor :billing_days
54
+
55
+ # Metadata
56
+ # @return [Array<String, String>]
57
+ attr_accessor :metadata
58
+
59
+ # Minimum price
60
+ # @return [Integer]
61
+ attr_accessor :minimum_price
62
+
63
+ # Number of trial period in days, where the customer will not be charged
64
+ # @return [Integer]
65
+ attr_accessor :trial_period_days
66
+
67
+ # A mapping from model property names to API property names.
68
+ def self.names
69
+ if @_hash.nil?
70
+ @_hash = {}
71
+ @_hash['name'] = 'name'
72
+ @_hash['description'] = 'description'
73
+ @_hash['installments'] = 'installments'
74
+ @_hash['statement_descriptor'] = 'statement_descriptor'
75
+ @_hash['currency'] = 'currency'
76
+ @_hash['interval'] = 'interval'
77
+ @_hash['interval_count'] = 'interval_count'
78
+ @_hash['payment_methods'] = 'payment_methods'
79
+ @_hash['billing_type'] = 'billing_type'
80
+ @_hash['status'] = 'status'
81
+ @_hash['shippable'] = 'shippable'
82
+ @_hash['billing_days'] = 'billing_days'
83
+ @_hash['metadata'] = 'metadata'
84
+ @_hash['minimum_price'] = 'minimum_price'
85
+ @_hash['trial_period_days'] = 'trial_period_days'
86
+ end
87
+ @_hash
88
+ end
89
+
90
+ def initialize(name = nil,
91
+ description = nil,
92
+ installments = nil,
93
+ statement_descriptor = nil,
94
+ currency = nil,
95
+ interval = nil,
96
+ interval_count = nil,
97
+ payment_methods = nil,
98
+ billing_type = nil,
99
+ status = nil,
100
+ shippable = nil,
101
+ billing_days = nil,
102
+ metadata = nil,
103
+ minimum_price = nil,
104
+ trial_period_days = nil)
105
+ @name = name
106
+ @description = description
107
+ @installments = installments
108
+ @statement_descriptor = statement_descriptor
109
+ @currency = currency
110
+ @interval = interval
111
+ @interval_count = interval_count
112
+ @payment_methods = payment_methods
113
+ @billing_type = billing_type
114
+ @status = status
115
+ @shippable = shippable
116
+ @billing_days = billing_days
117
+ @metadata = metadata
118
+ @minimum_price = minimum_price
119
+ @trial_period_days = trial_period_days
120
+ end
121
+
122
+ # Creates an instance of the object from a hash.
123
+ def self.from_hash(hash)
124
+ return nil unless hash
125
+
126
+ # Extract variables from the hash.
127
+ name = hash['name']
128
+ description = hash['description']
129
+ installments = hash['installments']
130
+ statement_descriptor = hash['statement_descriptor']
131
+ currency = hash['currency']
132
+ interval = hash['interval']
133
+ interval_count = hash['interval_count']
134
+ payment_methods = hash['payment_methods']
135
+ billing_type = hash['billing_type']
136
+ status = hash['status']
137
+ shippable = hash['shippable']
138
+ billing_days = hash['billing_days']
139
+ metadata = hash['metadata']
140
+ minimum_price = hash['minimum_price']
141
+ trial_period_days = hash['trial_period_days']
142
+
143
+ # Create object from extracted values.
144
+ UpdatePlanRequest.new(name,
145
+ description,
146
+ installments,
147
+ statement_descriptor,
148
+ currency,
149
+ interval,
150
+ interval_count,
151
+ payment_methods,
152
+ billing_type,
153
+ status,
154
+ shippable,
155
+ billing_days,
156
+ metadata,
157
+ minimum_price,
158
+ trial_period_days)
159
+ end
160
+ end
161
+ end
@@ -0,0 +1,62 @@
1
+ # This file was automatically generated by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MundiApi
5
+ # Request for updating a price bracket
6
+ class UpdatePriceBracketRequest < BaseModel
7
+ # Start quantity of the bracket
8
+ # @return [Integer]
9
+ attr_accessor :start_quantity
10
+
11
+ # Price
12
+ # @return [Integer]
13
+ attr_accessor :price
14
+
15
+ # End quantity of the bracket
16
+ # @return [Integer]
17
+ attr_accessor :end_quantity
18
+
19
+ # Overage price
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
+ UpdatePriceBracketRequest.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
+ # Request for updating a pricing scheme
6
+ class UpdatePricingSchemeRequest < BaseModel
7
+ # Scheme type
8
+ # @return [String]
9
+ attr_accessor :scheme_type
10
+
11
+ # Price brackets
12
+ # @return [List of UpdatePriceBracketRequest]
13
+ attr_accessor :price_brackets
14
+
15
+ # Price
16
+ # @return [Integer]
17
+ attr_accessor :price
18
+
19
+ # Minimum price
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['scheme_type'] = 'scheme_type'
28
+ @_hash['price_brackets'] = 'price_brackets'
29
+ @_hash['price'] = 'price'
30
+ @_hash['minimum_price'] = 'minimum_price'
31
+ end
32
+ @_hash
33
+ end
34
+
35
+ def initialize(scheme_type = nil,
36
+ price_brackets = nil,
37
+ price = nil,
38
+ minimum_price = nil)
39
+ @scheme_type = scheme_type
40
+ @price_brackets = price_brackets
41
+ @price = price
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
+ scheme_type = hash['scheme_type']
51
+ # Parameter is an array, so we need to iterate through it
52
+ price_brackets = nil
53
+ unless hash['price_brackets'].nil?
54
+ price_brackets = []
55
+ hash['price_brackets'].each do |structure|
56
+ price_brackets << (UpdatePriceBracketRequest.from_hash(structure) if structure)
57
+ end
58
+ end
59
+ price = hash['price']
60
+ minimum_price = hash['minimum_price']
61
+
62
+ # Create object from extracted values.
63
+ UpdatePricingSchemeRequest.new(scheme_type,
64
+ price_brackets,
65
+ price,
66
+ minimum_price)
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,37 @@
1
+ # This file was automatically generated by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ require 'date'
5
+ module MundiApi
6
+ # Request for updating the due date from a subscription
7
+ class UpdateSubscriptionBillingDateRequest < BaseModel
8
+ # The date when the next subscription billing must occur
9
+ # @return [DateTime]
10
+ attr_accessor :next_billing_at
11
+
12
+ # A mapping from model property names to API property names.
13
+ def self.names
14
+ if @_hash.nil?
15
+ @_hash = {}
16
+ @_hash['next_billing_at'] = 'next_billing_at'
17
+ end
18
+ @_hash
19
+ end
20
+
21
+ def initialize(next_billing_at = nil)
22
+ @next_billing_at = next_billing_at
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
+ next_billing_at = DateTime.rfc3339(hash['next_billing_at']) if
31
+ hash['next_billing_at']
32
+
33
+ # Create object from extracted values.
34
+ UpdateSubscriptionBillingDateRequest.new(next_billing_at)
35
+ end
36
+ end
37
+ end