beanie 0.1.4 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile +4 -0
- data/README.md +79 -16
- data/Rakefile +8 -1
- data/beanie.gemspec +44 -25
- data/docs/BankAccount.md +24 -0
- data/docs/BankAccountApi.md +154 -0
- data/docs/BankAccountInput.md +24 -0
- data/docs/ErrorModel.md +9 -0
- data/git_push.sh +55 -0
- data/lib/beanie/api/bank_account_api.rb +183 -0
- data/lib/beanie/api_client.rb +388 -0
- data/lib/beanie/api_error.rb +38 -0
- data/lib/beanie/configuration.rb +202 -0
- data/lib/beanie/models/bank_account.rb +358 -0
- data/lib/beanie/models/bank_account_input.rb +357 -0
- data/lib/beanie/models/error_model.rb +202 -0
- data/lib/beanie/version.rb +13 -30
- data/lib/beanie.rb +32 -115
- data/spec/api/bank_account_api_spec.rb +71 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/bank_account_input_spec.rb +137 -0
- data/spec/models/bank_account_spec.rb +137 -0
- data/spec/models/error_model_spec.rb +47 -0
- data/spec/spec_helper.rb +111 -0
- metadata +174 -71
- data/.gitignore +0 -17
- data/VERSION +0 -1
- data/lib/beanie/api.rb +0 -182
- data/lib/beanie/bank_account.rb +0 -44
- data/lib/beanie/bank_statement.rb +0 -45
- data/lib/beanie/bank_statement_data.rb +0 -51
- data/lib/beanie/beanie_alert.rb +0 -66
- data/lib/beanie/bill_of_material.rb +0 -44
- data/lib/beanie/billable.rb +0 -46
- data/lib/beanie/bom_item.rb +0 -44
- data/lib/beanie/company.rb +0 -66
- data/lib/beanie/company_member.rb +0 -43
- data/lib/beanie/config_type.rb +0 -62
- data/lib/beanie/config_value.rb +0 -42
- data/lib/beanie/customer.rb +0 -51
- data/lib/beanie/customer_address.rb +0 -63
- data/lib/beanie/customer_note.rb +0 -42
- data/lib/beanie/document.rb +0 -71
- data/lib/beanie/fixed_asset.rb +0 -45
- data/lib/beanie/journal.rb +0 -44
- data/lib/beanie/journal_item.rb +0 -44
- data/lib/beanie/nominal_account.rb +0 -73
- data/lib/beanie/nominal_account_category.rb +0 -49
- data/lib/beanie/product.rb +0 -52
- data/lib/beanie/product_category.rb +0 -43
- data/lib/beanie/product_price.rb +0 -44
- data/lib/beanie/production_order.rb +0 -76
- data/lib/beanie/purchase_invoice.rb +0 -55
- data/lib/beanie/purchase_order.rb +0 -46
- data/lib/beanie/purchase_order_item.rb +0 -60
- data/lib/beanie/sales_invoice.rb +0 -83
- data/lib/beanie/sales_invoice_item.rb +0 -50
- data/lib/beanie/sales_order.rb +0 -74
- data/lib/beanie/sales_order_item.rb +0 -126
- data/lib/beanie/stock_adjustment.rb +0 -70
- data/lib/beanie/stock_category.rb +0 -44
- data/lib/beanie/stock_item.rb +0 -58
- data/lib/beanie/stock_location.rb +0 -42
- data/lib/beanie/stock_supplier.rb +0 -48
- data/lib/beanie/supplier.rb +0 -48
- data/lib/beanie/supplier_address.rb +0 -53
- data/lib/beanie/supplier_note.rb +0 -42
- data/lib/beanie/tax_registration.rb +0 -59
- data/lib/beanie/vat_record.rb +0 -66
- data/lib/beanie/vat_return.rb +0 -60
- data/lib/beanie/work_centre.rb +0 -99
- data/lib/beanie/work_centre_group.rb +0 -50
@@ -0,0 +1,358 @@
|
|
1
|
+
=begin
|
2
|
+
#Beanie ERP API
|
3
|
+
|
4
|
+
#An API specification for interacting with the Beanie ERP system
|
5
|
+
|
6
|
+
OpenAPI spec version: 0.1
|
7
|
+
Contact: dev@bean.ie
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.4.0-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module Beanie
|
16
|
+
# Bank account information
|
17
|
+
class BankAccount
|
18
|
+
attr_accessor :id
|
19
|
+
|
20
|
+
attr_accessor :name
|
21
|
+
|
22
|
+
attr_accessor :bank_name
|
23
|
+
|
24
|
+
attr_accessor :currency
|
25
|
+
|
26
|
+
attr_accessor :swift
|
27
|
+
|
28
|
+
attr_accessor :iban
|
29
|
+
|
30
|
+
attr_accessor :address1
|
31
|
+
|
32
|
+
attr_accessor :address2
|
33
|
+
|
34
|
+
attr_accessor :address3
|
35
|
+
|
36
|
+
attr_accessor :city
|
37
|
+
|
38
|
+
attr_accessor :state_county
|
39
|
+
|
40
|
+
attr_accessor :zip_postcode
|
41
|
+
|
42
|
+
attr_accessor :country
|
43
|
+
|
44
|
+
attr_accessor :contact_name
|
45
|
+
|
46
|
+
attr_accessor :phone
|
47
|
+
|
48
|
+
attr_accessor :email
|
49
|
+
|
50
|
+
attr_accessor :website
|
51
|
+
|
52
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
53
|
+
def self.attribute_map
|
54
|
+
{
|
55
|
+
:'id' => :'id',
|
56
|
+
:'name' => :'name',
|
57
|
+
:'bank_name' => :'bank_name',
|
58
|
+
:'currency' => :'currency',
|
59
|
+
:'swift' => :'swift',
|
60
|
+
:'iban' => :'iban',
|
61
|
+
:'address1' => :'address1',
|
62
|
+
:'address2' => :'address2',
|
63
|
+
:'address3' => :'address3',
|
64
|
+
:'city' => :'city',
|
65
|
+
:'state_county' => :'state_county',
|
66
|
+
:'zip_postcode' => :'zip_postcode',
|
67
|
+
:'country' => :'country',
|
68
|
+
:'contact_name' => :'contact_name',
|
69
|
+
:'phone' => :'phone',
|
70
|
+
:'email' => :'email',
|
71
|
+
:'website' => :'website'
|
72
|
+
}
|
73
|
+
end
|
74
|
+
|
75
|
+
# Attribute type mapping.
|
76
|
+
def self.swagger_types
|
77
|
+
{
|
78
|
+
:'id' => :'Integer',
|
79
|
+
:'name' => :'String',
|
80
|
+
:'bank_name' => :'String',
|
81
|
+
:'currency' => :'String',
|
82
|
+
:'swift' => :'String',
|
83
|
+
:'iban' => :'String',
|
84
|
+
:'address1' => :'String',
|
85
|
+
:'address2' => :'String',
|
86
|
+
:'address3' => :'String',
|
87
|
+
:'city' => :'String',
|
88
|
+
:'state_county' => :'String',
|
89
|
+
:'zip_postcode' => :'String',
|
90
|
+
:'country' => :'String',
|
91
|
+
:'contact_name' => :'String',
|
92
|
+
:'phone' => :'String',
|
93
|
+
:'email' => :'String',
|
94
|
+
:'website' => :'String'
|
95
|
+
}
|
96
|
+
end
|
97
|
+
|
98
|
+
# Initializes the object
|
99
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
100
|
+
def initialize(attributes = {})
|
101
|
+
return unless attributes.is_a?(Hash)
|
102
|
+
|
103
|
+
# convert string to symbol for hash key
|
104
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
105
|
+
|
106
|
+
if attributes.has_key?(:'id')
|
107
|
+
self.id = attributes[:'id']
|
108
|
+
end
|
109
|
+
|
110
|
+
if attributes.has_key?(:'name')
|
111
|
+
self.name = attributes[:'name']
|
112
|
+
end
|
113
|
+
|
114
|
+
if attributes.has_key?(:'bank_name')
|
115
|
+
self.bank_name = attributes[:'bank_name']
|
116
|
+
end
|
117
|
+
|
118
|
+
if attributes.has_key?(:'currency')
|
119
|
+
self.currency = attributes[:'currency']
|
120
|
+
end
|
121
|
+
|
122
|
+
if attributes.has_key?(:'swift')
|
123
|
+
self.swift = attributes[:'swift']
|
124
|
+
end
|
125
|
+
|
126
|
+
if attributes.has_key?(:'iban')
|
127
|
+
self.iban = attributes[:'iban']
|
128
|
+
end
|
129
|
+
|
130
|
+
if attributes.has_key?(:'address1')
|
131
|
+
self.address1 = attributes[:'address1']
|
132
|
+
end
|
133
|
+
|
134
|
+
if attributes.has_key?(:'address2')
|
135
|
+
self.address2 = attributes[:'address2']
|
136
|
+
end
|
137
|
+
|
138
|
+
if attributes.has_key?(:'address3')
|
139
|
+
self.address3 = attributes[:'address3']
|
140
|
+
end
|
141
|
+
|
142
|
+
if attributes.has_key?(:'city')
|
143
|
+
self.city = attributes[:'city']
|
144
|
+
end
|
145
|
+
|
146
|
+
if attributes.has_key?(:'state_county')
|
147
|
+
self.state_county = attributes[:'state_county']
|
148
|
+
end
|
149
|
+
|
150
|
+
if attributes.has_key?(:'zip_postcode')
|
151
|
+
self.zip_postcode = attributes[:'zip_postcode']
|
152
|
+
end
|
153
|
+
|
154
|
+
if attributes.has_key?(:'country')
|
155
|
+
self.country = attributes[:'country']
|
156
|
+
end
|
157
|
+
|
158
|
+
if attributes.has_key?(:'contact_name')
|
159
|
+
self.contact_name = attributes[:'contact_name']
|
160
|
+
end
|
161
|
+
|
162
|
+
if attributes.has_key?(:'phone')
|
163
|
+
self.phone = attributes[:'phone']
|
164
|
+
end
|
165
|
+
|
166
|
+
if attributes.has_key?(:'email')
|
167
|
+
self.email = attributes[:'email']
|
168
|
+
end
|
169
|
+
|
170
|
+
if attributes.has_key?(:'website')
|
171
|
+
self.website = attributes[:'website']
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
176
|
+
# @return Array for valid properties with the reasons
|
177
|
+
def list_invalid_properties
|
178
|
+
invalid_properties = Array.new
|
179
|
+
if @id.nil?
|
180
|
+
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
181
|
+
end
|
182
|
+
|
183
|
+
if @name.nil?
|
184
|
+
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
185
|
+
end
|
186
|
+
|
187
|
+
if @bank_name.nil?
|
188
|
+
invalid_properties.push('invalid value for "bank_name", bank_name cannot be nil.')
|
189
|
+
end
|
190
|
+
|
191
|
+
if @currency.nil?
|
192
|
+
invalid_properties.push('invalid value for "currency", currency cannot be nil.')
|
193
|
+
end
|
194
|
+
|
195
|
+
if @swift.nil?
|
196
|
+
invalid_properties.push('invalid value for "swift", swift cannot be nil.')
|
197
|
+
end
|
198
|
+
|
199
|
+
if @iban.nil?
|
200
|
+
invalid_properties.push('invalid value for "iban", iban cannot be nil.')
|
201
|
+
end
|
202
|
+
|
203
|
+
invalid_properties
|
204
|
+
end
|
205
|
+
|
206
|
+
# Check to see if the all the properties in the model are valid
|
207
|
+
# @return true if the model is valid
|
208
|
+
def valid?
|
209
|
+
return false if @id.nil?
|
210
|
+
return false if @name.nil?
|
211
|
+
return false if @bank_name.nil?
|
212
|
+
return false if @currency.nil?
|
213
|
+
return false if @swift.nil?
|
214
|
+
return false if @iban.nil?
|
215
|
+
true
|
216
|
+
end
|
217
|
+
|
218
|
+
# Checks equality by comparing each attribute.
|
219
|
+
# @param [Object] Object to be compared
|
220
|
+
def ==(o)
|
221
|
+
return true if self.equal?(o)
|
222
|
+
self.class == o.class &&
|
223
|
+
id == o.id &&
|
224
|
+
name == o.name &&
|
225
|
+
bank_name == o.bank_name &&
|
226
|
+
currency == o.currency &&
|
227
|
+
swift == o.swift &&
|
228
|
+
iban == o.iban &&
|
229
|
+
address1 == o.address1 &&
|
230
|
+
address2 == o.address2 &&
|
231
|
+
address3 == o.address3 &&
|
232
|
+
city == o.city &&
|
233
|
+
state_county == o.state_county &&
|
234
|
+
zip_postcode == o.zip_postcode &&
|
235
|
+
country == o.country &&
|
236
|
+
contact_name == o.contact_name &&
|
237
|
+
phone == o.phone &&
|
238
|
+
email == o.email &&
|
239
|
+
website == o.website
|
240
|
+
end
|
241
|
+
|
242
|
+
# @see the `==` method
|
243
|
+
# @param [Object] Object to be compared
|
244
|
+
def eql?(o)
|
245
|
+
self == o
|
246
|
+
end
|
247
|
+
|
248
|
+
# Calculates hash code according to all attributes.
|
249
|
+
# @return [Fixnum] Hash code
|
250
|
+
def hash
|
251
|
+
[id, name, bank_name, currency, swift, iban, address1, address2, address3, city, state_county, zip_postcode, country, contact_name, phone, email, website].hash
|
252
|
+
end
|
253
|
+
|
254
|
+
# Builds the object from hash
|
255
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
256
|
+
# @return [Object] Returns the model itself
|
257
|
+
def build_from_hash(attributes)
|
258
|
+
return nil unless attributes.is_a?(Hash)
|
259
|
+
self.class.swagger_types.each_pair do |key, type|
|
260
|
+
if type =~ /\AArray<(.*)>/i
|
261
|
+
# check to ensure the input is an array given that the the attribute
|
262
|
+
# is documented as an array but the input is not
|
263
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
264
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
265
|
+
end
|
266
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
267
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
268
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
269
|
+
end
|
270
|
+
|
271
|
+
self
|
272
|
+
end
|
273
|
+
|
274
|
+
# Deserializes the data based on type
|
275
|
+
# @param string type Data type
|
276
|
+
# @param string value Value to be deserialized
|
277
|
+
# @return [Object] Deserialized data
|
278
|
+
def _deserialize(type, value)
|
279
|
+
case type.to_sym
|
280
|
+
when :DateTime
|
281
|
+
DateTime.parse(value)
|
282
|
+
when :Date
|
283
|
+
Date.parse(value)
|
284
|
+
when :String
|
285
|
+
value.to_s
|
286
|
+
when :Integer
|
287
|
+
value.to_i
|
288
|
+
when :Float
|
289
|
+
value.to_f
|
290
|
+
when :BOOLEAN
|
291
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
292
|
+
true
|
293
|
+
else
|
294
|
+
false
|
295
|
+
end
|
296
|
+
when :Object
|
297
|
+
# generic object (usually a Hash), return directly
|
298
|
+
value
|
299
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
300
|
+
inner_type = Regexp.last_match[:inner_type]
|
301
|
+
value.map { |v| _deserialize(inner_type, v) }
|
302
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
303
|
+
k_type = Regexp.last_match[:k_type]
|
304
|
+
v_type = Regexp.last_match[:v_type]
|
305
|
+
{}.tap do |hash|
|
306
|
+
value.each do |k, v|
|
307
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
308
|
+
end
|
309
|
+
end
|
310
|
+
else # model
|
311
|
+
temp_model = Beanie.const_get(type).new
|
312
|
+
temp_model.build_from_hash(value)
|
313
|
+
end
|
314
|
+
end
|
315
|
+
|
316
|
+
# Returns the string representation of the object
|
317
|
+
# @return [String] String presentation of the object
|
318
|
+
def to_s
|
319
|
+
to_hash.to_s
|
320
|
+
end
|
321
|
+
|
322
|
+
# to_body is an alias to to_hash (backward compatibility)
|
323
|
+
# @return [Hash] Returns the object in the form of hash
|
324
|
+
def to_body
|
325
|
+
to_hash
|
326
|
+
end
|
327
|
+
|
328
|
+
# Returns the object in the form of hash
|
329
|
+
# @return [Hash] Returns the object in the form of hash
|
330
|
+
def to_hash
|
331
|
+
hash = {}
|
332
|
+
self.class.attribute_map.each_pair do |attr, param|
|
333
|
+
value = self.send(attr)
|
334
|
+
next if value.nil?
|
335
|
+
hash[param] = _to_hash(value)
|
336
|
+
end
|
337
|
+
hash
|
338
|
+
end
|
339
|
+
|
340
|
+
# Outputs non-array value in the form of hash
|
341
|
+
# For object, use to_hash. Otherwise, just return the value
|
342
|
+
# @param [Object] value Any valid value
|
343
|
+
# @return [Hash] Returns the value in the form of hash
|
344
|
+
def _to_hash(value)
|
345
|
+
if value.is_a?(Array)
|
346
|
+
value.compact.map { |v| _to_hash(v) }
|
347
|
+
elsif value.is_a?(Hash)
|
348
|
+
{}.tap do |hash|
|
349
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
350
|
+
end
|
351
|
+
elsif value.respond_to? :to_hash
|
352
|
+
value.to_hash
|
353
|
+
else
|
354
|
+
value
|
355
|
+
end
|
356
|
+
end
|
357
|
+
end
|
358
|
+
end
|
@@ -0,0 +1,357 @@
|
|
1
|
+
=begin
|
2
|
+
#Beanie ERP API
|
3
|
+
|
4
|
+
#An API specification for interacting with the Beanie ERP system
|
5
|
+
|
6
|
+
OpenAPI spec version: 0.1
|
7
|
+
Contact: dev@bean.ie
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.4.0-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module Beanie
|
16
|
+
class BankAccountInput
|
17
|
+
attr_accessor :id
|
18
|
+
|
19
|
+
attr_accessor :name
|
20
|
+
|
21
|
+
attr_accessor :bank_name
|
22
|
+
|
23
|
+
attr_accessor :currency
|
24
|
+
|
25
|
+
attr_accessor :swift
|
26
|
+
|
27
|
+
attr_accessor :iban
|
28
|
+
|
29
|
+
attr_accessor :address1
|
30
|
+
|
31
|
+
attr_accessor :address2
|
32
|
+
|
33
|
+
attr_accessor :address3
|
34
|
+
|
35
|
+
attr_accessor :city
|
36
|
+
|
37
|
+
attr_accessor :state_county
|
38
|
+
|
39
|
+
attr_accessor :zip_postcode
|
40
|
+
|
41
|
+
attr_accessor :country
|
42
|
+
|
43
|
+
attr_accessor :contact_name
|
44
|
+
|
45
|
+
attr_accessor :phone
|
46
|
+
|
47
|
+
attr_accessor :email
|
48
|
+
|
49
|
+
attr_accessor :website
|
50
|
+
|
51
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
52
|
+
def self.attribute_map
|
53
|
+
{
|
54
|
+
:'id' => :'id',
|
55
|
+
:'name' => :'name',
|
56
|
+
:'bank_name' => :'bank_name',
|
57
|
+
:'currency' => :'currency',
|
58
|
+
:'swift' => :'swift',
|
59
|
+
:'iban' => :'iban',
|
60
|
+
:'address1' => :'address1',
|
61
|
+
:'address2' => :'address2',
|
62
|
+
:'address3' => :'address3',
|
63
|
+
:'city' => :'city',
|
64
|
+
:'state_county' => :'state_county',
|
65
|
+
:'zip_postcode' => :'zip_postcode',
|
66
|
+
:'country' => :'country',
|
67
|
+
:'contact_name' => :'contact_name',
|
68
|
+
:'phone' => :'phone',
|
69
|
+
:'email' => :'email',
|
70
|
+
:'website' => :'website'
|
71
|
+
}
|
72
|
+
end
|
73
|
+
|
74
|
+
# Attribute type mapping.
|
75
|
+
def self.swagger_types
|
76
|
+
{
|
77
|
+
:'id' => :'Integer',
|
78
|
+
:'name' => :'String',
|
79
|
+
:'bank_name' => :'String',
|
80
|
+
:'currency' => :'String',
|
81
|
+
:'swift' => :'String',
|
82
|
+
:'iban' => :'String',
|
83
|
+
:'address1' => :'String',
|
84
|
+
:'address2' => :'String',
|
85
|
+
:'address3' => :'String',
|
86
|
+
:'city' => :'String',
|
87
|
+
:'state_county' => :'String',
|
88
|
+
:'zip_postcode' => :'String',
|
89
|
+
:'country' => :'String',
|
90
|
+
:'contact_name' => :'String',
|
91
|
+
:'phone' => :'String',
|
92
|
+
:'email' => :'String',
|
93
|
+
:'website' => :'String'
|
94
|
+
}
|
95
|
+
end
|
96
|
+
|
97
|
+
# Initializes the object
|
98
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
99
|
+
def initialize(attributes = {})
|
100
|
+
return unless attributes.is_a?(Hash)
|
101
|
+
|
102
|
+
# convert string to symbol for hash key
|
103
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
104
|
+
|
105
|
+
if attributes.has_key?(:'id')
|
106
|
+
self.id = attributes[:'id']
|
107
|
+
end
|
108
|
+
|
109
|
+
if attributes.has_key?(:'name')
|
110
|
+
self.name = attributes[:'name']
|
111
|
+
end
|
112
|
+
|
113
|
+
if attributes.has_key?(:'bank_name')
|
114
|
+
self.bank_name = attributes[:'bank_name']
|
115
|
+
end
|
116
|
+
|
117
|
+
if attributes.has_key?(:'currency')
|
118
|
+
self.currency = attributes[:'currency']
|
119
|
+
end
|
120
|
+
|
121
|
+
if attributes.has_key?(:'swift')
|
122
|
+
self.swift = attributes[:'swift']
|
123
|
+
end
|
124
|
+
|
125
|
+
if attributes.has_key?(:'iban')
|
126
|
+
self.iban = attributes[:'iban']
|
127
|
+
end
|
128
|
+
|
129
|
+
if attributes.has_key?(:'address1')
|
130
|
+
self.address1 = attributes[:'address1']
|
131
|
+
end
|
132
|
+
|
133
|
+
if attributes.has_key?(:'address2')
|
134
|
+
self.address2 = attributes[:'address2']
|
135
|
+
end
|
136
|
+
|
137
|
+
if attributes.has_key?(:'address3')
|
138
|
+
self.address3 = attributes[:'address3']
|
139
|
+
end
|
140
|
+
|
141
|
+
if attributes.has_key?(:'city')
|
142
|
+
self.city = attributes[:'city']
|
143
|
+
end
|
144
|
+
|
145
|
+
if attributes.has_key?(:'state_county')
|
146
|
+
self.state_county = attributes[:'state_county']
|
147
|
+
end
|
148
|
+
|
149
|
+
if attributes.has_key?(:'zip_postcode')
|
150
|
+
self.zip_postcode = attributes[:'zip_postcode']
|
151
|
+
end
|
152
|
+
|
153
|
+
if attributes.has_key?(:'country')
|
154
|
+
self.country = attributes[:'country']
|
155
|
+
end
|
156
|
+
|
157
|
+
if attributes.has_key?(:'contact_name')
|
158
|
+
self.contact_name = attributes[:'contact_name']
|
159
|
+
end
|
160
|
+
|
161
|
+
if attributes.has_key?(:'phone')
|
162
|
+
self.phone = attributes[:'phone']
|
163
|
+
end
|
164
|
+
|
165
|
+
if attributes.has_key?(:'email')
|
166
|
+
self.email = attributes[:'email']
|
167
|
+
end
|
168
|
+
|
169
|
+
if attributes.has_key?(:'website')
|
170
|
+
self.website = attributes[:'website']
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
175
|
+
# @return Array for valid properties with the reasons
|
176
|
+
def list_invalid_properties
|
177
|
+
invalid_properties = Array.new
|
178
|
+
if @id.nil?
|
179
|
+
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
180
|
+
end
|
181
|
+
|
182
|
+
if @name.nil?
|
183
|
+
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
184
|
+
end
|
185
|
+
|
186
|
+
if @bank_name.nil?
|
187
|
+
invalid_properties.push('invalid value for "bank_name", bank_name cannot be nil.')
|
188
|
+
end
|
189
|
+
|
190
|
+
if @currency.nil?
|
191
|
+
invalid_properties.push('invalid value for "currency", currency cannot be nil.')
|
192
|
+
end
|
193
|
+
|
194
|
+
if @swift.nil?
|
195
|
+
invalid_properties.push('invalid value for "swift", swift cannot be nil.')
|
196
|
+
end
|
197
|
+
|
198
|
+
if @iban.nil?
|
199
|
+
invalid_properties.push('invalid value for "iban", iban cannot be nil.')
|
200
|
+
end
|
201
|
+
|
202
|
+
invalid_properties
|
203
|
+
end
|
204
|
+
|
205
|
+
# Check to see if the all the properties in the model are valid
|
206
|
+
# @return true if the model is valid
|
207
|
+
def valid?
|
208
|
+
return false if @id.nil?
|
209
|
+
return false if @name.nil?
|
210
|
+
return false if @bank_name.nil?
|
211
|
+
return false if @currency.nil?
|
212
|
+
return false if @swift.nil?
|
213
|
+
return false if @iban.nil?
|
214
|
+
true
|
215
|
+
end
|
216
|
+
|
217
|
+
# Checks equality by comparing each attribute.
|
218
|
+
# @param [Object] Object to be compared
|
219
|
+
def ==(o)
|
220
|
+
return true if self.equal?(o)
|
221
|
+
self.class == o.class &&
|
222
|
+
id == o.id &&
|
223
|
+
name == o.name &&
|
224
|
+
bank_name == o.bank_name &&
|
225
|
+
currency == o.currency &&
|
226
|
+
swift == o.swift &&
|
227
|
+
iban == o.iban &&
|
228
|
+
address1 == o.address1 &&
|
229
|
+
address2 == o.address2 &&
|
230
|
+
address3 == o.address3 &&
|
231
|
+
city == o.city &&
|
232
|
+
state_county == o.state_county &&
|
233
|
+
zip_postcode == o.zip_postcode &&
|
234
|
+
country == o.country &&
|
235
|
+
contact_name == o.contact_name &&
|
236
|
+
phone == o.phone &&
|
237
|
+
email == o.email &&
|
238
|
+
website == o.website
|
239
|
+
end
|
240
|
+
|
241
|
+
# @see the `==` method
|
242
|
+
# @param [Object] Object to be compared
|
243
|
+
def eql?(o)
|
244
|
+
self == o
|
245
|
+
end
|
246
|
+
|
247
|
+
# Calculates hash code according to all attributes.
|
248
|
+
# @return [Fixnum] Hash code
|
249
|
+
def hash
|
250
|
+
[id, name, bank_name, currency, swift, iban, address1, address2, address3, city, state_county, zip_postcode, country, contact_name, phone, email, website].hash
|
251
|
+
end
|
252
|
+
|
253
|
+
# Builds the object from hash
|
254
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
255
|
+
# @return [Object] Returns the model itself
|
256
|
+
def build_from_hash(attributes)
|
257
|
+
return nil unless attributes.is_a?(Hash)
|
258
|
+
self.class.swagger_types.each_pair do |key, type|
|
259
|
+
if type =~ /\AArray<(.*)>/i
|
260
|
+
# check to ensure the input is an array given that the the attribute
|
261
|
+
# is documented as an array but the input is not
|
262
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
263
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
264
|
+
end
|
265
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
266
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
267
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
268
|
+
end
|
269
|
+
|
270
|
+
self
|
271
|
+
end
|
272
|
+
|
273
|
+
# Deserializes the data based on type
|
274
|
+
# @param string type Data type
|
275
|
+
# @param string value Value to be deserialized
|
276
|
+
# @return [Object] Deserialized data
|
277
|
+
def _deserialize(type, value)
|
278
|
+
case type.to_sym
|
279
|
+
when :DateTime
|
280
|
+
DateTime.parse(value)
|
281
|
+
when :Date
|
282
|
+
Date.parse(value)
|
283
|
+
when :String
|
284
|
+
value.to_s
|
285
|
+
when :Integer
|
286
|
+
value.to_i
|
287
|
+
when :Float
|
288
|
+
value.to_f
|
289
|
+
when :BOOLEAN
|
290
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
291
|
+
true
|
292
|
+
else
|
293
|
+
false
|
294
|
+
end
|
295
|
+
when :Object
|
296
|
+
# generic object (usually a Hash), return directly
|
297
|
+
value
|
298
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
299
|
+
inner_type = Regexp.last_match[:inner_type]
|
300
|
+
value.map { |v| _deserialize(inner_type, v) }
|
301
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
302
|
+
k_type = Regexp.last_match[:k_type]
|
303
|
+
v_type = Regexp.last_match[:v_type]
|
304
|
+
{}.tap do |hash|
|
305
|
+
value.each do |k, v|
|
306
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
307
|
+
end
|
308
|
+
end
|
309
|
+
else # model
|
310
|
+
temp_model = Beanie.const_get(type).new
|
311
|
+
temp_model.build_from_hash(value)
|
312
|
+
end
|
313
|
+
end
|
314
|
+
|
315
|
+
# Returns the string representation of the object
|
316
|
+
# @return [String] String presentation of the object
|
317
|
+
def to_s
|
318
|
+
to_hash.to_s
|
319
|
+
end
|
320
|
+
|
321
|
+
# to_body is an alias to to_hash (backward compatibility)
|
322
|
+
# @return [Hash] Returns the object in the form of hash
|
323
|
+
def to_body
|
324
|
+
to_hash
|
325
|
+
end
|
326
|
+
|
327
|
+
# Returns the object in the form of hash
|
328
|
+
# @return [Hash] Returns the object in the form of hash
|
329
|
+
def to_hash
|
330
|
+
hash = {}
|
331
|
+
self.class.attribute_map.each_pair do |attr, param|
|
332
|
+
value = self.send(attr)
|
333
|
+
next if value.nil?
|
334
|
+
hash[param] = _to_hash(value)
|
335
|
+
end
|
336
|
+
hash
|
337
|
+
end
|
338
|
+
|
339
|
+
# Outputs non-array value in the form of hash
|
340
|
+
# For object, use to_hash. Otherwise, just return the value
|
341
|
+
# @param [Object] value Any valid value
|
342
|
+
# @return [Hash] Returns the value in the form of hash
|
343
|
+
def _to_hash(value)
|
344
|
+
if value.is_a?(Array)
|
345
|
+
value.compact.map { |v| _to_hash(v) }
|
346
|
+
elsif value.is_a?(Hash)
|
347
|
+
{}.tap do |hash|
|
348
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
349
|
+
end
|
350
|
+
elsif value.respond_to? :to_hash
|
351
|
+
value.to_hash
|
352
|
+
else
|
353
|
+
value
|
354
|
+
end
|
355
|
+
end
|
356
|
+
end
|
357
|
+
end
|