processout 2.19.0 → 2.20.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- metadata +4 -67
- data/.gitignore +0 -52
- data/.rspec +0 -2
- data/.travis.yml +0 -5
- data/Dockerfile +0 -7
- data/Gemfile +0 -4
- data/LICENSE.txt +0 -21
- data/Makefile +0 -4
- data/README.md +0 -12
- data/Rakefile +0 -6
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/lib/processout/activity.rb +0 -206
- data/lib/processout/addon.rb +0 -401
- data/lib/processout/alternative_merchant_certificate.rb +0 -94
- data/lib/processout/api_request.rb +0 -295
- data/lib/processout/api_version.rb +0 -92
- data/lib/processout/apple_pay_alternative_merchant_certificates.rb +0 -110
- data/lib/processout/balance.rb +0 -81
- data/lib/processout/balances.rb +0 -111
- data/lib/processout/card.rb +0 -503
- data/lib/processout/card_information.rb +0 -164
- data/lib/processout/coupon.rb +0 -352
- data/lib/processout/customer.rb +0 -755
- data/lib/processout/customer_action.rb +0 -81
- data/lib/processout/discount.rb +0 -360
- data/lib/processout/dunning_action.rb +0 -81
- data/lib/processout/errors/authentication_error.rb +0 -9
- data/lib/processout/errors/generic_error.rb +0 -9
- data/lib/processout/errors/internal_error.rb +0 -9
- data/lib/processout/errors/notfound_error.rb +0 -9
- data/lib/processout/errors/validation_error.rb +0 -9
- data/lib/processout/event.rb +0 -237
- data/lib/processout/gateway.rb +0 -210
- data/lib/processout/gateway_configuration.rb +0 -346
- data/lib/processout/gateway_request.rb +0 -26
- data/lib/processout/invoice.rb +0 -945
- data/lib/processout/invoice_detail.rb +0 -235
- data/lib/processout/invoice_device.rb +0 -92
- data/lib/processout/invoice_external_fraud_tools.rb +0 -70
- data/lib/processout/invoice_risk.rb +0 -81
- data/lib/processout/invoice_shipping.rb +0 -191
- data/lib/processout/invoice_tax.rb +0 -81
- data/lib/processout/networking/request.rb +0 -102
- data/lib/processout/networking/response.rb +0 -67
- data/lib/processout/payment_data_network_authentication.rb +0 -70
- data/lib/processout/payment_data_three_ds_authentication.rb +0 -70
- data/lib/processout/payment_data_three_ds_request.rb +0 -103
- data/lib/processout/payout.rb +0 -379
- data/lib/processout/payout_item.rb +0 -238
- data/lib/processout/plan.rb +0 -368
- data/lib/processout/product.rb +0 -368
- data/lib/processout/project.rb +0 -353
- data/lib/processout/refund.rb +0 -277
- data/lib/processout/subscription.rb +0 -910
- data/lib/processout/three_ds.rb +0 -158
- data/lib/processout/token.rb +0 -493
- data/lib/processout/transaction.rb +0 -905
- data/lib/processout/transaction_operation.rb +0 -418
- data/lib/processout/version.rb +0 -3
- data/lib/processout/webhook.rb +0 -237
- data/lib/processout/webhook_endpoint.rb +0 -149
- data/lib/processout.rb +0 -263
- data/processout.gemspec +0 -26
@@ -1,235 +0,0 @@
|
|
1
|
-
# The content of this file was automatically generated
|
2
|
-
|
3
|
-
require "cgi"
|
4
|
-
require "json"
|
5
|
-
require "processout/networking/request"
|
6
|
-
require "processout/networking/response"
|
7
|
-
|
8
|
-
module ProcessOut
|
9
|
-
class InvoiceDetail
|
10
|
-
|
11
|
-
attr_reader :id
|
12
|
-
attr_reader :name
|
13
|
-
attr_reader :type
|
14
|
-
attr_reader :amount
|
15
|
-
attr_reader :quantity
|
16
|
-
attr_reader :metadata
|
17
|
-
attr_reader :reference
|
18
|
-
attr_reader :description
|
19
|
-
attr_reader :brand
|
20
|
-
attr_reader :model
|
21
|
-
attr_reader :discount_amount
|
22
|
-
attr_reader :condition
|
23
|
-
attr_reader :marketplace_merchant
|
24
|
-
attr_reader :marketplace_merchant_is_business
|
25
|
-
attr_reader :marketplace_merchant_created_at
|
26
|
-
attr_reader :category
|
27
|
-
|
28
|
-
|
29
|
-
def id=(val)
|
30
|
-
@id = val
|
31
|
-
end
|
32
|
-
|
33
|
-
def name=(val)
|
34
|
-
@name = val
|
35
|
-
end
|
36
|
-
|
37
|
-
def type=(val)
|
38
|
-
@type = val
|
39
|
-
end
|
40
|
-
|
41
|
-
def amount=(val)
|
42
|
-
@amount = val
|
43
|
-
end
|
44
|
-
|
45
|
-
def quantity=(val)
|
46
|
-
@quantity = val
|
47
|
-
end
|
48
|
-
|
49
|
-
def metadata=(val)
|
50
|
-
@metadata = val
|
51
|
-
end
|
52
|
-
|
53
|
-
def reference=(val)
|
54
|
-
@reference = val
|
55
|
-
end
|
56
|
-
|
57
|
-
def description=(val)
|
58
|
-
@description = val
|
59
|
-
end
|
60
|
-
|
61
|
-
def brand=(val)
|
62
|
-
@brand = val
|
63
|
-
end
|
64
|
-
|
65
|
-
def model=(val)
|
66
|
-
@model = val
|
67
|
-
end
|
68
|
-
|
69
|
-
def discount_amount=(val)
|
70
|
-
@discount_amount = val
|
71
|
-
end
|
72
|
-
|
73
|
-
def condition=(val)
|
74
|
-
@condition = val
|
75
|
-
end
|
76
|
-
|
77
|
-
def marketplace_merchant=(val)
|
78
|
-
@marketplace_merchant = val
|
79
|
-
end
|
80
|
-
|
81
|
-
def marketplace_merchant_is_business=(val)
|
82
|
-
@marketplace_merchant_is_business = val
|
83
|
-
end
|
84
|
-
|
85
|
-
def marketplace_merchant_created_at=(val)
|
86
|
-
@marketplace_merchant_created_at = val
|
87
|
-
end
|
88
|
-
|
89
|
-
def category=(val)
|
90
|
-
@category = val
|
91
|
-
end
|
92
|
-
|
93
|
-
|
94
|
-
# Initializes the InvoiceDetail object
|
95
|
-
# Params:
|
96
|
-
# +client+:: +ProcessOut+ client instance
|
97
|
-
# +data+:: data that can be used to fill the object
|
98
|
-
def initialize(client, data = {})
|
99
|
-
@client = client
|
100
|
-
|
101
|
-
self.id = data.fetch(:id, nil)
|
102
|
-
self.name = data.fetch(:name, nil)
|
103
|
-
self.type = data.fetch(:type, nil)
|
104
|
-
self.amount = data.fetch(:amount, nil)
|
105
|
-
self.quantity = data.fetch(:quantity, nil)
|
106
|
-
self.metadata = data.fetch(:metadata, nil)
|
107
|
-
self.reference = data.fetch(:reference, nil)
|
108
|
-
self.description = data.fetch(:description, nil)
|
109
|
-
self.brand = data.fetch(:brand, nil)
|
110
|
-
self.model = data.fetch(:model, nil)
|
111
|
-
self.discount_amount = data.fetch(:discount_amount, nil)
|
112
|
-
self.condition = data.fetch(:condition, nil)
|
113
|
-
self.marketplace_merchant = data.fetch(:marketplace_merchant, nil)
|
114
|
-
self.marketplace_merchant_is_business = data.fetch(:marketplace_merchant_is_business, nil)
|
115
|
-
self.marketplace_merchant_created_at = data.fetch(:marketplace_merchant_created_at, nil)
|
116
|
-
self.category = data.fetch(:category, nil)
|
117
|
-
|
118
|
-
end
|
119
|
-
|
120
|
-
# Create a new InvoiceDetail using the current client
|
121
|
-
def new(data = {})
|
122
|
-
InvoiceDetail.new(@client, data)
|
123
|
-
end
|
124
|
-
|
125
|
-
# Overrides the JSON marshaller to only send the fields we want
|
126
|
-
def to_json(options)
|
127
|
-
{
|
128
|
-
"id": self.id,
|
129
|
-
"name": self.name,
|
130
|
-
"type": self.type,
|
131
|
-
"amount": self.amount,
|
132
|
-
"quantity": self.quantity,
|
133
|
-
"metadata": self.metadata,
|
134
|
-
"reference": self.reference,
|
135
|
-
"description": self.description,
|
136
|
-
"brand": self.brand,
|
137
|
-
"model": self.model,
|
138
|
-
"discount_amount": self.discount_amount,
|
139
|
-
"condition": self.condition,
|
140
|
-
"marketplace_merchant": self.marketplace_merchant,
|
141
|
-
"marketplace_merchant_is_business": self.marketplace_merchant_is_business,
|
142
|
-
"marketplace_merchant_created_at": self.marketplace_merchant_created_at,
|
143
|
-
"category": self.category,
|
144
|
-
}.to_json
|
145
|
-
end
|
146
|
-
|
147
|
-
# Fills the object with data coming from the API
|
148
|
-
# Params:
|
149
|
-
# +data+:: +Hash+ of data coming from the API
|
150
|
-
def fill_with_data(data)
|
151
|
-
if data.nil?
|
152
|
-
return self
|
153
|
-
end
|
154
|
-
if data.include? "id"
|
155
|
-
self.id = data["id"]
|
156
|
-
end
|
157
|
-
if data.include? "name"
|
158
|
-
self.name = data["name"]
|
159
|
-
end
|
160
|
-
if data.include? "type"
|
161
|
-
self.type = data["type"]
|
162
|
-
end
|
163
|
-
if data.include? "amount"
|
164
|
-
self.amount = data["amount"]
|
165
|
-
end
|
166
|
-
if data.include? "quantity"
|
167
|
-
self.quantity = data["quantity"]
|
168
|
-
end
|
169
|
-
if data.include? "metadata"
|
170
|
-
self.metadata = data["metadata"]
|
171
|
-
end
|
172
|
-
if data.include? "reference"
|
173
|
-
self.reference = data["reference"]
|
174
|
-
end
|
175
|
-
if data.include? "description"
|
176
|
-
self.description = data["description"]
|
177
|
-
end
|
178
|
-
if data.include? "brand"
|
179
|
-
self.brand = data["brand"]
|
180
|
-
end
|
181
|
-
if data.include? "model"
|
182
|
-
self.model = data["model"]
|
183
|
-
end
|
184
|
-
if data.include? "discount_amount"
|
185
|
-
self.discount_amount = data["discount_amount"]
|
186
|
-
end
|
187
|
-
if data.include? "condition"
|
188
|
-
self.condition = data["condition"]
|
189
|
-
end
|
190
|
-
if data.include? "marketplace_merchant"
|
191
|
-
self.marketplace_merchant = data["marketplace_merchant"]
|
192
|
-
end
|
193
|
-
if data.include? "marketplace_merchant_is_business"
|
194
|
-
self.marketplace_merchant_is_business = data["marketplace_merchant_is_business"]
|
195
|
-
end
|
196
|
-
if data.include? "marketplace_merchant_created_at"
|
197
|
-
self.marketplace_merchant_created_at = data["marketplace_merchant_created_at"]
|
198
|
-
end
|
199
|
-
if data.include? "category"
|
200
|
-
self.category = data["category"]
|
201
|
-
end
|
202
|
-
|
203
|
-
self
|
204
|
-
end
|
205
|
-
|
206
|
-
# Prefills the object with the data passed as parameters
|
207
|
-
# Params:
|
208
|
-
# +data+:: +Hash+ of data
|
209
|
-
def prefill(data)
|
210
|
-
if data.nil?
|
211
|
-
return self
|
212
|
-
end
|
213
|
-
self.id = data.fetch(:id, self.id)
|
214
|
-
self.name = data.fetch(:name, self.name)
|
215
|
-
self.type = data.fetch(:type, self.type)
|
216
|
-
self.amount = data.fetch(:amount, self.amount)
|
217
|
-
self.quantity = data.fetch(:quantity, self.quantity)
|
218
|
-
self.metadata = data.fetch(:metadata, self.metadata)
|
219
|
-
self.reference = data.fetch(:reference, self.reference)
|
220
|
-
self.description = data.fetch(:description, self.description)
|
221
|
-
self.brand = data.fetch(:brand, self.brand)
|
222
|
-
self.model = data.fetch(:model, self.model)
|
223
|
-
self.discount_amount = data.fetch(:discount_amount, self.discount_amount)
|
224
|
-
self.condition = data.fetch(:condition, self.condition)
|
225
|
-
self.marketplace_merchant = data.fetch(:marketplace_merchant, self.marketplace_merchant)
|
226
|
-
self.marketplace_merchant_is_business = data.fetch(:marketplace_merchant_is_business, self.marketplace_merchant_is_business)
|
227
|
-
self.marketplace_merchant_created_at = data.fetch(:marketplace_merchant_created_at, self.marketplace_merchant_created_at)
|
228
|
-
self.category = data.fetch(:category, self.category)
|
229
|
-
|
230
|
-
self
|
231
|
-
end
|
232
|
-
|
233
|
-
|
234
|
-
end
|
235
|
-
end
|
@@ -1,92 +0,0 @@
|
|
1
|
-
# The content of this file was automatically generated
|
2
|
-
|
3
|
-
require "cgi"
|
4
|
-
require "json"
|
5
|
-
require "processout/networking/request"
|
6
|
-
require "processout/networking/response"
|
7
|
-
|
8
|
-
module ProcessOut
|
9
|
-
class InvoiceDevice
|
10
|
-
|
11
|
-
attr_reader :channel
|
12
|
-
attr_reader :ip_address
|
13
|
-
attr_reader :id
|
14
|
-
|
15
|
-
|
16
|
-
def channel=(val)
|
17
|
-
@channel = val
|
18
|
-
end
|
19
|
-
|
20
|
-
def ip_address=(val)
|
21
|
-
@ip_address = val
|
22
|
-
end
|
23
|
-
|
24
|
-
def id=(val)
|
25
|
-
@id = val
|
26
|
-
end
|
27
|
-
|
28
|
-
|
29
|
-
# Initializes the InvoiceDevice object
|
30
|
-
# Params:
|
31
|
-
# +client+:: +ProcessOut+ client instance
|
32
|
-
# +data+:: data that can be used to fill the object
|
33
|
-
def initialize(client, data = {})
|
34
|
-
@client = client
|
35
|
-
|
36
|
-
self.channel = data.fetch(:channel, nil)
|
37
|
-
self.ip_address = data.fetch(:ip_address, nil)
|
38
|
-
self.id = data.fetch(:id, nil)
|
39
|
-
|
40
|
-
end
|
41
|
-
|
42
|
-
# Create a new InvoiceDevice using the current client
|
43
|
-
def new(data = {})
|
44
|
-
InvoiceDevice.new(@client, data)
|
45
|
-
end
|
46
|
-
|
47
|
-
# Overrides the JSON marshaller to only send the fields we want
|
48
|
-
def to_json(options)
|
49
|
-
{
|
50
|
-
"channel": self.channel,
|
51
|
-
"ip_address": self.ip_address,
|
52
|
-
"id": self.id,
|
53
|
-
}.to_json
|
54
|
-
end
|
55
|
-
|
56
|
-
# Fills the object with data coming from the API
|
57
|
-
# Params:
|
58
|
-
# +data+:: +Hash+ of data coming from the API
|
59
|
-
def fill_with_data(data)
|
60
|
-
if data.nil?
|
61
|
-
return self
|
62
|
-
end
|
63
|
-
if data.include? "channel"
|
64
|
-
self.channel = data["channel"]
|
65
|
-
end
|
66
|
-
if data.include? "ip_address"
|
67
|
-
self.ip_address = data["ip_address"]
|
68
|
-
end
|
69
|
-
if data.include? "id"
|
70
|
-
self.id = data["id"]
|
71
|
-
end
|
72
|
-
|
73
|
-
self
|
74
|
-
end
|
75
|
-
|
76
|
-
# Prefills the object with the data passed as parameters
|
77
|
-
# Params:
|
78
|
-
# +data+:: +Hash+ of data
|
79
|
-
def prefill(data)
|
80
|
-
if data.nil?
|
81
|
-
return self
|
82
|
-
end
|
83
|
-
self.channel = data.fetch(:channel, self.channel)
|
84
|
-
self.ip_address = data.fetch(:ip_address, self.ip_address)
|
85
|
-
self.id = data.fetch(:id, self.id)
|
86
|
-
|
87
|
-
self
|
88
|
-
end
|
89
|
-
|
90
|
-
|
91
|
-
end
|
92
|
-
end
|
@@ -1,70 +0,0 @@
|
|
1
|
-
# The content of this file was automatically generated
|
2
|
-
|
3
|
-
require "cgi"
|
4
|
-
require "json"
|
5
|
-
require "processout/networking/request"
|
6
|
-
require "processout/networking/response"
|
7
|
-
|
8
|
-
module ProcessOut
|
9
|
-
class InvoiceExternalFraudTools
|
10
|
-
|
11
|
-
attr_reader :forter
|
12
|
-
|
13
|
-
|
14
|
-
def forter=(val)
|
15
|
-
@forter = val
|
16
|
-
end
|
17
|
-
|
18
|
-
|
19
|
-
# Initializes the InvoiceExternalFraudTools object
|
20
|
-
# Params:
|
21
|
-
# +client+:: +ProcessOut+ client instance
|
22
|
-
# +data+:: data that can be used to fill the object
|
23
|
-
def initialize(client, data = {})
|
24
|
-
@client = client
|
25
|
-
|
26
|
-
self.forter = data.fetch(:forter, nil)
|
27
|
-
|
28
|
-
end
|
29
|
-
|
30
|
-
# Create a new InvoiceExternalFraudTools using the current client
|
31
|
-
def new(data = {})
|
32
|
-
InvoiceExternalFraudTools.new(@client, data)
|
33
|
-
end
|
34
|
-
|
35
|
-
# Overrides the JSON marshaller to only send the fields we want
|
36
|
-
def to_json(options)
|
37
|
-
{
|
38
|
-
"forter": self.forter,
|
39
|
-
}.to_json
|
40
|
-
end
|
41
|
-
|
42
|
-
# Fills the object with data coming from the API
|
43
|
-
# Params:
|
44
|
-
# +data+:: +Hash+ of data coming from the API
|
45
|
-
def fill_with_data(data)
|
46
|
-
if data.nil?
|
47
|
-
return self
|
48
|
-
end
|
49
|
-
if data.include? "forter"
|
50
|
-
self.forter = data["forter"]
|
51
|
-
end
|
52
|
-
|
53
|
-
self
|
54
|
-
end
|
55
|
-
|
56
|
-
# Prefills the object with the data passed as parameters
|
57
|
-
# Params:
|
58
|
-
# +data+:: +Hash+ of data
|
59
|
-
def prefill(data)
|
60
|
-
if data.nil?
|
61
|
-
return self
|
62
|
-
end
|
63
|
-
self.forter = data.fetch(:forter, self.forter)
|
64
|
-
|
65
|
-
self
|
66
|
-
end
|
67
|
-
|
68
|
-
|
69
|
-
end
|
70
|
-
end
|
@@ -1,81 +0,0 @@
|
|
1
|
-
# The content of this file was automatically generated
|
2
|
-
|
3
|
-
require "cgi"
|
4
|
-
require "json"
|
5
|
-
require "processout/networking/request"
|
6
|
-
require "processout/networking/response"
|
7
|
-
|
8
|
-
module ProcessOut
|
9
|
-
class InvoiceRisk
|
10
|
-
|
11
|
-
attr_reader :score
|
12
|
-
attr_reader :is_legit
|
13
|
-
|
14
|
-
|
15
|
-
def score=(val)
|
16
|
-
@score = val
|
17
|
-
end
|
18
|
-
|
19
|
-
def is_legit=(val)
|
20
|
-
@is_legit = val
|
21
|
-
end
|
22
|
-
|
23
|
-
|
24
|
-
# Initializes the InvoiceRisk object
|
25
|
-
# Params:
|
26
|
-
# +client+:: +ProcessOut+ client instance
|
27
|
-
# +data+:: data that can be used to fill the object
|
28
|
-
def initialize(client, data = {})
|
29
|
-
@client = client
|
30
|
-
|
31
|
-
self.score = data.fetch(:score, nil)
|
32
|
-
self.is_legit = data.fetch(:is_legit, nil)
|
33
|
-
|
34
|
-
end
|
35
|
-
|
36
|
-
# Create a new InvoiceRisk using the current client
|
37
|
-
def new(data = {})
|
38
|
-
InvoiceRisk.new(@client, data)
|
39
|
-
end
|
40
|
-
|
41
|
-
# Overrides the JSON marshaller to only send the fields we want
|
42
|
-
def to_json(options)
|
43
|
-
{
|
44
|
-
"score": self.score,
|
45
|
-
"is_legit": self.is_legit,
|
46
|
-
}.to_json
|
47
|
-
end
|
48
|
-
|
49
|
-
# Fills the object with data coming from the API
|
50
|
-
# Params:
|
51
|
-
# +data+:: +Hash+ of data coming from the API
|
52
|
-
def fill_with_data(data)
|
53
|
-
if data.nil?
|
54
|
-
return self
|
55
|
-
end
|
56
|
-
if data.include? "score"
|
57
|
-
self.score = data["score"]
|
58
|
-
end
|
59
|
-
if data.include? "is_legit"
|
60
|
-
self.is_legit = data["is_legit"]
|
61
|
-
end
|
62
|
-
|
63
|
-
self
|
64
|
-
end
|
65
|
-
|
66
|
-
# Prefills the object with the data passed as parameters
|
67
|
-
# Params:
|
68
|
-
# +data+:: +Hash+ of data
|
69
|
-
def prefill(data)
|
70
|
-
if data.nil?
|
71
|
-
return self
|
72
|
-
end
|
73
|
-
self.score = data.fetch(:score, self.score)
|
74
|
-
self.is_legit = data.fetch(:is_legit, self.is_legit)
|
75
|
-
|
76
|
-
self
|
77
|
-
end
|
78
|
-
|
79
|
-
|
80
|
-
end
|
81
|
-
end
|
@@ -1,191 +0,0 @@
|
|
1
|
-
# The content of this file was automatically generated
|
2
|
-
|
3
|
-
require "cgi"
|
4
|
-
require "json"
|
5
|
-
require "processout/networking/request"
|
6
|
-
require "processout/networking/response"
|
7
|
-
|
8
|
-
module ProcessOut
|
9
|
-
class InvoiceShipping
|
10
|
-
|
11
|
-
attr_reader :amount
|
12
|
-
attr_reader :method
|
13
|
-
attr_reader :provider
|
14
|
-
attr_reader :delay
|
15
|
-
attr_reader :address1
|
16
|
-
attr_reader :address2
|
17
|
-
attr_reader :city
|
18
|
-
attr_reader :state
|
19
|
-
attr_reader :country_code
|
20
|
-
attr_reader :zip
|
21
|
-
attr_reader :phone_number
|
22
|
-
attr_reader :expects_shipping_at
|
23
|
-
|
24
|
-
|
25
|
-
def amount=(val)
|
26
|
-
@amount = val
|
27
|
-
end
|
28
|
-
|
29
|
-
def method=(val)
|
30
|
-
@method = val
|
31
|
-
end
|
32
|
-
|
33
|
-
def provider=(val)
|
34
|
-
@provider = val
|
35
|
-
end
|
36
|
-
|
37
|
-
def delay=(val)
|
38
|
-
@delay = val
|
39
|
-
end
|
40
|
-
|
41
|
-
def address1=(val)
|
42
|
-
@address1 = val
|
43
|
-
end
|
44
|
-
|
45
|
-
def address2=(val)
|
46
|
-
@address2 = val
|
47
|
-
end
|
48
|
-
|
49
|
-
def city=(val)
|
50
|
-
@city = val
|
51
|
-
end
|
52
|
-
|
53
|
-
def state=(val)
|
54
|
-
@state = val
|
55
|
-
end
|
56
|
-
|
57
|
-
def country_code=(val)
|
58
|
-
@country_code = val
|
59
|
-
end
|
60
|
-
|
61
|
-
def zip=(val)
|
62
|
-
@zip = val
|
63
|
-
end
|
64
|
-
|
65
|
-
def phone_number=(val)
|
66
|
-
@phone_number = val
|
67
|
-
end
|
68
|
-
|
69
|
-
def expects_shipping_at=(val)
|
70
|
-
@expects_shipping_at = val
|
71
|
-
end
|
72
|
-
|
73
|
-
|
74
|
-
# Initializes the InvoiceShipping object
|
75
|
-
# Params:
|
76
|
-
# +client+:: +ProcessOut+ client instance
|
77
|
-
# +data+:: data that can be used to fill the object
|
78
|
-
def initialize(client, data = {})
|
79
|
-
@client = client
|
80
|
-
|
81
|
-
self.amount = data.fetch(:amount, nil)
|
82
|
-
self.method = data.fetch(:method, nil)
|
83
|
-
self.provider = data.fetch(:provider, nil)
|
84
|
-
self.delay = data.fetch(:delay, nil)
|
85
|
-
self.address1 = data.fetch(:address1, nil)
|
86
|
-
self.address2 = data.fetch(:address2, nil)
|
87
|
-
self.city = data.fetch(:city, nil)
|
88
|
-
self.state = data.fetch(:state, nil)
|
89
|
-
self.country_code = data.fetch(:country_code, nil)
|
90
|
-
self.zip = data.fetch(:zip, nil)
|
91
|
-
self.phone_number = data.fetch(:phone_number, nil)
|
92
|
-
self.expects_shipping_at = data.fetch(:expects_shipping_at, nil)
|
93
|
-
|
94
|
-
end
|
95
|
-
|
96
|
-
# Create a new InvoiceShipping using the current client
|
97
|
-
def new(data = {})
|
98
|
-
InvoiceShipping.new(@client, data)
|
99
|
-
end
|
100
|
-
|
101
|
-
# Overrides the JSON marshaller to only send the fields we want
|
102
|
-
def to_json(options)
|
103
|
-
{
|
104
|
-
"amount": self.amount,
|
105
|
-
"method": self.method,
|
106
|
-
"provider": self.provider,
|
107
|
-
"delay": self.delay,
|
108
|
-
"address1": self.address1,
|
109
|
-
"address2": self.address2,
|
110
|
-
"city": self.city,
|
111
|
-
"state": self.state,
|
112
|
-
"country_code": self.country_code,
|
113
|
-
"zip": self.zip,
|
114
|
-
"phone_number": self.phone_number,
|
115
|
-
"expects_shipping_at": self.expects_shipping_at,
|
116
|
-
}.to_json
|
117
|
-
end
|
118
|
-
|
119
|
-
# Fills the object with data coming from the API
|
120
|
-
# Params:
|
121
|
-
# +data+:: +Hash+ of data coming from the API
|
122
|
-
def fill_with_data(data)
|
123
|
-
if data.nil?
|
124
|
-
return self
|
125
|
-
end
|
126
|
-
if data.include? "amount"
|
127
|
-
self.amount = data["amount"]
|
128
|
-
end
|
129
|
-
if data.include? "method"
|
130
|
-
self.method = data["method"]
|
131
|
-
end
|
132
|
-
if data.include? "provider"
|
133
|
-
self.provider = data["provider"]
|
134
|
-
end
|
135
|
-
if data.include? "delay"
|
136
|
-
self.delay = data["delay"]
|
137
|
-
end
|
138
|
-
if data.include? "address1"
|
139
|
-
self.address1 = data["address1"]
|
140
|
-
end
|
141
|
-
if data.include? "address2"
|
142
|
-
self.address2 = data["address2"]
|
143
|
-
end
|
144
|
-
if data.include? "city"
|
145
|
-
self.city = data["city"]
|
146
|
-
end
|
147
|
-
if data.include? "state"
|
148
|
-
self.state = data["state"]
|
149
|
-
end
|
150
|
-
if data.include? "country_code"
|
151
|
-
self.country_code = data["country_code"]
|
152
|
-
end
|
153
|
-
if data.include? "zip"
|
154
|
-
self.zip = data["zip"]
|
155
|
-
end
|
156
|
-
if data.include? "phone_number"
|
157
|
-
self.phone_number = data["phone_number"]
|
158
|
-
end
|
159
|
-
if data.include? "expects_shipping_at"
|
160
|
-
self.expects_shipping_at = data["expects_shipping_at"]
|
161
|
-
end
|
162
|
-
|
163
|
-
self
|
164
|
-
end
|
165
|
-
|
166
|
-
# Prefills the object with the data passed as parameters
|
167
|
-
# Params:
|
168
|
-
# +data+:: +Hash+ of data
|
169
|
-
def prefill(data)
|
170
|
-
if data.nil?
|
171
|
-
return self
|
172
|
-
end
|
173
|
-
self.amount = data.fetch(:amount, self.amount)
|
174
|
-
self.method = data.fetch(:method, self.method)
|
175
|
-
self.provider = data.fetch(:provider, self.provider)
|
176
|
-
self.delay = data.fetch(:delay, self.delay)
|
177
|
-
self.address1 = data.fetch(:address1, self.address1)
|
178
|
-
self.address2 = data.fetch(:address2, self.address2)
|
179
|
-
self.city = data.fetch(:city, self.city)
|
180
|
-
self.state = data.fetch(:state, self.state)
|
181
|
-
self.country_code = data.fetch(:country_code, self.country_code)
|
182
|
-
self.zip = data.fetch(:zip, self.zip)
|
183
|
-
self.phone_number = data.fetch(:phone_number, self.phone_number)
|
184
|
-
self.expects_shipping_at = data.fetch(:expects_shipping_at, self.expects_shipping_at)
|
185
|
-
|
186
|
-
self
|
187
|
-
end
|
188
|
-
|
189
|
-
|
190
|
-
end
|
191
|
-
end
|