processout 2.25.0 → 2.27.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/.DS_Store +0 -0
  3. data/.github/CODEOWNERS +2 -0
  4. data/.github/stale.yml +17 -0
  5. data/.github/workflows/ci.yaml +19 -0
  6. data/.gitignore +2 -1
  7. data/lib/processout/card.rb +22 -0
  8. data/lib/processout/category_error_codes.rb +180 -0
  9. data/lib/processout/customer.rb +29 -4
  10. data/lib/processout/customer_phone.rb +81 -0
  11. data/lib/processout/error_codes.rb +107 -0
  12. data/lib/processout/gateway_configuration.rb +13 -0
  13. data/lib/processout/invoice.rb +127 -1
  14. data/lib/processout/invoice_external_fraud_tools.rb +11 -0
  15. data/lib/processout/invoice_risk.rb +11 -0
  16. data/lib/processout/invoice_shipping.rb +23 -0
  17. data/lib/processout/invoice_shipping_phone.rb +81 -0
  18. data/lib/processout/invoices_process_native_payment_response.rb +105 -0
  19. data/lib/processout/native_apm_parameter_definition.rb +141 -0
  20. data/lib/processout/native_apm_parameter_value.rb +81 -0
  21. data/lib/processout/native_apm_parameter_value_definition.rb +92 -0
  22. data/lib/processout/native_apm_request.rb +86 -0
  23. data/lib/processout/native_apm_response.rb +124 -0
  24. data/lib/processout/native_apm_transaction_details.rb +143 -0
  25. data/lib/processout/native_apm_transaction_details_gateway.rb +81 -0
  26. data/lib/processout/native_apm_transaction_details_invoice.rb +81 -0
  27. data/lib/processout/networking/request.rb +1 -1
  28. data/lib/processout/project_sftp_settings.rb +150 -0
  29. data/lib/processout/refund.rb +26 -0
  30. data/lib/processout/transaction.rb +46 -0
  31. data/lib/processout/unsupported_feature_bypass.rb +70 -0
  32. data/lib/processout/version.rb +1 -1
  33. data/lib/processout.rb +90 -0
  34. metadata +21 -2
@@ -48,9 +48,11 @@ module ProcessOut
48
48
  attr_reader :incremental
49
49
  attr_reader :tax
50
50
  attr_reader :payment_type
51
+ attr_reader :native_apm
51
52
  attr_reader :initiation_type
52
53
  attr_reader :payment_intent
53
54
  attr_reader :billing
55
+ attr_reader :unsupported_feature_bypass
54
56
 
55
57
 
56
58
  def id=(val)
@@ -349,6 +351,22 @@ module ProcessOut
349
351
  @payment_type = val
350
352
  end
351
353
 
354
+ def native_apm=(val)
355
+ if val.nil?
356
+ @native_apm = val
357
+ return
358
+ end
359
+
360
+ if val.instance_of? NativeAPMRequest
361
+ @native_apm = val
362
+ else
363
+ obj = NativeAPMRequest.new(@client)
364
+ obj.fill_with_data(val)
365
+ @native_apm = obj
366
+ end
367
+
368
+ end
369
+
352
370
  def initiation_type=(val)
353
371
  @initiation_type = val
354
372
  end
@@ -373,6 +391,22 @@ module ProcessOut
373
391
 
374
392
  end
375
393
 
394
+ def unsupported_feature_bypass=(val)
395
+ if val.nil?
396
+ @unsupported_feature_bypass = val
397
+ return
398
+ end
399
+
400
+ if val.instance_of? UnsupportedFeatureBypass
401
+ @unsupported_feature_bypass = val
402
+ else
403
+ obj = UnsupportedFeatureBypass.new(@client)
404
+ obj.fill_with_data(val)
405
+ @unsupported_feature_bypass = obj
406
+ end
407
+
408
+ end
409
+
376
410
 
377
411
  # Initializes the Invoice object
378
412
  # Params:
@@ -421,9 +455,11 @@ module ProcessOut
421
455
  self.incremental = data.fetch(:incremental, nil)
422
456
  self.tax = data.fetch(:tax, nil)
423
457
  self.payment_type = data.fetch(:payment_type, nil)
