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
+ # Request for creating a price bracket
6
+ class CreatePriceBracketRequest < BaseModel
7
+ # Start quantity
8
+ # @return [Integer]
9
+ attr_accessor :start_quantity
10
+
11
+ # Price
12
+ # @return [Integer]
13
+ attr_accessor :price
14
+
15
+ # End quantity
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
+ CreatePriceBracketRequest.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 creating a pricing scheme
6
+ class CreatePricingSchemeRequest < BaseModel
7
+ # Scheme type
8
+ # @return [String]
9
+ attr_accessor :scheme_type
10
+
11
+ # Price brackets
12
+ # @return [List of CreatePriceBracketRequest]
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 << (CreatePriceBracketRequest.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
+ CreatePricingSchemeRequest.new(scheme_type,
64
+ price_brackets,
65
+ price,
66
+ minimum_price)
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,90 @@
1
+ # This file was automatically generated by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MundiApi
5
+ # CreateSellerRequest Model.
6
+ class CreateSellerRequest < BaseModel
7
+ # Name
8
+ # @return [String]
9
+ attr_accessor :name
10
+
11
+ # Seller's code identification
12
+ # @return [String]
13
+ attr_accessor :code
14
+
15
+ # Description
16
+ # @return [String]
17
+ attr_accessor :description
18
+
19
+ # Document number (individual / company)
20
+ # @return [String]
21
+ attr_accessor :document
22
+
23
+ # Address
24
+ # @return [String]
25
+ attr_accessor :address
26
+
27
+ # Person type (individual / company)
28
+ # @return [String]
29
+ attr_accessor :type
30
+
31
+ # Metadata
32
+ # @return [CreateCardRequest]
33
+ attr_accessor :metadata
34
+
35
+ # A mapping from model property names to API property names.
36
+ def self.names
37
+ if @_hash.nil?
38
+ @_hash = {}
39
+ @_hash['name'] = 'name'
40
+ @_hash['code'] = 'code'
41
+ @_hash['description'] = 'description'
42
+ @_hash['document'] = 'document'
43
+ @_hash['address'] = 'address'
44
+ @_hash['type'] = 'type'
45
+ @_hash['metadata'] = 'metadata'
46
+ end
47
+ @_hash
48
+ end
49
+
50
+ def initialize(name = nil,
51
+ code = nil,
52
+ description = nil,
53
+ document = nil,
54
+ address = nil,
55
+ type = nil,
56
+ metadata = nil)
57
+ @name = name
58
+ @code = code
59
+ @description = description
60
+ @document = document
61
+ @address = address
62
+ @type = type
63
+ @metadata = metadata
64
+ end
65
+
66
+ # Creates an instance of the object from a hash.
67
+ def self.from_hash(hash)
68
+ return nil unless hash
69
+
70
+ # Extract variables from the hash.
71
+ name = hash['name']
72
+ code = hash['code']
73
+ description = hash['description']
74
+ document = hash['document']
75
+ address = hash['address']
76
+ type = hash['type']
77
+ metadata = CreateCardRequest.from_hash(hash['metadata']) if
78
+ hash['metadata']
79
+
80
+ # Create object from extracted values.
81
+ CreateSellerRequest.new(name,
82
+ code,
83
+ description,
84
+ document,
85
+ address,
86
+ type,
87
+ metadata)
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,55 @@
1
+ # This file was automatically generated by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MundiApi
5
+ # Request for creating a Setup for a subscription. The setup is an order that
6
+ # will be created at the subscription creation.
7
+ class CreateSetupRequest < BaseModel
8
+ # Setup amount
9
+ # @return [Integer]
10
+ attr_accessor :amount
11
+
12
+ # Description
13
+ # @return [String]
14
+ attr_accessor :description
15
+
16
+ # Payment data
17
+ # @return [CreatePaymentRequest]
18
+ attr_accessor :payment
19
+
20
+ # A mapping from model property names to API property names.
21
+ def self.names
22
+ if @_hash.nil?
23
+ @_hash = {}
24
+ @_hash['amount'] = 'amount'
25
+ @_hash['description'] = 'description'
26
+ @_hash['payment'] = 'payment'
27
+ end
28
+ @_hash
29
+ end
30
+
31
+ def initialize(amount = nil,
32
+ description = nil,
33
+ payment = nil)
34
+ @amount = amount
35
+ @description = description
36
+ @payment = payment
37
+ end
38
+
39
+ # Creates an instance of the object from a hash.
40
+ def self.from_hash(hash)
41
+ return nil unless hash
42
+
43
+ # Extract variables from the hash.
44
+ amount = hash['amount']
45
+ description = hash['description']
46
+ payment = CreatePaymentRequest.from_hash(hash['payment']) if
47
+ hash['payment']
48
+
49
+ # Create object from extracted values.
50
+ CreateSetupRequest.new(amount,
51
+ description,
52
+ payment)
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,81 @@
1
+ # This file was automatically generated by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MundiApi
5
+ # Shipping data
6
+ class CreateShippingRequest < BaseModel
7
+ # Shipping amount
8
+ # @return [Integer]
9
+ attr_accessor :amount
10
+
11
+ # Description
12
+ # @return [String]
13
+ attr_accessor :description
14
+
15
+ # Recipient name
16
+ # @return [String]
17
+ attr_accessor :recipient_name
18
+
19
+ # Recipient phone number
20
+ # @return [String]
21
+ attr_accessor :recipient_phone
22
+
23
+ # The id of the address that will be used for shipping
24
+ # @return [String]
25
+ attr_accessor :address_id
26
+
27
+ # Address data
28
+ # @return [CreateAddressRequest]
29
+ attr_accessor :address
30
+
31
+ # A mapping from model property names to API property names.
32
+ def self.names
33
+ if @_hash.nil?
34
+ @_hash = {}
35
+ @_hash['amount'] = 'amount'
36
+ @_hash['description'] = 'description'
37
+ @_hash['recipient_name'] = 'recipient_name'
38
+ @_hash['recipient_phone'] = 'recipient_phone'
39
+ @_hash['address_id'] = 'address_id'
40
+ @_hash['address'] = 'address'
41
+ end
42
+ @_hash
43
+ end
44
+
45
+ def initialize(amount = nil,
46
+ description = nil,
47
+ recipient_name = nil,
48
+ recipient_phone = nil,
49
+ address_id = nil,
50
+ address = nil)
51
+ @amount = amount
52
+ @description = description
53
+ @recipient_name = recipient_name
54
+ @recipient_phone = recipient_phone
55
+ @address_id = address_id
56
+ @address = address
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
+ amount = hash['amount']
65
+ description = hash['description']
66
+ recipient_name = hash['recipient_name']
67
+ recipient_phone = hash['recipient_phone']
68
+ address_id = hash['address_id']
69
+ address = CreateAddressRequest.from_hash(hash['address']) if
70
+ hash['address']
71
+
72
+ # Create object from extracted values.
73
+ CreateShippingRequest.new(amount,
74
+ description,
75
+ recipient_name,
76
+ recipient_phone,
77
+ address_id,
78
+ address)
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,106 @@
1
+ # This file was automatically generated by APIMATIC v2.0
2
+ # ( https://apimatic.io ).
3
+
4
+ module MundiApi
5
+ # Request for creating a new subscription item
6
+ class CreateSubscriptionItemRequest < BaseModel
7
+ # Item description
8
+ # @return [String]
9
+ attr_accessor :description
10
+
11
+ # Pricing scheme
12
+ # @return [CreatePricingSchemeRequest]
13
+ attr_accessor :pricing_scheme
14
+
15
+ # Item id
16
+ # @return [String]
17
+ attr_accessor :id
18
+
19
+ # Plan item id
20
+ # @return [String]
21
+ attr_accessor :plan_item_id
22
+
23
+ # Discounts for the item
24
+ # @return [List of CreateDiscountRequest]
25
+ attr_accessor :discounts
26
+
27
+ # Number of cycles which the item will be charged
28
+ # @return [Integer]
29
+ attr_accessor :cycles
30
+
31
+ # Quantity of items
32
+ # @return [Integer]
33
+ attr_accessor :quantity
34
+
35
+ # Minimum price
36
+ # @return [Integer]
37
+ attr_accessor :minimum_price
38
+
39
+ # A mapping from model property names to API property names.
40
+ def self.names
41
+ if @_hash.nil?
42
+ @_hash = {}
43
+ @_hash['description'] = 'description'
44
+ @_hash['pricing_scheme'] = 'pricing_scheme'
45
+ @_hash['id'] = 'id'
46
+ @_hash['plan_item_id'] = 'plan_item_id'
47
+ @_hash['discounts'] = 'discounts'
48
+ @_hash['cycles'] = 'cycles'
49
+ @_hash['quantity'] = 'quantity'
50
+ @_hash['minimum_price'] = 'minimum_price'
51
+ end
52
+ @_hash
53
+ end
54
+
55
+ def initialize(description = nil,
56
+ pricing_scheme = nil,
57
+ id = nil,
58
+ plan_item_id = nil,
59
+ discounts = nil,
60
+ cycles = nil,
61
+ quantity = nil,
62
+ minimum_price = nil)
63
+ @description = description
64
+ @pricing_scheme = pricing_scheme
65
+ @id = id
66
+ @plan_item_id = plan_item_id
67
+ @discounts = discounts
68
+ @cycles = cycles
69
+ @quantity = quantity
70
+ @minimum_price = minimum_price
71
+ end
72
+
73
+ # Creates an instance of the object from a hash.
74
+ def self.from_hash(hash)
75
+ return nil unless hash
76
+
77
+ # Extract variables from the hash.
78
+ description = hash['description']
79
+ pricing_scheme = CreatePricingSchemeRequest.from_hash(hash['pricing_scheme']) if
80
+ hash['pricing_scheme']
81
+ id = hash['id']
82
+ plan_item_id = hash['plan_item_id']
83
+ # Parameter is an array, so we need to iterate through it
84
+ discounts = nil
85
+ unless hash['discounts'].nil?
86
+ discounts = []
87
+ hash['discounts'].each do |structure|
88
+ discounts << (CreateDiscountRequest.from_hash(structure) if structure)
89
+ end
90
+ end
91
+ cycles = hash['cycles']
92
+ quantity = hash['quantity']
93
+ minimum_price = hash['minimum_price']
94
+
95
+ # Create object from extracted values.
96
+ CreateSubscriptionItemRequest.new(description,
97
+ pricing_scheme,
98
+ id,
99
+ plan_item_id,
100
+ discounts,
101
+ cycles,
102
+ quantity,
103
+ minimum_price)
104
+ end
105
+ end
106
+ end