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.
- checksums.yaml +7 -0
- data/LICENSE +28 -0
- data/README.md +2186 -0
- data/lib/mundi_api.rb +137 -0
- data/lib/mundi_api/api_helper.rb +209 -0
- data/lib/mundi_api/configuration.rb +25 -0
- data/lib/mundi_api/controllers/base_controller.rb +61 -0
- data/lib/mundi_api/controllers/charges_controller.rb +359 -0
- data/lib/mundi_api/controllers/customers_controller.rb +758 -0
- data/lib/mundi_api/controllers/invoices_controller.rb +184 -0
- data/lib/mundi_api/controllers/orders_controller.rb +171 -0
- data/lib/mundi_api/controllers/plans_controller.rb +387 -0
- data/lib/mundi_api/controllers/subscriptions_controller.rb +648 -0
- data/lib/mundi_api/controllers/tokens_controller.rb +87 -0
- data/lib/mundi_api/exceptions/api_exception.rb +18 -0
- data/lib/mundi_api/exceptions/error_exception.rb +37 -0
- data/lib/mundi_api/http/auth/basic_auth.rb +20 -0
- data/lib/mundi_api/http/faraday_client.rb +55 -0
- data/lib/mundi_api/http/http_call_back.rb +22 -0
- data/lib/mundi_api/http/http_client.rb +92 -0
- data/lib/mundi_api/http/http_context.rb +18 -0
- data/lib/mundi_api/http/http_method_enum.rb +11 -0
- data/lib/mundi_api/http/http_request.rb +48 -0
- data/lib/mundi_api/http/http_response.rb +21 -0
- data/lib/mundi_api/models/base_model.rb +34 -0
- data/lib/mundi_api/models/create_access_token_request.rb +35 -0
- data/lib/mundi_api/models/create_address_request.rb +108 -0
- data/lib/mundi_api/models/create_bank_transfer_payment_request.rb +44 -0
- data/lib/mundi_api/models/create_boleto_payment_request.rb +83 -0
- data/lib/mundi_api/models/create_cancel_charge_request.rb +35 -0
- data/lib/mundi_api/models/create_cancel_subscription_request.rb +35 -0
- data/lib/mundi_api/models/create_capture_charge_request.rb +45 -0
- data/lib/mundi_api/models/create_card_options_request.rb +36 -0
- data/lib/mundi_api/models/create_card_request.rb +136 -0
- data/lib/mundi_api/models/create_card_token_request.rb +80 -0
- data/lib/mundi_api/models/create_charge_request.rb +92 -0
- data/lib/mundi_api/models/create_checkout_boleto_payment_request.rb +54 -0
- data/lib/mundi_api/models/create_checkout_card_installment_option_request.rb +44 -0
- data/lib/mundi_api/models/create_checkout_card_payment_request.rb +51 -0
- data/lib/mundi_api/models/create_checkout_payment_request.rb +82 -0
- data/lib/mundi_api/models/create_credit_card_payment_request.rb +108 -0
- data/lib/mundi_api/models/create_customer_request.rb +108 -0
- data/lib/mundi_api/models/create_discount_request.rb +62 -0
- data/lib/mundi_api/models/create_order_item_request.rb +71 -0
- data/lib/mundi_api/models/create_order_request.rb +114 -0
- data/lib/mundi_api/models/create_payment_request.rb +121 -0
- data/lib/mundi_api/models/create_phone_request.rb +53 -0
- data/lib/mundi_api/models/create_phones_request.rb +46 -0
- data/lib/mundi_api/models/create_plan_item_request.rb +81 -0
- data/lib/mundi_api/models/create_plan_request.rb +199 -0
- data/lib/mundi_api/models/create_price_bracket_request.rb +62 -0
- data/lib/mundi_api/models/create_pricing_scheme_request.rb +69 -0
- data/lib/mundi_api/models/create_seller_request.rb +90 -0
- data/lib/mundi_api/models/create_setup_request.rb +55 -0
- data/lib/mundi_api/models/create_shipping_request.rb +81 -0
- data/lib/mundi_api/models/create_subscription_item_request.rb +106 -0
- data/lib/mundi_api/models/create_subscription_request.rb +269 -0
- data/lib/mundi_api/models/create_token_request.rb +44 -0
- data/lib/mundi_api/models/create_usage_request.rb +54 -0
- data/lib/mundi_api/models/create_voucher_payment_request.rb +72 -0
- data/lib/mundi_api/models/get_access_token_response.rb +73 -0
- data/lib/mundi_api/models/get_address_response.rb +163 -0
- data/lib/mundi_api/models/get_bank_transfer_transaction_response.rb +118 -0
- data/lib/mundi_api/models/get_billing_address_response.rb +98 -0
- data/lib/mundi_api/models/get_boleto_transaction_response.rb +137 -0
- data/lib/mundi_api/models/get_card_response.rb +164 -0
- data/lib/mundi_api/models/get_card_token_response.rb +89 -0
- data/lib/mundi_api/models/get_charge_response.rb +184 -0
- data/lib/mundi_api/models/get_checkout_payment_settings_response.rb +99 -0
- data/lib/mundi_api/models/get_credit_card_transaction_response.rb +163 -0
- data/lib/mundi_api/models/get_customer_response.rb +145 -0
- data/lib/mundi_api/models/get_discount_response.rb +100 -0
- data/lib/mundi_api/models/get_invoice_item_response.rb +73 -0
- data/lib/mundi_api/models/get_invoice_response.rb +210 -0
- data/lib/mundi_api/models/get_order_item_response.rb +63 -0
- data/lib/mundi_api/models/get_order_response.rb +167 -0
- data/lib/mundi_api/models/get_period_response.rb +73 -0
- data/lib/mundi_api/models/get_phone_response.rb +53 -0
- data/lib/mundi_api/models/get_phones_response.rb +46 -0
- data/lib/mundi_api/models/get_plan_item_response.rb +127 -0
- data/lib/mundi_api/models/get_plan_response.rb +223 -0
- data/lib/mundi_api/models/get_price_bracket_response.rb +62 -0
- data/lib/mundi_api/models/get_pricing_scheme_response.rb +69 -0
- data/lib/mundi_api/models/get_safety_pay_transaction_response.rb +109 -0
- data/lib/mundi_api/models/get_seller_response.rb +126 -0
- data/lib/mundi_api/models/get_setup_response.rb +62 -0
- data/lib/mundi_api/models/get_shipping_response.rb +72 -0
- data/lib/mundi_api/models/get_subscription_item_response.rb +135 -0
- data/lib/mundi_api/models/get_subscription_response.rb +261 -0
- data/lib/mundi_api/models/get_token_response.rb +72 -0
- data/lib/mundi_api/models/get_transaction_response.rb +136 -0
- data/lib/mundi_api/models/get_usage_response.rb +82 -0
- data/lib/mundi_api/models/get_voucher_transaction_response.rb +163 -0
- data/lib/mundi_api/models/list_access_tokens_response.rb +51 -0
- data/lib/mundi_api/models/list_addresses_response.rb +51 -0
- data/lib/mundi_api/models/list_cards_response.rb +51 -0
- data/lib/mundi_api/models/list_charges_response.rb +51 -0
- data/lib/mundi_api/models/list_customers_response.rb +51 -0
- data/lib/mundi_api/models/list_invoices_response.rb +51 -0
- data/lib/mundi_api/models/list_order_response.rb +51 -0
- data/lib/mundi_api/models/list_plans_response.rb +51 -0
- data/lib/mundi_api/models/list_subscription_items_response.rb +51 -0
- data/lib/mundi_api/models/list_subscriptions_response.rb +51 -0
- data/lib/mundi_api/models/list_transactions_response.rb +51 -0
- data/lib/mundi_api/models/list_usages_response.rb +51 -0
- data/lib/mundi_api/models/paging_response.rb +53 -0
- data/lib/mundi_api/models/update_address_request.rb +53 -0
- data/lib/mundi_api/models/update_card_request.rb +81 -0
- data/lib/mundi_api/models/update_charge_card_request.rb +62 -0
- data/lib/mundi_api/models/update_charge_due_date_request.rb +36 -0
- data/lib/mundi_api/models/update_charge_payment_method_request.rb +74 -0
- data/lib/mundi_api/models/update_customer_request.rb +90 -0
- data/lib/mundi_api/models/update_metadata_request.rb +35 -0
- data/lib/mundi_api/models/update_plan_item_request.rb +81 -0
- data/lib/mundi_api/models/update_plan_request.rb +161 -0
- data/lib/mundi_api/models/update_price_bracket_request.rb +62 -0
- data/lib/mundi_api/models/update_pricing_scheme_request.rb +69 -0
- data/lib/mundi_api/models/update_subscription_billing_date_request.rb +37 -0
- data/lib/mundi_api/models/update_subscription_card_request.rb +44 -0
- data/lib/mundi_api/models/update_subscription_item_request.rb +81 -0
- data/lib/mundi_api/models/update_subscription_payment_method_request.rb +53 -0
- data/lib/mundi_api/mundi_api_client.rb +63 -0
- metadata +246 -0
@@ -0,0 +1,121 @@
|
|
1
|
+
# This file was automatically generated by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
3
|
+
|
4
|
+
module MundiApi
|
5
|
+
# Payment data
|
6
|
+
class CreatePaymentRequest < BaseModel
|
7
|
+
# Payment method
|
8
|
+
# @return [String]
|
9
|
+
attr_accessor :payment_method
|
10
|
+
|
11
|
+
# Settings for credit card payment
|
12
|
+
# @return [CreateCreditCardPaymentRequest]
|
13
|
+
attr_accessor :credit_card
|
14
|
+
|
15
|
+
# Settings for boleto payment
|
16
|
+
# @return [CreateBoletoPaymentRequest]
|
17
|
+
attr_accessor :boleto
|
18
|
+
|
19
|
+
# Currency. Must be informed using 3 characters
|
20
|
+
# @return [String]
|
21
|
+
attr_accessor :currency
|
22
|
+
|
23
|
+
# Settings for voucher payment
|
24
|
+
# @return [CreateVoucherPaymentRequest]
|
25
|
+
attr_accessor :voucher
|
26
|
+
|
27
|
+
# Metadata
|
28
|
+
# @return [Array<String, String>]
|
29
|
+
attr_accessor :metadata
|
30
|
+
|
31
|
+
# Settings for bank transfer payment
|
32
|
+
# @return [CreateBankTransferPaymentRequest]
|
33
|
+
attr_accessor :bank_transfer
|
34
|
+
|
35
|
+
# Gateway affiliation code
|
36
|
+
# @return [String]
|
37
|
+
attr_accessor :gateway_affiliation_id
|
38
|
+
|
39
|
+
# The amount of the payment, in cents
|
40
|
+
# @return [Integer]
|
41
|
+
attr_accessor :amount
|
42
|
+
|
43
|
+
# Settings for checkout payment
|
44
|
+
# @return [CreateCheckoutPaymentRequest]
|
45
|
+
attr_accessor :checkout
|
46
|
+
|
47
|
+
# A mapping from model property names to API property names.
|
48
|
+
def self.names
|
49
|
+
if @_hash.nil?
|
50
|
+
@_hash = {}
|
51
|
+
@_hash['payment_method'] = 'payment_method'
|
52
|
+
@_hash['credit_card'] = 'credit_card'
|
53
|
+
@_hash['boleto'] = 'boleto'
|
54
|
+
@_hash['currency'] = 'currency'
|
55
|
+
@_hash['voucher'] = 'voucher'
|
56
|
+
@_hash['metadata'] = 'metadata'
|
57
|
+
@_hash['bank_transfer'] = 'bank_transfer'
|
58
|
+
@_hash['gateway_affiliation_id'] = 'gateway_affiliation_id'
|
59
|
+
@_hash['amount'] = 'amount'
|
60
|
+
@_hash['checkout'] = 'checkout'
|
61
|
+
end
|
62
|
+
@_hash
|
63
|
+
end
|
64
|
+
|
65
|
+
def initialize(payment_method = nil,
|
66
|
+
credit_card = nil,
|
67
|
+
boleto = nil,
|
68
|
+
currency = nil,
|
69
|
+
voucher = nil,
|
70
|
+
metadata = nil,
|
71
|
+
bank_transfer = nil,
|
72
|
+
gateway_affiliation_id = nil,
|
73
|
+
amount = nil,
|
74
|
+
checkout = nil)
|
75
|
+
@payment_method = payment_method
|
76
|
+
@credit_card = credit_card
|
77
|
+
@boleto = boleto
|
78
|
+
@currency = currency
|
79
|
+
@voucher = voucher
|
80
|
+
@metadata = metadata
|
81
|
+
@bank_transfer = bank_transfer
|
82
|
+
@gateway_affiliation_id = gateway_affiliation_id
|
83
|
+
@amount = amount
|
84
|
+
@checkout = checkout
|
85
|
+
end
|
86
|
+
|
87
|
+
# Creates an instance of the object from a hash.
|
88
|
+
def self.from_hash(hash)
|
89
|
+
return nil unless hash
|
90
|
+
|
91
|
+
# Extract variables from the hash.
|
92
|
+
payment_method = hash['payment_method']
|
93
|
+
credit_card = CreateCreditCardPaymentRequest.from_hash(hash['credit_card']) if
|
94
|
+
hash['credit_card']
|
95
|
+
boleto = CreateBoletoPaymentRequest.from_hash(hash['boleto']) if
|
96
|
+
hash['boleto']
|
97
|
+
currency = hash['currency']
|
98
|
+
voucher = CreateVoucherPaymentRequest.from_hash(hash['voucher']) if
|
99
|
+
hash['voucher']
|
100
|
+
metadata = hash['metadata']
|
101
|
+
bank_transfer = CreateBankTransferPaymentRequest.from_hash(hash['bank_transfer']) if
|
102
|
+
hash['bank_transfer']
|
103
|
+
gateway_affiliation_id = hash['gateway_affiliation_id']
|
104
|
+
amount = hash['amount']
|
105
|
+
checkout = CreateCheckoutPaymentRequest.from_hash(hash['checkout']) if
|
106
|
+
hash['checkout']
|
107
|
+
|
108
|
+
# Create object from extracted values.
|
109
|
+
CreatePaymentRequest.new(payment_method,
|
110
|
+
credit_card,
|
111
|
+
boleto,
|
112
|
+
currency,
|
113
|
+
voucher,
|
114
|
+
metadata,
|
115
|
+
bank_transfer,
|
116
|
+
gateway_affiliation_id,
|
117
|
+
amount,
|
118
|
+
checkout)
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# This file was automatically generated by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
3
|
+
|
4
|
+
module MundiApi
|
5
|
+
# CreatePhoneRequest Model.
|
6
|
+
class CreatePhoneRequest < BaseModel
|
7
|
+
# TODO: Write general description for this method
|
8
|
+
# @return [String]
|
9
|
+
attr_accessor :country_code
|
10
|
+
|
11
|
+
# TODO: Write general description for this method
|
12
|
+
# @return [String]
|
13
|
+
attr_accessor :number
|
14
|
+
|
15
|
+
# TODO: Write general description for this method
|
16
|
+
# @return [String]
|
17
|
+
attr_accessor :area_code
|
18
|
+
|
19
|
+
# A mapping from model property names to API property names.
|
20
|
+
def self.names
|
21
|
+
if @_hash.nil?
|
22
|
+
@_hash = {}
|
23
|
+
@_hash['country_code'] = 'country_code'
|
24
|
+
@_hash['number'] = 'number'
|
25
|
+
@_hash['area_code'] = 'area_code'
|
26
|
+
end
|
27
|
+
@_hash
|
28
|
+
end
|
29
|
+
|
30
|
+
def initialize(country_code = nil,
|
31
|
+
number = nil,
|
32
|
+
area_code = nil)
|
33
|
+
@country_code = country_code
|
34
|
+
@number = number
|
35
|
+
@area_code = area_code
|
36
|
+
end
|
37
|
+
|
38
|
+
# Creates an instance of the object from a hash.
|
39
|
+
def self.from_hash(hash)
|
40
|
+
return nil unless hash
|
41
|
+
|
42
|
+
# Extract variables from the hash.
|
43
|
+
country_code = hash['country_code']
|
44
|
+
number = hash['number']
|
45
|
+
area_code = hash['area_code']
|
46
|
+
|
47
|
+
# Create object from extracted values.
|
48
|
+
CreatePhoneRequest.new(country_code,
|
49
|
+
number,
|
50
|
+
area_code)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# This file was automatically generated by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
3
|
+
|
4
|
+
module MundiApi
|
5
|
+
# CreatePhonesRequest Model.
|
6
|
+
class CreatePhonesRequest < BaseModel
|
7
|
+
# TODO: Write general description for this method
|
8
|
+
# @return [CreatePhoneRequest]
|
9
|
+
attr_accessor :home_phone
|
10
|
+
|
11
|
+
# TODO: Write general description for this method
|
12
|
+
# @return [CreatePhoneRequest]
|
13
|
+
attr_accessor :mobile_phone
|
14
|
+
|
15
|
+
# A mapping from model property names to API property names.
|
16
|
+
def self.names
|
17
|
+
if @_hash.nil?
|
18
|
+
@_hash = {}
|
19
|
+
@_hash['home_phone'] = 'home_phone'
|
20
|
+
@_hash['mobile_phone'] = 'mobile_phone'
|
21
|
+
end
|
22
|
+
@_hash
|
23
|
+
end
|
24
|
+
|
25
|
+
def initialize(home_phone = nil,
|
26
|
+
mobile_phone = nil)
|
27
|
+
@home_phone = home_phone
|
28
|
+
@mobile_phone = mobile_phone
|
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
|
+
home_phone = CreatePhoneRequest.from_hash(hash['home_phone']) if
|
37
|
+
hash['home_phone']
|
38
|
+
mobile_phone = CreatePhoneRequest.from_hash(hash['mobile_phone']) if
|
39
|
+
hash['mobile_phone']
|
40
|
+
|
41
|
+
# Create object from extracted values.
|
42
|
+
CreatePhonesRequest.new(home_phone,
|
43
|
+
mobile_phone)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
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 creating a plan item
|
6
|
+
class CreatePlanItemRequest < BaseModel
|
7
|
+
# Item name
|
8
|
+
# @return [String]
|
9
|
+
attr_accessor :name
|
10
|
+
|
11
|
+
# Item's pricing scheme
|
12
|
+
# @return [CreatePricingSchemeRequest]
|
13
|
+
attr_accessor :pricing_scheme
|
14
|
+
|
15
|
+
# Item's id
|
16
|
+
# @return [String]
|
17
|
+
attr_accessor :id
|
18
|
+
|
19
|
+
# Item's description
|
20
|
+
# @return [String]
|
21
|
+
attr_accessor :description
|
22
|
+
|
23
|
+
# Number of cycles where the item will be charged
|
24
|
+
# @return [Integer]
|
25
|
+
attr_accessor :cycles
|
26
|
+
|
27
|
+
# Quantity
|
28
|
+
# @return [Integer]
|
29
|
+
attr_accessor :quantity
|
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['pricing_scheme'] = 'pricing_scheme'
|
37
|
+
@_hash['id'] = 'id'
|
38
|
+
@_hash['description'] = 'description'
|
39
|
+
@_hash['cycles'] = 'cycles'
|
40
|
+
@_hash['quantity'] = 'quantity'
|
41
|
+
end
|
42
|
+
@_hash
|
43
|
+
end
|
44
|
+
|
45
|
+
def initialize(name = nil,
|
46
|
+
pricing_scheme = nil,
|
47
|
+
id = nil,
|
48
|
+
description = nil,
|
49
|
+
cycles = nil,
|
50
|
+
quantity = nil)
|
51
|
+
@name = name
|
52
|
+
@pricing_scheme = pricing_scheme
|
53
|
+
@id = id
|
54
|
+
@description = description
|
55
|
+
@cycles = cycles
|
56
|
+
@quantity = quantity
|
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
|
+
pricing_scheme = CreatePricingSchemeRequest.from_hash(hash['pricing_scheme']) if
|
66
|
+
hash['pricing_scheme']
|
67
|
+
id = hash['id']
|
68
|
+
description = hash['description']
|
69
|
+
cycles = hash['cycles']
|
70
|
+
quantity = hash['quantity']
|
71
|
+
|
72
|
+
# Create object from extracted values.
|
73
|
+
CreatePlanItemRequest.new(name,
|
74
|
+
pricing_scheme,
|
75
|
+
id,
|
76
|
+
description,
|
77
|
+
cycles,
|
78
|
+
quantity)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,199 @@
|
|
1
|
+
# This file was automatically generated by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
3
|
+
|
4
|
+
module MundiApi
|
5
|
+
# Request for creating a plan
|
6
|
+
class CreatePlanRequest < BaseModel
|
7
|
+
# Plan's name
|
8
|
+
# @return [String]
|
9
|
+
attr_accessor :name
|
10
|
+
|
11
|
+
# Description
|
12
|
+
# @return [String]
|
13
|
+
attr_accessor :description
|
14
|
+
|
15
|
+
# Text that will be printed on the credit card's statement
|
16
|
+
# @return [String]
|
17
|
+
attr_accessor :statement_descriptor
|
18
|
+
|
19
|
+
# Plan items
|
20
|
+
# @return [List of CreatePlanItemRequest]
|
21
|
+
attr_accessor :items
|
22
|
+
|
23
|
+
# Indicates if the plan is shippable
|
24
|
+
# @return [Boolean]
|
25
|
+
attr_accessor :shippable
|
26
|
+
|
27
|
+
# Allowed payment methods for the plan
|
28
|
+
# @return [List of String]
|
29
|
+
attr_accessor :payment_methods
|
30
|
+
|
31
|
+
# Number of installments
|
32
|
+
# @return [List of Integer]
|
33
|
+
attr_accessor :installments
|
34
|
+
|
35
|
+
# Currency
|
36
|
+
# @return [String]
|
37
|
+
attr_accessor :currency
|
38
|
+
|
39
|
+
# Interval
|
40
|
+
# @return [String]
|
41
|
+
attr_accessor :interval
|
42
|
+
|
43
|
+
# Interval counts between two charges. For instance, if the interval is
|
44
|
+
# 'month' and count is 2, the customer will be charged once every two
|
45
|
+
# months.
|
46
|
+
# @return [Integer]
|
47
|
+
attr_accessor :interval_count
|
48
|
+
|
49
|
+
# Allowed billings days for the subscription, in case the plan type is
|
50
|
+
# 'exact_day'
|
51
|
+
# @return [List of Integer]
|
52
|
+
attr_accessor :billing_days
|
53
|
+
|
54
|
+
# Billing type
|
55
|
+
# @return [String]
|
56
|
+
attr_accessor :billing_type
|
57
|
+
|
58
|
+
# Plan's pricing scheme
|
59
|
+
# @return [CreatePricingSchemeRequest]
|
60
|
+
attr_accessor :pricing_scheme
|
61
|
+
|
62
|
+
# Metadata
|
63
|
+
# @return [Array<String, String>]
|
64
|
+
attr_accessor :metadata
|
65
|
+
|
66
|
+
# Minimum price that will be charged
|
67
|
+
# @return [Integer]
|
68
|
+
attr_accessor :minimum_price
|
69
|
+
|
70
|
+
# Number of cycles
|
71
|
+
# @return [Integer]
|
72
|
+
attr_accessor :cycles
|
73
|
+
|
74
|
+
# Quantity
|
75
|
+
# @return [Integer]
|
76
|
+
attr_accessor :quantity
|
77
|
+
|
78
|
+
# Trial period, where the customer will not be charged.
|
79
|
+
# @return [Integer]
|
80
|
+
attr_accessor :trial_period_days
|
81
|
+
|
82
|
+
# A mapping from model property names to API property names.
|
83
|
+
def self.names
|
84
|
+
if @_hash.nil?
|
85
|
+
@_hash = {}
|
86
|
+
@_hash['name'] = 'name'
|
87
|
+
@_hash['description'] = 'description'
|
88
|
+
@_hash['statement_descriptor'] = 'statement_descriptor'
|
89
|
+
@_hash['items'] = 'items'
|
90
|
+
@_hash['shippable'] = 'shippable'
|
91
|
+
@_hash['payment_methods'] = 'payment_methods'
|
92
|
+
@_hash['installments'] = 'installments'
|
93
|
+
@_hash['currency'] = 'currency'
|
94
|
+
@_hash['interval'] = 'interval'
|
95
|
+
@_hash['interval_count'] = 'interval_count'
|
96
|
+
@_hash['billing_days'] = 'billing_days'
|
97
|
+
@_hash['billing_type'] = 'billing_type'
|
98
|
+
@_hash['pricing_scheme'] = 'pricing_scheme'
|
99
|
+
@_hash['metadata'] = 'metadata'
|
100
|
+
@_hash['minimum_price'] = 'minimum_price'
|
101
|
+
@_hash['cycles'] = 'cycles'
|
102
|
+
@_hash['quantity'] = 'quantity'
|
103
|
+
@_hash['trial_period_days'] = 'trial_period_days'
|
104
|
+
end
|
105
|
+
@_hash
|
106
|
+
end
|
107
|
+
|
108
|
+
def initialize(name = nil,
|
109
|
+
description = nil,
|
110
|
+
statement_descriptor = nil,
|
111
|
+
items = nil,
|
112
|
+
shippable = nil,
|
113
|
+
payment_methods = nil,
|
114
|
+
installments = nil,
|
115
|
+
currency = nil,
|
116
|
+
interval = nil,
|
117
|
+
interval_count = nil,
|
118
|
+
billing_days = nil,
|
119
|
+
billing_type = nil,
|
120
|
+
pricing_scheme = nil,
|
121
|
+
metadata = nil,
|
122
|
+
minimum_price = nil,
|
123
|
+
cycles = nil,
|
124
|
+
quantity = nil,
|
125
|
+
trial_period_days = nil)
|
126
|
+
@name = name
|
127
|
+
@description = description
|
128
|
+
@statement_descriptor = statement_descriptor
|
129
|
+
@items = items
|
130
|
+
@shippable = shippable
|
131
|
+
@payment_methods = payment_methods
|
132
|
+
@installments = installments
|
133
|
+
@currency = currency
|
134
|
+
@interval = interval
|
135
|
+
@interval_count = interval_count
|
136
|
+
@billing_days = billing_days
|
137
|
+
@billing_type = billing_type
|
138
|
+
@pricing_scheme = pricing_scheme
|
139
|
+
@metadata = metadata
|
140
|
+
@minimum_price = minimum_price
|
141
|
+
@cycles = cycles
|
142
|
+
@quantity = quantity
|
143
|
+
@trial_period_days = trial_period_days
|
144
|
+
end
|
145
|
+
|
146
|
+
# Creates an instance of the object from a hash.
|
147
|
+
def self.from_hash(hash)
|
148
|
+
return nil unless hash
|
149
|
+
|
150
|
+
# Extract variables from the hash.
|
151
|
+
name = hash['name']
|
152
|
+
description = hash['description']
|
153
|
+
statement_descriptor = hash['statement_descriptor']
|
154
|
+
# Parameter is an array, so we need to iterate through it
|
155
|
+
items = nil
|
156
|
+
unless hash['items'].nil?
|
157
|
+
items = []
|
158
|
+
hash['items'].each do |structure|
|
159
|
+
items << (CreatePlanItemRequest.from_hash(structure) if structure)
|
160
|
+
end
|
161
|
+
end
|
162
|
+
shippable = hash['shippable']
|
163
|
+
payment_methods = hash['payment_methods']
|
164
|
+
installments = hash['installments']
|
165
|
+
currency = hash['currency']
|
166
|
+
interval = hash['interval']
|
167
|
+
interval_count = hash['interval_count']
|
168
|
+
billing_days = hash['billing_days']
|
169
|
+
billing_type = hash['billing_type']
|
170
|
+
pricing_scheme = CreatePricingSchemeRequest.from_hash(hash['pricing_scheme']) if
|
171
|
+
hash['pricing_scheme']
|
172
|
+
metadata = hash['metadata']
|
173
|
+
minimum_price = hash['minimum_price']
|
174
|
+
cycles = hash['cycles']
|
175
|
+
quantity = hash['quantity']
|
176
|
+
trial_period_days = hash['trial_period_days']
|
177
|
+
|
178
|
+
# Create object from extracted values.
|
179
|
+
CreatePlanRequest.new(name,
|
180
|
+
description,
|
181
|
+
statement_descriptor,
|
182
|
+
items,
|
183
|
+
shippable,
|
184
|
+
payment_methods,
|
185
|
+
installments,
|
186
|
+
currency,
|
187
|
+
interval,
|
188
|
+
interval_count,
|
189
|
+
billing_days,
|
190
|
+
billing_type,
|
191
|
+
pricing_scheme,
|
192
|
+
metadata,
|
193
|
+
minimum_price,
|
194
|
+
cycles,
|
195
|
+
quantity,
|
196
|
+
trial_period_days)
|
197
|
+
end
|
198
|
+
end
|
199
|
+
end
|