458
+ self.native_apm = data.fetch(:native_apm, nil)
424
459
  self.initiation_type = data.fetch(:initiation_type, nil)
425
460
  self.payment_intent = data.fetch(:payment_intent, nil)
426
461
  self.billing = data.fetch(:billing, nil)
462
+ self.unsupported_feature_bypass = data.fetch(:unsupported_feature_bypass, nil)
427
463
 
428
464
  end
429
465
 
@@ -475,9 +511,11 @@ module ProcessOut
475
511
  "incremental": self.incremental,
476
512
  "tax": self.tax,
477
513
  "payment_type": self.payment_type,
514
+ "native_apm": self.native_apm,
478
515
  "initiation_type": self.initiation_type,
479
516
  "payment_intent": self.payment_intent,
480
517
  "billing": self.billing,
518
+ "unsupported_feature_bypass": self.unsupported_feature_bypass,
481
519
  }.to_json
482
520
  end
483
521
 
@@ -608,6 +646,9 @@ module ProcessOut
608
646
  if data.include? "payment_type"
609
647
  self.payment_type = data["payment_type"]
610
648
  end
649
+ if data.include? "native_apm"
650
+ self.native_apm = data["native_apm"]
651
+ end
611
652
  if data.include? "initiation_type"
612
653
  self.initiation_type = data["initiation_type"]
613
654
  end
@@ -617,6 +658,9 @@ module ProcessOut
617
658
  if data.include? "billing"
618
659
  self.billing = data["billing"]
619
660
  end
661
+ if data.include? "unsupported_feature_bypass"
662
+ self.unsupported_feature_bypass = data["unsupported_feature_bypass"]
663
+ end
620
664
 
621
665
  self
622
666
  end
@@ -668,9 +712,11 @@ module ProcessOut
668
712
  self.incremental = data.fetch(:incremental, self.incremental)
669
713
  self.tax = data.fetch(:tax, self.tax)
670
714
  self.payment_type = data.fetch(:payment_type, self.payment_type)
715
+ self.native_apm = data.fetch(:native_apm, self.native_apm)
671
716
  self.initiation_type = data.fetch(:initiation_type, self.initiation_type)
672
717
  self.payment_intent = data.fetch(:payment_intent, self.payment_intent)
673
718
  self.billing = data.fetch(:billing, self.billing)
719
+ self.unsupported_feature_bypass = data.fetch(:unsupported_feature_bypass, self.unsupported_feature_bypass)
674
720
 
675
721
  self
676
722
  end
@@ -821,6 +867,85 @@ module ProcessOut
821
867
  return_values[0]
822
868
  end
823
869
 
870
+ # Process the payout invoice using the given source (customer or token)
871
+ # Params:
872
+ # +gateway_configuration_id+:: ID of the configuration, that processes payout
873
+ # +source+:: Source used to process the payout. Can be a card, a token or a gateway request
874
+ # +options+:: +Hash+ of options
875
+ def payout(gateway_configuration_id, source, options = {})
876
+ self.prefill(options)
877
+
878
+ request = Request.new(@client)
879
+ path = "/invoices/" + CGI.escape(@id) + "/payout"
880
+ data = {
881
+ "force_gateway_configuration_id" => options.fetch(:force_gateway_configuration_id, nil),
882
+ "gateway_configuration_id" => gateway_configuration_id,
883
+ "source" => source
884
+ }
885
+
886
+ response = Response.new(request.post(path, data, options))
887
+ return_values = Array.new
888
+
889
+ body = response.body
890
+ body = body["transaction"]
891
+ transaction = Transaction.new(@client)
892
+ return_values.push(transaction.fill_with_data(body))
893
+
894
+
895
+ return_values[0]
896
+ end
897
+
898
+ # Fetches the Native APM payment
899
+ # Params:
900
+ # +invoice_id+:: ID of the invoice
901
+ # +gateway_configuration_id+:: ID of the native APM configuration
902
+ # +options+:: +Hash+ of options
903
+ def show_native_payment_transaction(invoice_id, gateway_configuration_id, options = {})
904
+ self.prefill(options)
905
+
906
+ request = Request.new(@client)
907
+ path = "/invoices/" + CGI.escape(invoice_id) + "/native-payment/" + CGI.escape(gateway_configuration_id) + ""
908
+ data = {
909
+
910
+ }
911
+
912
+ response = Response.new(request.get(path, data, options))
913
+ return_values = Array.new
914
+
915
+ body = response.body
916
+ body = body["native_apm"]
917
+ native_apm_transaction_details = NativeAPMTransactionDetails.new(@client)
918
+ return_values.push(native_apm_transaction_details.fill_with_data(body))
919
+
920
+
921
+ return_values[0]
922
+ end
923
+
924
+ # Process the Native APM payment flow
925
+ # Params:
926
+ # +invoice_id+:: ID of the invoice
927
+ # +options+:: +Hash+ of options
928
+ def process_native_payment(invoice_id, options = {})
929
+ self.prefill(options)
930
+
931
+ request = Request.new(@client)
932
+ path = "/invoices/" + CGI.escape(invoice_id) + "/native-payment"
933
+ data = {
934
+ "gateway_configuration_id" => options.fetch(:gateway_configuration_id, nil),
935
+ "native_apm" => options.fetch(:native_apm, nil)
936
+ }
937
+
938
+ response = Response.new(request.post(path, data, options))
939
+ return_values = Array.new
940
+
941
+ body = response.body
942
+ invoices_process_native_payment_response = InvoicesProcessNativePaymentResponse.new(@client)
943
+ return_values.push(invoices_process_native_payment_response.fill_with_data(body))
944
+
945
+
946
+ return_values[0]
947
+ end
948
+
824
949
  # Initiate a 3-D Secure authentication
