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,53 @@
|
|
1
|
+
# This file was automatically generated by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
3
|
+
|
4
|
+
module MundiApi
|
5
|
+
# GetPhoneResponse Model.
|
6
|
+
class GetPhoneResponse < 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
|
+
GetPhoneResponse.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
|
+
# GetPhonesResponse Model.
|
6
|
+
class GetPhonesResponse < BaseModel
|
7
|
+
# TODO: Write general description for this method
|
8
|
+
# @return [GetPhoneResponse]
|
9
|
+
attr_accessor :home_phone
|
10
|
+
|
11
|
+
# TODO: Write general description for this method
|
12
|
+
# @return [GetPhoneResponse]
|
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 = GetPhoneResponse.from_hash(hash['home_phone']) if
|
37
|
+
hash['home_phone']
|
38
|
+
mobile_phone = GetPhoneResponse.from_hash(hash['mobile_phone']) if
|
39
|
+
hash['mobile_phone']
|
40
|
+
|
41
|
+
# Create object from extracted values.
|
42
|
+
GetPhonesResponse.new(home_phone,
|
43
|
+
mobile_phone)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,127 @@
|
|
1
|
+
# This file was automatically generated by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
3
|
+
|
4
|
+
require 'date'
|
5
|
+
module MundiApi
|
6
|
+
# Response object for getting a plan item
|
7
|
+
class GetPlanItemResponse < BaseModel
|
8
|
+
# TODO: Write general description for this method
|
9
|
+
# @return [String]
|
10
|
+
attr_accessor :id
|
11
|
+
|
12
|
+
# TODO: Write general description for this method
|
13
|
+
# @return [String]
|
14
|
+
attr_accessor :name
|
15
|
+
|
16
|
+
# TODO: Write general description for this method
|
17
|
+
# @return [String]
|
18
|
+
attr_accessor :status
|
19
|
+
|
20
|
+
# TODO: Write general description for this method
|
21
|
+
# @return [DateTime]
|
22
|
+
attr_accessor :created_at
|
23
|
+
|
24
|
+
# TODO: Write general description for this method
|
25
|
+
# @return [DateTime]
|
26
|
+
attr_accessor :updated_at
|
27
|
+
|
28
|
+
# TODO: Write general description for this method
|
29
|
+
# @return [GetPricingSchemeResponse]
|
30
|
+
attr_accessor :pricing_scheme
|
31
|
+
|
32
|
+
# TODO: Write general description for this method
|
33
|
+
# @return [String]
|
34
|
+
attr_accessor :description
|
35
|
+
|
36
|
+
# TODO: Write general description for this method
|
37
|
+
# @return [GetPlanResponse]
|
38
|
+
attr_accessor :plan
|
39
|
+
|
40
|
+
# TODO: Write general description for this method
|
41
|
+
# @return [Integer]
|
42
|
+
attr_accessor :quantity
|
43
|
+
|
44
|
+
# TODO: Write general description for this method
|
45
|
+
# @return [Integer]
|
46
|
+
attr_accessor :cycles
|
47
|
+
|
48
|
+
# TODO: Write general description for this method
|
49
|
+
# @return [DateTime]
|
50
|
+
attr_accessor :deleted_at
|
51
|
+
|
52
|
+
# A mapping from model property names to API property names.
|
53
|
+
def self.names
|
54
|
+
if @_hash.nil?
|
55
|
+
@_hash = {}
|
56
|
+
@_hash['id'] = 'id'
|
57
|
+
@_hash['name'] = 'name'
|
58
|
+
@_hash['status'] = 'status'
|
59
|
+
@_hash['created_at'] = 'created_at'
|
60
|
+
@_hash['updated_at'] = 'updated_at'
|
61
|
+
@_hash['pricing_scheme'] = 'pricing_scheme'
|
62
|
+
@_hash['description'] = 'description'
|
63
|
+
@_hash['plan'] = 'plan'
|
64
|
+
@_hash['quantity'] = 'quantity'
|
65
|
+
@_hash['cycles'] = 'cycles'
|
66
|
+
@_hash['deleted_at'] = 'deleted_at'
|
67
|
+
end
|
68
|
+
@_hash
|
69
|
+
end
|
70
|
+
|
71
|
+
def initialize(id = nil,
|
72
|
+
name = nil,
|
73
|
+
status = nil,
|
74
|
+
created_at = nil,
|
75
|
+
updated_at = nil,
|
76
|
+
pricing_scheme = nil,
|
77
|
+
description = nil,
|
78
|
+
plan = nil,
|
79
|
+
quantity = nil,
|
80
|
+
cycles = nil,
|
81
|
+
deleted_at = nil)
|
82
|
+
@id = id
|
83
|
+
@name = name
|
84
|
+
@status = status
|
85
|
+
@created_at = created_at
|
86
|
+
@updated_at = updated_at
|
87
|
+
@pricing_scheme = pricing_scheme
|
88
|
+
@description = description
|
89
|
+
@plan = plan
|
90
|
+
@quantity = quantity
|
91
|
+
@cycles = cycles
|
92
|
+
@deleted_at = deleted_at
|
93
|
+
end
|
94
|
+
|
95
|
+
# Creates an instance of the object from a hash.
|
96
|
+
def self.from_hash(hash)
|
97
|
+
return nil unless hash
|
98
|
+
|
99
|
+
# Extract variables from the hash.
|
100
|
+
id = hash['id']
|
101
|
+
name = hash['name']
|
102
|
+
status = hash['status']
|
103
|
+
created_at = DateTime.rfc3339(hash['created_at']) if hash['created_at']
|
104
|
+
updated_at = DateTime.rfc3339(hash['updated_at']) if hash['updated_at']
|
105
|
+
pricing_scheme = GetPricingSchemeResponse.from_hash(hash['pricing_scheme']) if
|
106
|
+
hash['pricing_scheme']
|
107
|
+
description = hash['description']
|
108
|
+
plan = GetPlanResponse.from_hash(hash['plan']) if hash['plan']
|
109
|
+
quantity = hash['quantity']
|
110
|
+
cycles = hash['cycles']
|
111
|
+
deleted_at = DateTime.rfc3339(hash['deleted_at']) if hash['deleted_at']
|
112
|
+
|
113
|
+
# Create object from extracted values.
|
114
|
+
GetPlanItemResponse.new(id,
|
115
|
+
name,
|
116
|
+
status,
|
117
|
+
created_at,
|
118
|
+
updated_at,
|
119
|
+
pricing_scheme,
|
120
|
+
description,
|
121
|
+
plan,
|
122
|
+
quantity,
|
123
|
+
cycles,
|
124
|
+
deleted_at)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
@@ -0,0 +1,223 @@
|
|
1
|
+
# This file was automatically generated by APIMATIC v2.0
|
2
|
+
# ( https://apimatic.io ).
|
3
|
+
|
4
|
+
require 'date'
|
5
|
+
module MundiApi
|
6
|
+
# Response object for getting a plan
|
7
|
+
class GetPlanResponse < BaseModel
|
8
|
+
# TODO: Write general description for this method
|
9
|
+
# @return [String]
|
10
|
+
attr_accessor :id
|
11
|
+
|
12
|
+
# TODO: Write general description for this method
|
13
|
+
# @return [String]
|
14
|
+
attr_accessor :name
|
15
|
+
|
16
|
+
# TODO: Write general description for this method
|
17
|
+
# @return [String]
|
18
|
+
attr_accessor :description
|
19
|
+
|
20
|
+
# TODO: Write general description for this method
|
21
|
+
# @return [String]
|
22
|
+
attr_accessor :url
|
23
|
+
|
24
|
+
# TODO: Write general description for this method
|
25
|
+
# @return [String]
|
26
|
+
attr_accessor :statement_descriptor
|
27
|
+
|
28
|
+
# TODO: Write general description for this method
|
29
|
+
# @return [String]
|
30
|
+
attr_accessor :interval
|
31
|
+
|
32
|
+
# TODO: Write general description for this method
|
33
|
+
# @return [Integer]
|
34
|
+
attr_accessor :interval_count
|
35
|
+
|
36
|
+
# TODO: Write general description for this method
|
37
|
+
# @return [String]
|
38
|
+
attr_accessor :billing_type
|
39
|
+
|
40
|
+
# TODO: Write general description for this method
|
41
|
+
# @return [List of String]
|
42
|
+
attr_accessor :payment_methods
|
43
|
+
|
44
|
+
# TODO: Write general description for this method
|
45
|
+
# @return [List of Integer]
|
46
|
+
attr_accessor :installments
|
47
|
+
|
48
|
+
# TODO: Write general description for this method
|
49
|
+
# @return [String]
|
50
|
+
attr_accessor :status
|
51
|
+
|
52
|
+
# TODO: Write general description for this method
|
53
|
+
# @return [String]
|
54
|
+
attr_accessor :currency
|
55
|
+
|
56
|
+
# TODO: Write general description for this method
|
57
|
+
# @return [DateTime]
|
58
|
+
attr_accessor :created_at
|
59
|
+
|
60
|
+
# TODO: Write general description for this method
|
61
|
+
# @return [DateTime]
|
62
|
+
attr_accessor :updated_at
|
63
|
+
|
64
|
+
# TODO: Write general description for this method
|
65
|
+
# @return [List of GetPlanItemResponse]
|
66
|
+
attr_accessor :items
|
67
|
+
|
68
|
+
# TODO: Write general description for this method
|
69
|
+
# @return [List of Integer]
|
70
|
+
attr_accessor :billing_days
|
71
|
+
|
72
|
+
# TODO: Write general description for this method
|
73
|
+
# @return [Boolean]
|
74
|
+
attr_accessor :shippable
|
75
|
+
|
76
|
+
# TODO: Write general description for this method
|
77
|
+
# @return [Array<String, String>]
|
78
|
+
attr_accessor :metadata
|
79
|
+
|
80
|
+
# TODO: Write general description for this method
|
81
|
+
# @return [Integer]
|
82
|
+
attr_accessor :trial_period_days
|
83
|
+
|
84
|
+
# TODO: Write general description for this method
|
85
|
+
# @return [Integer]
|
86
|
+
attr_accessor :minimum_price
|
87
|
+
|
88
|
+
# TODO: Write general description for this method
|
89
|
+
# @return [DateTime]
|
90
|
+
attr_accessor :deleted_at
|
91
|
+
|
92
|
+
# A mapping from model property names to API property names.
|
93
|
+
def self.names
|
94
|
+
if @_hash.nil?
|
95
|
+
@_hash = {}
|
96
|
+
@_hash['id'] = 'id'
|
97
|
+
@_hash['name'] = 'name'
|
98
|
+
@_hash['description'] = 'description'
|
99
|
+
@_hash['url'] = 'url'
|
100
|
+
@_hash['statement_descriptor'] = 'statement_descriptor'
|
101
|
+
@_hash['interval'] = 'interval'
|
102
|
+
@_hash['interval_count'] = 'interval_count'
|
103
|
+
@_hash['billing_type'] = 'billing_type'
|
104
|
+
@_hash['payment_methods'] = 'payment_methods'
|
105
|
+
@_hash['installments'] = 'installments'
|
106
|
+
@_hash['status'] = 'status'
|
107
|
+
@_hash['currency'] = 'currency'
|
108
|
+
@_hash['created_at'] = 'created_at'
|
109
|
+
@_hash['updated_at'] = 'updated_at'
|
110
|
+
@_hash['items'] = 'items'
|
111
|
+
@_hash['billing_days'] = 'billing_days'
|
112
|
+
@_hash['shippable'] = 'shippable'
|
113
|
+
@_hash['metadata'] = 'metadata'
|
114
|
+
@_hash['trial_period_days'] = 'trial_period_days'
|
115
|
+
@_hash['minimum_price'] = 'minimum_price'
|
116
|
+
@_hash['deleted_at'] = 'deleted_at'
|
117
|
+
end
|
118
|
+
@_hash
|
119
|
+
end
|
120
|
+
|
121
|
+
def initialize(id = nil,
|
122
|
+
name = nil,
|
123
|
+
description = nil,
|
124
|
+
url = nil,
|
125
|
+
statement_descriptor = nil,
|
126
|
+
interval = nil,
|
127
|
+
interval_count = nil,
|
128
|
+
billing_type = nil,
|
129
|
+
payment_methods = nil,
|
130
|
+
installments = nil,
|
131
|
+
status = nil,
|
132
|
+
currency = nil,
|
133
|
+
created_at = nil,
|
134
|
+
updated_at = nil,
|
135
|
+
items = nil,
|
136
|
+
billing_days = nil,
|
137
|
+
shippable = nil,
|
138
|
+
metadata = nil,
|
139
|
+
trial_period_days = nil,
|
140
|
+
minimum_price = nil,
|
141
|
+
deleted_at = nil)
|
142
|
+
@id = id
|
143
|
+
@name = name
|
144
|
+
@description = description
|
145
|
+
@url = url
|
146
|
+
@statement_descriptor = statement_descriptor
|
147
|
+
@interval = interval
|
148
|
+
@interval_count = interval_count
|
149
|
+
@billing_type = billing_type
|
150
|
+
@payment_methods = payment_methods
|
151
|
+
@installments = installments
|
152
|
+
@status = status
|
153
|
+
@currency = currency
|
154
|
+
@created_at = created_at
|
155
|
+
@updated_at = updated_at
|
156
|
+
@items = items
|
157
|
+
@billing_days = billing_days
|
158
|
+
@shippable = shippable
|
159
|
+
@metadata = metadata
|
160
|
+
@trial_period_days = trial_period_days
|
161
|
+
@minimum_price = minimum_price
|
162
|
+
@deleted_at = deleted_at
|
163
|
+
end
|
164
|
+
|
165
|
+
# Creates an instance of the object from a hash.
|
166
|
+
def self.from_hash(hash)
|
167
|
+
return nil unless hash
|
168
|
+
|
169
|
+
# Extract variables from the hash.
|
170
|
+
id = hash['id']
|
171
|
+
name = hash['name']
|
172
|
+
description = hash['description']
|
173
|
+
url = hash['url']
|
174
|
+
statement_descriptor = hash['statement_descriptor']
|
175
|
+
interval = hash['interval']
|
176
|
+
interval_count = hash['interval_count']
|
177
|
+
billing_type = hash['billing_type']
|
178
|
+
payment_methods = hash['payment_methods']
|
179
|
+
installments = hash['installments']
|
180
|
+
status = hash['status']
|
181
|
+
currency = hash['currency']
|
182
|
+
created_at = DateTime.rfc3339(hash['created_at']) if hash['created_at']
|
183
|
+
updated_at = DateTime.rfc3339(hash['updated_at']) if hash['updated_at']
|
184
|
+
# Parameter is an array, so we need to iterate through it
|
185
|
+
items = nil
|
186
|
+
unless hash['items'].nil?
|
187
|
+
items = []
|
188
|
+
hash['items'].each do |structure|
|
189
|
+
items << (GetPlanItemResponse.from_hash(structure) if structure)
|
190
|
+
end
|
191
|
+
end
|
192
|
+
billing_days = hash['billing_days']
|
193
|
+
shippable = hash['shippable']
|
194
|
+
metadata = hash['metadata']
|
195
|
+
trial_period_days = hash['trial_period_days']
|
196
|
+
minimum_price = hash['minimum_price']
|
197
|
+
deleted_at = DateTime.rfc3339(hash['deleted_at']) if hash['deleted_at']
|
198
|
+
|
199
|
+
# Create object from extracted values.
|
200
|
+
GetPlanResponse.new(id,
|
201
|
+
name,
|
202
|
+
description,
|
203
|
+
url,
|
204
|
+
statement_descriptor,
|
205
|
+
interval,
|
206
|
+
interval_count,
|
207
|
+
billing_type,
|
208
|
+
payment_methods,
|
209
|
+
installments,
|
210
|
+
status,
|
211
|
+
currency,
|
212
|
+
created_at,
|
213
|
+
updated_at,
|
214
|
+
items,
|
215
|
+
billing_days,
|
216
|
+
shippable,
|
217
|
+
metadata,
|
218
|
+
trial_period_days,
|
219
|
+
minimum_price,
|
220
|
+
deleted_at)
|
221
|
+
end
|
222
|
+
end
|
223
|
+
end
|