825
950
  # Params:
826
951
  # +source+:: Source used to initiate the 3-D Secure authentication. Can be a card, or a token representing a card
@@ -963,7 +1088,8 @@ module ProcessOut
963
1088
  "external_fraud_tools" => @external_fraud_tools,
964
1089
  "tax" => @tax,
965
1090
  "payment_type" => @payment_type,
966
- "billing" => @billing
1091
+ "billing" => @billing,
1092
+ "unsupported_feature_bypass" => @unsupported_feature_bypass
967
1093
  }
968
1094
 
969
1095
  response = Response.new(request.post(path, data, options))
@@ -9,6 +9,7 @@ module ProcessOut
9
9
  class InvoiceExternalFraudTools
10
10
 
11
11
  attr_reader :forter
12
+ attr_reader :ravelin
12
13
  attr_reader :signifyd
13
14
 
14
15
 
@@ -16,6 +17,10 @@ module ProcessOut
16
17
  @forter = val
17
18
  end
18
19
 
20
+ def ravelin=(val)
21
+ @ravelin = val
22
+ end
23
+
19
24
  def signifyd=(val)
20
25
  @signifyd = val
21
26
  end
@@ -29,6 +34,7 @@ module ProcessOut
29
34
  @client = client
30
35
 
31
36
  self.forter = data.fetch(:forter, nil)
37
+ self.ravelin = data.fetch(:ravelin, nil)
32
38
  self.signifyd = data.fetch(:signifyd, nil)
33
39
 
34
40
  end
@@ -42,6 +48,7 @@ module ProcessOut
42
48
  def to_json(options)
43
49
  {
44
50
  "forter": self.forter,
51
+ "ravelin": self.ravelin,
45
52
  "signifyd": self.signifyd,
46
53
  }.to_json
47
54
  end
@@ -56,6 +63,9 @@ module ProcessOut
56
63
  if data.include? "forter"
57
64
  self.forter = data["forter"]
58
65
  end
66
+ if data.include? "ravelin"
67
+ self.ravelin = data["ravelin"]
68
+ end
59
69
  if data.include? "signifyd"
60
70
  self.signifyd = data["signifyd"]
61
71
  end
@@ -71,6 +81,7 @@ module ProcessOut
71
81
  return self
72
82
  end
73
83
  self.forter = data.fetch(:forter, self.forter)
84
+ self.ravelin = data.fetch(:ravelin, self.ravelin)
74
85
  self.signifyd = data.fetch(:signifyd, self.signifyd)
75
86
 
76
87
  self
@@ -10,6 +10,7 @@ module ProcessOut
10
10
 
11
11
  attr_reader :score
12
12
  attr_reader :is_legit
13
+ attr_reader :skip_gateway_rules
13
14
 
14
15
 
15
16
  def score=(val)
@@ -20,6 +21,10 @@ module ProcessOut
20
21
  @is_legit = val
21
22
  end
22
23
 
24
+ def skip_gateway_rules=(val)
25
+ @skip_gateway_rules = val
26
+ end
27
+
23
28
 
24
29
  # Initializes the InvoiceRisk object
25
30
  # Params:
@@ -30,6 +35,7 @@ module ProcessOut
30
35
 
31
36
  self.score = data.fetch(:score, nil)
32
37
  self.is_legit = data.fetch(:is_legit, nil)
38
+ self.skip_gateway_rules = data.fetch(:skip_gateway_rules, nil)
33
39
 
34
40
  end
35
41
 
@@ -43,6 +49,7 @@ module ProcessOut
43
49
  {
44
50
  "score": self.score,
45
51
  "is_legit": self.is_legit,
52
+ "skip_gateway_rules": self.skip_gateway_rules,
46
53
  }.to_json
47
54
  end
48
55
 
@@ -59,6 +66,9 @@ module ProcessOut
59
66
  if data.include? "is_legit"
60
67
  self.is_legit = data["is_legit"]
61
68
  end
69
+ if data.include? "skip_gateway_rules"
70
+ self.skip_gateway_rules = data["skip_gateway_rules"]
71
+ end
62
72
 
63
73
  self
64
74
  end
@@ -72,6 +82,7 @@ module ProcessOut
72
82
  end
73
83
  self.score = data.fetch(:score, self.score)
74
84
  self.is_legit = data.fetch(:is_legit, self.is_legit)
85
+ self.skip_gateway_rules = data.fetch(:skip_gateway_rules, self.skip_gateway_rules)
75
86
 
76
87
  self
77
88
  end
@@ -19,6 +19,7 @@ module ProcessOut
19
19
  attr_reader :country_code
20
20
  attr_reader :zip
21
21
  attr_reader :phone_number
22
+ attr_reader :phone
22
23
  attr_reader :expects_shipping_at
23
24
  attr_reader :relay_store_name
24
25
 
@@ -67,6 +68,22 @@ module ProcessOut
67
68
  @phone_number = val
68
69
  end
69
70
 
71
+ def phone=(val)
72
+ if val.nil?
73
+ @phone = val
74
+ return
75
+ end
76
+
77
+ if val.instance_of? InvoiceShippingPhone
78
+ @phone = val
79
+ else
80
+ obj = InvoiceShippingPhone.new(@client)
81
+ obj.fill_with_data(val)
82
+ @phone = obj
83
+ end
84
+
85
+ end
86
+
70
87
  def expects_shipping_at=(val)
71
88
  @expects_shipping_at = val
72
89
  end
@@ -94,6 +111,7 @@ module ProcessOut
94
111
  self.country_code = data.fetch(:country_code, nil)
95
112
  self.zip = data.fetch(:zip, nil)
96
113
  self.phone_number = data.fetch(:phone_number, nil)
114
+ self.phone = data.fetch(:phone, nil)
97
115
  self.expects_shipping_at = data.fetch(:expects_shipping_at, nil)
98
116
  self.relay_store_name = data.fetch(:relay_store_name, nil)
99
117
 
@@ -118,6 +136,7 @@ module ProcessOut
118
136
  "country_code": self.country_code,
119
137
  "zip": self.zip,
120
138
  "phone_number": self.phone_number,
139
+ "phone": self.phone,
121
140
  "expects_shipping_at": self.expects_shipping_at,
122
141
  "relay_store_name": self.relay_store_name,
123
142
  }.to_json
@@ -163,6 +182,9 @@ module ProcessOut
163
182
  if data.include? "phone_number"
164
183
  self.phone_number = data["phone_number"]
165
184
  end
185
+ if data.include? "phone"
186
+ self.phone = data["phone"]
187
+ end
166
188
  if data.include? "expects_shipping_at"
167
189
  self.expects_shipping_at = data["expects_shipping_at"]
168
190
  end
@@ -191,6 +213,7 @@ module ProcessOut
191
213
  self.country_code = data.fetch(:country_code, self.country_code)
192
214
  self.zip = data.fetch(:zip, self.zip)
193
215
  self.phone_number = data.fetch(:phone_number, self.phone_number)
216
+ self.phone = data.fetch(:phone, self.phone)
194
217
  self.expects_shipping_at = data.fetch(:expects_shipping_at, self.expects_shipping_at)
195
218
  self.relay_store_name = data.fetch(:relay_store_name, self.relay_store_name)
196
219
 
@@ -0,0 +1,81 @@
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 InvoiceShippingPhone
10
+
11
+ attr_reader :number
12
+ attr_reader :dialing_code
13
+
14
+
15
+ def number=(val)
16
+ @number = val
17
+ end
18
+
19
+ def dialing_code=(val)
20
+ @dialing_code = val
21
+ end
22
+
23
+
24
+ # Initializes the InvoiceShippingPhone 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.number = data.fetch(:number, nil)
32
+ self.dialing_code = data.fetch(:dialing_code, nil)
33
+
34
+ end
35
+
36
+ # Create a new InvoiceShippingPhone using the current client
37
+ def new(data = {})
38
+ InvoiceShippingPhone.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
+ "number": self.number,
45
+ "dialing_code": self.dialing_code,
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? "number"
57
+ self.number = data["number"]
58
+ end
59
+ if data.include? "dialing_code"
60
+ self.dialing_code = data["dialing_code"]
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.number = data.fetch(:number, self.number)
74
+ self.dialing_code = data.fetch(:dialing_code, self.dialing_code)
75
+
76
+ self
77
+ end
78
+
79
+
80
+ end
81
+ end
@@ -0,0 +1,105 @@
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 InvoicesProcessNativePaymentResponse
10
+
11
+ attr_reader :transaction
12
+ attr_reader :native_apm
13
+
14
+
15
+ def transaction=(val)
16
+ if val.nil?
17
+ @transaction = val
18
+ return
19
+ end
20
+
21
+ if val.instance_of? Transaction
22
+ @transaction = val
23
+ else
24
+ obj = Transaction.new(@client)
25
+ obj.fill_with_data(val)
26
+ @transaction = obj
27
+ end
28
+
29
+ end
30
+
31
+ def native_apm=(val)
32
+ if val.nil?
33
+ @native_apm = val
34
+ return
35
+ end
36
+
37
+ if val.instance_of? NativeAPMResponse
38
+ @native_apm = val
39
+ else
40
+ obj = NativeAPMResponse.new(@client)
41
+ obj.fill_with_data(val)
42
+ @native_apm = obj
43
+ end
44
+
45
+ end
46
+
47
+
48
+ # Initializes the InvoicesProcessNativePaymentResponse object
49
+ # Params:
50
+ # +client+:: +ProcessOut+ client instance
51
+ # +data+:: data that can be used to fill the object
52
+ def initialize(client, data = {})
53
+ @client = client
54
+
55
+ self.transaction = data.fetch(:transaction, nil)
56
+ self.native_apm = data.fetch(:native_apm, nil)
57
+
58
+ end
59
+
60
+ # Create a new InvoicesProcessNativePaymentResponse using the current client
61
+ def new(data = {})
62
+ InvoicesProcessNativePaymentResponse.new(@client, data)
63
+ end
64
+
65
+ # Overrides the JSON marshaller to only send the fields we want
66
+ def to_json(options)
67
+ {
68
+ "transaction": self.transaction,
69
+ "native_apm": self.native_apm,
70
+ }.to_json
71
+ end
72
+
73
+ # Fills the object with data coming from the API
74
+ # Params:
75
+ # +data+:: +Hash+ of data coming from the API
76
+ def fill_with_data(data)
77
+ if data.nil?
78
+ return self
79
+ end
80
+ if data.include? "transaction"
81
+ self.transaction = data["transaction"]
82
+ end
83
+ if data.include? "native_apm"
84
+ self.native_apm = data["native_apm"]
85
+ end
86
+
87
+ self
88
+ end
89
+
90
+ # Prefills the object with the data passed as parameters
91
+ # Params:
92
+ # +data+:: +Hash+ of data
93
+ def prefill(data)
94
+ if data.nil?
95
+ return self
96
+ end
97
+ self.transaction = data.fetch(:transaction, self.transaction)
98
+ self.native_apm = data.fetch(:native_apm, self.native_apm)
99
+
100
+ self
101
+ end
102
+
103
+
104
+ end
105
+ end
@@ -0,0 +1,141 @@
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 NativeAPMParameterDefinition
10
+
11
+ attr_reader :key
12
+ attr_reader :type
13
+ attr_reader :required
14
+ attr_reader :length
15
+ attr_reader :display_name
16
+ attr_reader :available_values
17
+
18
+
19
+ def key=(val)
20
+ @key = val
21
+ end
22
+
23
+ def type=(val)
24
+ @type = val
25
+ end
26
+
27
+ def required=(val)
28
+ @required = val
29
+ end
30
+
31
+ def length=(val)
32
+ @length = val
33
+ end
34
+
35
+ def display_name=(val)
36
+ @display_name = val
37
+ end
38
+
39
+ def available_values=(val)
40
+ if val.nil?
41
+ @available_values = []
42
+ return
43
+ end
44
+
45
+ if val.length > 0 and val[0].instance_of? NativeAPMParameterValueDefinition
46
+ @available_values = val
47
+ else
48
+ l = Array.new
49
+ for v in val
50
+ obj = NativeAPMParameterValueDefinition.new(@client)
51
+ obj.fill_with_data(v)
52
+ l.push(obj)
53
+ end
54
+ @available_values = l
55
+ end
56
+
57
+ end
58
+
59
+
60
+ # Initializes the NativeAPMParameterDefinition object
61
+ # Params:
62
+ # +client+:: +ProcessOut+ client instance
63
+ # +data+:: data that can be used to fill the object
64
+ def initialize(client, data = {})
65
+ @client = client
66
+
67
+ self.key = data.fetch(:key, nil)
68
+ self.type = data.fetch(:type, nil)
69
+ self.required = data.fetch(:required, nil)
70
+ self.length = data.fetch(:length, nil)
71
+ self.display_name = data.fetch(:display_name, nil)
72
+ self.available_values = data.fetch(:available_values, nil)
73
+
74
+ end
75
+
76
+ # Create a new NativeAPMParameterDefinition using the current client
77
+ def new(data = {})
78
+ NativeAPMParameterDefinition.new(@client, data)
79
+ end
80
+
81
+ # Overrides the JSON marshaller to only send the fields we want
82
+ def to_json(options)
83
+ {
84
+ "key": self.key,
85
+ "type": self.type,
86
+ "required": self.required,
87
+ "length": self.length,
88
+ "display_name": self.display_name,
89
+ "available_values": self.available_values,
90
+ }.to_json
91
+ end
92
+
93
+ # Fills the object with data coming from the API
94
+ # Params:
95
+ # +data+:: +Hash+ of data coming from the API
96
+ def fill_with_data(data)
97
+ if data.nil?
98
+ return self
99
+ end
100
+ if data.include? "key"
101
+ self.key = data["key"]
102
+ end
103
+ if data.include? "type"
104
+ self.type = data["type"]
105
+ end
106
+ if data.include? "required"
107
+ self.required = data["required"]
108
+ end
109
+ if data.include? "length"
110
+ self.length = data["length"]
111
+ end
112
+ if data.include? "display_name"
113
+ self.display_name = data["display_name"]
114
+ end
115
+ if data.include? "available_values"
116
+ self.available_values = data["available_values"]
117
+ end
118
+
119
+ self
120
+ end
121
+
122
+ # Prefills the object with the data passed as parameters
123
+ # Params:
124
+ # +data+:: +Hash+ of data
125
+ def prefill(data)
126
+ if data.nil?
127
+ return self
128
+ end
129
+ self.key = data.fetch(:key, self.key)
130
+ self.type = data.fetch(:type, self.type)
131
+ self.required = data.fetch(:required, self.required)
132
+ self.length = data.fetch(:length, self.length)
133
+ self.display_name = data.fetch(:display_name, self.display_name)
134
+ self.available_values = data.fetch(:available_values, self.available_values)
135
+
136
+ self
137
+ end
138
+
139
+
140
+ end
141
+ end