cybersource_rest_client 0.0.29 → 0.0.33

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/lib/AuthenticationSDK/authentication/oauth/OAuthToken.rb +15 -0
  3. data/lib/AuthenticationSDK/core/Authorization.rb +4 -1
  4. data/lib/AuthenticationSDK/core/MerchantConfig.rb +93 -19
  5. data/lib/AuthenticationSDK/util/Constants.rb +78 -76
  6. data/lib/cybersource_rest_client.rb +19 -9
  7. data/lib/cybersource_rest_client/api/customer_payment_instrument_api.rb +3 -3
  8. data/lib/cybersource_rest_client/api/instrument_identifier_api.rb +3 -3
  9. data/lib/cybersource_rest_client/api/o_auth_api.rb +104 -0
  10. data/lib/cybersource_rest_client/api/payments_api.rb +2 -2
  11. data/lib/cybersource_rest_client/api/refund_api.rb +4 -4
  12. data/lib/cybersource_rest_client/api/void_api.rb +4 -4
  13. data/lib/cybersource_rest_client/api_client.rb +31 -8
  14. data/lib/cybersource_rest_client/configuration.rb +2 -2
  15. data/lib/cybersource_rest_client/models/access_token_response.rb +244 -0
  16. data/lib/cybersource_rest_client/models/add_negative_list_request.rb +1 -1
  17. data/lib/cybersource_rest_client/models/bad_request_error.rb +192 -0
  18. data/lib/cybersource_rest_client/models/create_access_token_request.rb +254 -0
  19. data/lib/cybersource_rest_client/models/fraud_marking_action_request.rb +1 -1
  20. data/lib/cybersource_rest_client/models/invoicing_v2_invoices_all_get200_response_customer_information.rb +20 -4
  21. data/lib/cybersource_rest_client/models/invoicingv2invoices_customer_information.rb +20 -4
  22. data/lib/cybersource_rest_client/models/{payment_instrument_list_for_customer.rb → payment_instrument_list.rb} +3 -3
  23. data/lib/cybersource_rest_client/models/{payment_instrument_list_for_customer__embedded.rb → payment_instrument_list__embedded.rb} +1 -1
  24. data/lib/cybersource_rest_client/models/{payment_instrument_list_for_customer__links.rb → payment_instrument_list__links.rb} +6 -6
  25. data/lib/cybersource_rest_client/models/{payment_instrument_list_for_customer__links_first.rb → payment_instrument_list__links_first.rb} +1 -1
  26. data/lib/cybersource_rest_client/models/{payment_instrument_list_for_customer__links_last.rb → payment_instrument_list__links_last.rb} +1 -1
  27. data/lib/cybersource_rest_client/models/{payment_instrument_list_for_customer__links_next.rb → payment_instrument_list__links_next.rb} +1 -1
  28. data/lib/cybersource_rest_client/models/{payment_instrument_list_for_customer__links_prev.rb → payment_instrument_list__links_prev.rb} +1 -1
  29. data/lib/cybersource_rest_client/models/{payment_instrument_list_for_customer__links_self.rb → payment_instrument_list__links_self.rb} +1 -1
  30. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response.rb +10 -1
  31. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_consumer_authentication_information.rb +11 -1
  32. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_order_information.rb +13 -4
  33. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_order_information_reward_points_details.rb +270 -0
  34. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_payment_account_information.rb +183 -0
  35. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_payment_account_information_card.rb +242 -0
  36. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_payment_information.rb +1 -1
  37. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_payment_information_tokenized_card.rb +1 -1
  38. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_processing_information.rb +1 -1
  39. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_processor_information.rb +17 -1
  40. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_processor_information_routing.rb +3 -3
  41. data/lib/cybersource_rest_client/models/pts_v2_payouts_post201_response_merchant_information_merchant_descriptor.rb +6 -0
  42. data/lib/cybersource_rest_client/models/pts_v2_payouts_post201_response_recipient_information_card.rb +1 -1
  43. data/lib/cybersource_rest_client/models/ptsv2credits_processing_information.rb +1 -1
  44. data/lib/cybersource_rest_client/models/ptsv2payments_client_reference_information.rb +1 -1
  45. data/lib/cybersource_rest_client/models/ptsv2payments_consumer_authentication_information.rb +60 -2
  46. data/lib/cybersource_rest_client/models/ptsv2payments_health_care_information_amount_details.rb +1 -1
  47. data/lib/cybersource_rest_client/models/ptsv2payments_merchant_information_merchant_descriptor.rb +6 -0
  48. data/lib/cybersource_rest_client/models/ptsv2payments_payment_information_card.rb +4 -4
  49. data/lib/cybersource_rest_client/models/ptsv2payments_payment_information_fluid_data.rb +3 -3
  50. data/lib/cybersource_rest_client/models/ptsv2payments_payment_information_tokenized_card.rb +1 -1
  51. data/lib/cybersource_rest_client/models/ptsv2payments_point_of_sale_information.rb +36 -38
  52. data/lib/cybersource_rest_client/models/ptsv2payments_processing_information.rb +15 -5
  53. data/lib/cybersource_rest_client/models/ptsv2payments_processing_information_authorization_options.rb +7 -7
  54. data/lib/cybersource_rest_client/models/ptsv2payments_recurring_payment_information.rb +24 -4
  55. data/lib/cybersource_rest_client/models/ptsv2payments_risk_information.rb +15 -4
  56. data/lib/cybersource_rest_client/models/ptsv2payments_risk_information_auxiliary_data.rb +207 -0
  57. data/lib/cybersource_rest_client/models/ptsv2paymentsidcaptures_payment_information_card.rb +1 -1
  58. data/lib/cybersource_rest_client/models/ptsv2paymentsidcaptures_processing_information.rb +15 -5
  59. data/lib/cybersource_rest_client/models/ptsv2paymentsidrefunds_payment_information_card.rb +4 -4
  60. data/lib/cybersource_rest_client/models/ptsv2paymentsidrefunds_processing_information.rb +1 -1
  61. data/lib/cybersource_rest_client/models/ptsv2paymentsidreversals_client_reference_information.rb +17 -1
  62. data/lib/cybersource_rest_client/models/ptsv2paymentsidreversals_processing_information.rb +1 -1
  63. data/lib/cybersource_rest_client/models/ptsv2payouts_merchant_information_merchant_descriptor.rb +6 -0
  64. data/lib/cybersource_rest_client/models/ptsv2payouts_payment_information_card.rb +4 -4
  65. data/lib/cybersource_rest_client/models/resource_not_found_error.rb +192 -0
  66. data/lib/cybersource_rest_client/models/riskv1authenticationresults_consumer_authentication_information.rb +1 -1
  67. data/lib/cybersource_rest_client/models/riskv1authenticationresults_payment_information_card.rb +3 -3
  68. data/lib/cybersource_rest_client/models/riskv1authenticationresults_payment_information_tokenized_card.rb +1 -1
  69. data/lib/cybersource_rest_client/models/riskv1authentications_payment_information_card.rb +3 -3
  70. data/lib/cybersource_rest_client/models/riskv1authentications_payment_information_tokenized_card.rb +1 -1
  71. data/lib/cybersource_rest_client/models/riskv1authenticationsetups_payment_information_card.rb +3 -3
  72. data/lib/cybersource_rest_client/models/riskv1authenticationsetups_payment_information_fluid_data.rb +3 -3
  73. data/lib/cybersource_rest_client/models/riskv1authenticationsetups_payment_information_tokenized_card.rb +1 -1
  74. data/lib/cybersource_rest_client/models/riskv1authenticationsetups_processing_information.rb +1 -1
  75. data/lib/cybersource_rest_client/models/riskv1decisions_client_reference_information.rb +17 -1
  76. data/lib/cybersource_rest_client/models/riskv1decisions_consumer_authentication_information.rb +1 -1
  77. data/lib/cybersource_rest_client/models/riskv1decisions_device_information.rb +1 -11
  78. data/lib/cybersource_rest_client/models/riskv1decisions_payment_information_card.rb +3 -3
  79. data/lib/cybersource_rest_client/models/riskv1decisions_payment_information_tokenized_card.rb +1 -1
  80. data/lib/cybersource_rest_client/models/riskv1decisions_risk_information.rb +15 -4
  81. data/lib/cybersource_rest_client/models/riskv1liststypeentries_client_reference_information.rb +224 -0
  82. data/lib/cybersource_rest_client/models/riskv1liststypeentries_payment_information_card.rb +1 -1
  83. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_payment_information_card.rb +5 -5
  84. data/lib/cybersource_rest_client/models/tss_v2_transactions_get200_response_processing_information_authorization_options.rb +13 -4
  85. data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response__embedded_payment_information_card.rb +3 -3
  86. data/lib/cybersource_rest_client/models/tss_v2_transactions_post201_response__embedded_processing_information.rb +1 -1
  87. data/lib/cybersource_rest_client/models/unauthorized_client_error.rb +192 -0
  88. data/lib/cybersource_rest_client/models/validate_export_compliance_request.rb +1 -1
  89. data/lib/cybersource_rest_client/models/verify_customer_address_request.rb +1 -1
  90. metadata +120 -101
  91. data/lib/AuthenticationSDK/resource/TRRReports.json +0 -12
  92. data/lib/AuthenticationSDK/resource/cybs.yml +0 -31
  93. data/lib/AuthenticationSDK/resource/request.json +0 -54
  94. data/lib/AuthenticationSDK/resource/request_capture.json +0 -11
  95. data/lib/AuthenticationSDK/resource/testrest.p12 +0 -0
  96. data/lib/AuthenticationSDK/spec/Authorization_spec.rb +0 -274
  97. data/lib/AuthenticationSDK/spec/MerchantConfigData.rb +0 -59
  98. data/lib/AuthenticationSDK/spec/MerchantConfig_spec.rb +0 -116
  99. data/lib/AuthenticationSDK/spec/PostRequestData.json +0 -54
  100. data/lib/AuthenticationSDK/spec/PutRequestData.json +0 -12
  101. data/lib/AuthenticationSDK/spec/ResponseCodeMessage_spec.rb +0 -60
  102. data/lib/AuthenticationSDK/spec/spec_helper.rb +0 -12
  103. data/lib/cybersource_rest_client/models/pts_v2_payments_post201_response_payment_information_card.rb +0 -184
@@ -1,116 +0,0 @@
1
- require_relative './MerchantConfigData.rb'
2
- require_relative './spec_helper'
3
-
4
- describe Merchantconfig do
5
- it 'Validating enablelog as null MerchantConfig File' do
6
- cybsPropertyobj=MerchantConfigData.new.merchantConfigProp
7
- cybsPropertyobj['enableLog']=''
8
- merchantConfigObj=Merchantconfig.new cybsPropertyobj
9
- expect(merchantConfigObj.enableLog).to eq true
10
- end
11
- it 'Validating logFileName as null MerchantConfig File' do
12
- cybsPropertyobj=MerchantConfigData.new.merchantConfigProp
13
- cybsPropertyobj['logFilename']=''
14
- merchantConfigObj=Merchantconfig.new cybsPropertyobj
15
- expect(merchantConfigObj.logFilename).to eq 'cybs'
16
- end
17
- it 'Validating enableLog as fixnum in MerchantConfig File' do
18
- cybsPropertyobj=MerchantConfigData.new.merchantConfigProp
19
- cybsPropertyobj['enableLog']=123
20
- merchantConfigObj=Merchantconfig.new cybsPropertyobj
21
- expect(merchantConfigObj.enableLog).to eq '123'
22
- end
23
- it 'Validating logDirectory as fixnum in MerchantConfig File' do
24
- cybsPropertyobj=MerchantConfigData.new.merchantConfigProp
25
- cybsPropertyobj['logDirectory']=''
26
- merchantConfigObj=Merchantconfig.new cybsPropertyobj
27
- expect(merchantConfigObj.logDirectory).to eq '../log'
28
- end
29
- it 'Validating RunEnvironment as Prod MerchantConfig File' do
30
- cybsPropertyobj=MerchantConfigData.new.merchantConfigProp
31
- cybsPropertyobj['runEnvironment']='Cybersource.Environment.Production'
32
- merchantConfigObj=Merchantconfig.new cybsPropertyobj
33
- expect(merchantConfigObj.requestHost).to eq 'api.cybersource.com'
34
- end
35
- it 'Validating RunEnvironment as default MerchantConfig File' do
36
- cybsPropertyobj=MerchantConfigData.new.merchantConfigProp
37
- cybsPropertyobj['runEnvironment']='api.cybersource.com'
38
- merchantConfigObj=Merchantconfig.new cybsPropertyobj
39
- expect(merchantConfigObj.requestHost).to eq 'api.cybersource.com'
40
- end
41
- it 'Validating MerchantId as empty in MerchantConfig File' do
42
- cybsPropertyobj=MerchantConfigData.new.merchantConfigProp
43
- cybsPropertyobj['merchantID']=''
44
- expect { Merchantconfig.new cybsPropertyobj }.to raise_error(StandardError)
45
- end
46
- it 'Validating authenticationType as empty in MerchantConfig File' do
47
- cybsPropertyobj=MerchantConfigData.new.merchantConfigProp
48
- cybsPropertyobj['authenticationType']=''
49
- expect { Merchantconfig.new cybsPropertyobj }.to raise_error(StandardError)
50
- end
51
- it 'Validating authenticationType as Fixnum in MerchantConfig File' do
52
- cybsPropertyobj=MerchantConfigData.new.merchantConfigProp
53
- cybsPropertyobj['authenticationType']=123
54
- expect { Merchantconfig.new cybsPropertyobj }.to raise_error(StandardError)
55
- end
56
- it 'Validating keyAlias as Fixnum MerchantConfig File' do
57
- cybsPropertyobj=MerchantConfigData.new.merchantConfigProp
58
- cybsPropertyobj['keyAlias']=123
59
- merchantConfigObj=Merchantconfig.new cybsPropertyobj
60
- expect(merchantConfigObj.keyAlias).to eq '123'
61
- end
62
- it 'Validating keyPass as Fixnum MerchantConfig File' do
63
- cybsPropertyobj=MerchantConfigData.new.merchantConfigProp
64
- cybsPropertyobj['keyPass']=123
65
- merchantConfigObj=Merchantconfig.new cybsPropertyobj
66
- expect(merchantConfigObj.keyPass).to eq '123'
67
- end
68
- it 'Validating keysDirectory as Fixnum MerchantConfig File' do
69
- cybsPropertyobj=MerchantConfigData.new.merchantConfigProp
70
- cybsPropertyobj['keysDirectory']=123
71
- merchantConfigObj=Merchantconfig.new cybsPropertyobj
72
- expect(merchantConfigObj.keysDirectory).to eq '123'
73
- end
74
- it 'Validating keyFilename as Fixnum MerchantConfig File' do
75
- cybsPropertyobj=MerchantConfigData.new.merchantConfigProp
76
- cybsPropertyobj['keyFilename']=123
77
- merchantConfigObj=Merchantconfig.new cybsPropertyobj
78
- expect(merchantConfigObj.keyFilename).to eq '123'
79
- end
80
- it 'Validating keyAlias as empty MerchantConfig File' do
81
- cybsPropertyobj=MerchantConfigData.new.merchantConfigProp
82
- cybsPropertyobj['keyAlias']=''
83
- merchantConfigObj=Merchantconfig.new cybsPropertyobj
84
- expect(merchantConfigObj.keyAlias).to eq 'testrest'
85
- end
86
- it 'Validating keyAlias not equal to merchantId MerchantConfig File' do
87
- cybsPropertyobj=MerchantConfigData.new.merchantConfigProp
88
- cybsPropertyobj['keyAlias']='test'
89
- merchantConfigObj=Merchantconfig.new cybsPropertyobj
90
- expect(merchantConfigObj.keyAlias).to eq 'testrest'
91
- end
92
- it 'Validating keyPass as empty MerchantConfig File' do
93
- cybsPropertyobj=MerchantConfigData.new.merchantConfigProp
94
- cybsPropertyobj['keyPass']=''
95
- merchantConfigObj=Merchantconfig.new cybsPropertyobj
96
- expect(merchantConfigObj.keyPass).to eq 'testrest'
97
- end
98
- it 'Validating keyFilename as empty MerchantConfig File' do
99
- cybsPropertyobj=MerchantConfigData.new.merchantConfigProp
100
- cybsPropertyobj['keyFilename']=''
101
- merchantConfigObj=Merchantconfig.new cybsPropertyobj
102
- expect(merchantConfigObj.keyFilename).to eq 'testrest'
103
- end
104
- it 'Validating merchantKeyId as empty MerchantConfig File' do
105
- cybsPropertyobj=MerchantConfigData.new.merchantConfigProp
106
- cybsPropertyobj['merchantKeyId']=''
107
- cybsPropertyobj['authenticationType']='http_signature'
108
- expect { Merchantconfig.new cybsPropertyobj }.to raise_error(StandardError)
109
- end
110
- it 'Validating merchantSecretKey as empty MerchantConfig File' do
111
- cybsPropertyobj=MerchantConfigData.new.merchantConfigProp
112
- cybsPropertyobj['merchantsecretKey']=''
113
- cybsPropertyobj['authenticationType']='http_signature'
114
- expect { Merchantconfig.new cybsPropertyobj }.to raise_error(StandardError)
115
- end
116
- end
@@ -1,54 +0,0 @@
1
- {
2
- "clientReferenceInformation": {
3
- "code": "TC50171_3"
4
- },
5
- "processingInformation": {
6
- "commerceIndicator": "internet"
7
- },
8
- "aggregatorInformation": {
9
- "subMerchant": {
10
- "cardAcceptorID": "1234567890",
11
- "country": "US",
12
- "phoneNumber": "650-432-0000",
13
- "address1": "900 Metro Center",
14
- "postalCode": "94404-2775",
15
- "locality": "Foster City",
16
- "name": "Visa Inc",
17
- "administrativeArea": "CA",
18
- "region": "PEN",
19
- "email": "test@cybs.com"
20
- },
21
- "name": "V-Internatio",
22
- "aggregatorID": "123456789"
23
- },
24
- "orderInformation": {
25
- "billTo": {
26
- "country": "US",
27
- "lastName": "VDP",
28
- "address2": "Address 2",
29
- "address1": "201 S. Division St.",
30
- "postalCode": "48104-2201",
31
- "locality": "Ann Arbor",
32
- "administrativeArea": "MI",
33
- "firstName": "RTS",
34
- "phoneNumber": "999999999",
35
- "district": "MI",
36
- "buildingNumber": "123",
37
- "company": "Visa",
38
- "email": "test@cybs.com"
39
- },
40
- "amountDetails": {
41
- "totalAmount": "102.21",
42
- "currency": "USD"
43
- }
44
- },
45
- "paymentInformation": {
46
- "card": {
47
- "expirationYear": "2031",
48
- "number": "5555555555554444",
49
- "securityCode": "123",
50
- "expirationMonth": "12",
51
- "type": "002"
52
- }
53
- }
54
- }
@@ -1,12 +0,0 @@
1
- {
2
- "startDay":"23",
3
- "timeZone":"America/Chicago",
4
- "reportDefinitionName":"TransactionRequestClass",
5
- "startTime":"1100",
6
- "reportFrequency":"DAILY",
7
- "ReportName":"TRRReport",
8
- "reportFormat":"xml",
9
- "orgId":"testrest",
10
- "reportType":"detail",
11
- "reportFields": ["Request.RequestID","Request.TransactionDate","Request.MerchantReferenceNumber","Request.MerchantID"]
12
- }
@@ -1,60 +0,0 @@
1
- require_relative './spec_helper'
2
- require_relative '../util/Utility.rb'
3
-
4
- describe Utility do
5
- it 'validating responsecode for 200' do
6
- responsecode = 200
7
- responsemessage = Utility.new.getResponseCodeMessage(responsecode)
8
- expect(responsemessage).to eq 'Transcation Successful'
9
- end
10
- it 'validating responsecode for 201' do
11
- responsecode = 200
12
- responsemessage = Utility.new.getResponseCodeMessage(responsecode)
13
- expect(responsemessage).to eq 'Transcation Successful'
14
- end
15
- it 'validating responsecode for 400' do
16
- responsecode = 400
17
- responsemessage = Utility.new.getResponseCodeMessage(responsecode)
18
- expect(responsemessage).to eq 'Bad Request'
19
- end
20
- it 'validating responsecode for 401' do
21
- responsecode = 401
22
- responsemessage = Utility.new.getResponseCodeMessage(responsecode)
23
- expect(responsemessage).to eq 'Authentication Failed'
24
- end
25
- it 'validating responsecode for 403' do
26
- responsecode = 403
27
- responsemessage = Utility.new.getResponseCodeMessage(responsecode)
28
- expect(responsemessage).to eq 'Forbidden'
29
- end
30
- it 'validating responsecode for 404' do
31
- responsecode = 404
32
- responsemessage = Utility.new.getResponseCodeMessage(responsecode)
33
- expect(responsemessage).to eq 'Not Found'
34
- end
35
- it 'validating responsecode for 500' do
36
- responsecode = 500
37
- responsemessage = Utility.new.getResponseCodeMessage(responsecode)
38
- expect(responsemessage).to eq 'Internal Server Error'
39
- end
40
- it 'validating responsecode for 502' do
41
- responsecode = 502
42
- responsemessage = Utility.new.getResponseCodeMessage(responsecode)
43
- expect(responsemessage).to eq 'Bad Gateway'
44
- end
45
- it 'validating responsecode for 503' do
46
- responsecode = 503
47
- responsemessage = Utility.new.getResponseCodeMessage(responsecode)
48
- expect(responsemessage).to eq 'Service Unavailable'
49
- end
50
- it 'validating responsecode for 504' do
51
- responsecode = 504
52
- responsemessage = Utility.new.getResponseCodeMessage(responsecode)
53
- expect(responsemessage).to eq 'Gateway Timeout'
54
- end
55
- it 'validating responsecode for invalid' do
56
- responsecode = 000
57
- responsemessage = Utility.new.getResponseCodeMessage(responsecode)
58
- expect(responsemessage).to eq ''
59
- end
60
- end
@@ -1,12 +0,0 @@
1
- require 'simplecov'
2
- SimpleCov.start
3
- require 'simplecov-json'
4
-
5
- SimpleCov.formatters = [
6
- SimpleCov::Formatter::HTMLFormatter,
7
- SimpleCov::Formatter::JSONFormatter,
8
- ]
9
-
10
- require_relative '../core/Authorization.rb'
11
- require_relative '../core/MerchantConfig.rb'
12
- require_relative '../util/Utility.rb'
@@ -1,184 +0,0 @@
1
- =begin
2
- #CyberSource Merged Spec
3
-
4
- #All CyberSource API specs merged together. These are available at https://developer.cybersource.com/api/reference/api-reference.html
5
-
6
- OpenAPI spec version: 0.0.1
7
-
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.2.3
10
-
11
- =end
12
-
13
- require 'date'
14
-
15
- module CyberSource
16
- class PtsV2PaymentsPost201ResponsePaymentInformationCard
17
- # Last four digits of the cardholder’s account number. This field is included in the reply message when the client software that is installed on the POS terminal uses the token management service (TMS) to retrieve tokenized payment details. You must contact customer support to have your account enabled to receive these fields in the credit reply message. #### PIN debit This field is returned only for tokenized transactions. You can use this value on the receipt that you give to the cardholder. Returned by PIN debit credit and PIN debit purchase. This field is supported only by the following processors: - American Express Direct - Credit Mutuel-CIC - FDC Nashville Global - OmniPay Direct - SIX
18
- attr_accessor :suffix
19
-
20
- # Attribute mapping from ruby-style variable name to JSON key.
21
- def self.attribute_map
22
- {
23
- :'suffix' => :'suffix'
24
- }
25
- end
26
-
27
- # Attribute type mapping.
28
- def self.swagger_types
29
- {
30
- :'suffix' => :'String'
31
- }
32
- end
33
-
34
- # Initializes the object
35
- # @param [Hash] attributes Model attributes in the form of hash
36
- def initialize(attributes = {})
37
- return unless attributes.is_a?(Hash)
38
-
39
- # convert string to symbol for hash key
40
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
41
-
42
- if attributes.has_key?(:'suffix')
43
- self.suffix = attributes[:'suffix']
44
- end
45
- end
46
-
47
- # Show invalid properties with the reasons. Usually used together with valid?
48
- # @return Array for valid properties with the reasons
49
- def list_invalid_properties
50
- invalid_properties = Array.new
51
- invalid_properties
52
- end
53
-
54
- # Check to see if the all the properties in the model are valid
55
- # @return true if the model is valid
56
- def valid?
57
- true
58
- end
59
-
60
- # Checks equality by comparing each attribute.
61
- # @param [Object] Object to be compared
62
- def ==(o)
63
- return true if self.equal?(o)
64
- self.class == o.class &&
65
- suffix == o.suffix
66
- end
67
-
68
- # @see the `==` method
69
- # @param [Object] Object to be compared
70
- def eql?(o)
71
- self == o
72
- end
73
-
74
- # Calculates hash code according to all attributes.
75
- # @return [Fixnum] Hash code
76
- def hash
77
- [suffix].hash
78
- end
79
-
80
- # Builds the object from hash
81
- # @param [Hash] attributes Model attributes in the form of hash
82
- # @return [Object] Returns the model itself
83
- def build_from_hash(attributes)
84
- return nil unless attributes.is_a?(Hash)
85
- self.class.swagger_types.each_pair do |key, type|
86
- if type =~ /\AArray<(.*)>/i
87
- # check to ensure the input is an array given that the the attribute
88
- # is documented as an array but the input is not
89
- if attributes[self.class.attribute_map[key]].is_a?(Array)
90
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
91
- end
92
- elsif !attributes[self.class.attribute_map[key]].nil?
93
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
94
- end # or else data not found in attributes(hash), not an issue as the data can be optional
95
- end
96
-
97
- self
98
- end
99
-
100
- # Deserializes the data based on type
101
- # @param string type Data type
102
- # @param string value Value to be deserialized
103
- # @return [Object] Deserialized data
104
- def _deserialize(type, value)
105
- case type.to_sym
106
- when :DateTime
107
- DateTime.parse(value)
108
- when :Date
109
- Date.parse(value)
110
- when :String
111
- value.to_s
112
- when :Integer
113
- value.to_i
114
- when :Float
115
- value.to_f
116
- when :BOOLEAN
117
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
118
- true
119
- else
120
- false
121
- end
122
- when :Object
123
- # generic object (usually a Hash), return directly
124
- value
125
- when /\AArray<(?<inner_type>.+)>\z/
126
- inner_type = Regexp.last_match[:inner_type]
127
- value.map { |v| _deserialize(inner_type, v) }
128
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
129
- k_type = Regexp.last_match[:k_type]
130
- v_type = Regexp.last_match[:v_type]
131
- {}.tap do |hash|
132
- value.each do |k, v|
133
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
134
- end
135
- end
136
- else # model
137
- temp_model = CyberSource.const_get(type).new
138
- temp_model.build_from_hash(value)
139
- end
140
- end
141
-
142
- # Returns the string representation of the object
143
- # @return [String] String presentation of the object
144
- def to_s
145
- to_hash.to_s
146
- end
147
-
148
- # to_body is an alias to to_hash (backward compatibility)
149
- # @return [Hash] Returns the object in the form of hash
150
- def to_body
151
- to_hash
152
- end
153
-
154
- # Returns the object in the form of hash
155
- # @return [Hash] Returns the object in the form of hash
156
- def to_hash
157
- hash = {}
158
- self.class.attribute_map.each_pair do |attr, param|
159
- value = self.send(attr)
160
- next if value.nil?
161
- hash[param] = _to_hash(value)
162
- end
163
- hash
164
- end
165
-
166
- # Outputs non-array value in the form of hash
167
- # For object, use to_hash. Otherwise, just return the value
168
- # @param [Object] value Any valid value
169
- # @return [Hash] Returns the value in the form of hash
170
- def _to_hash(value)
171
- if value.is_a?(Array)
172
- value.compact.map { |v| _to_hash(v) }
173
- elsif value.is_a?(Hash)
174
- {}.tap do |hash|
175
- value.each { |k, v| hash[k] = _to_hash(v) }
176
- end
177
- elsif value.respond_to? :to_hash
178
- value.to_hash
179
- else
180
- value
181
- end
182
- end
183
- end
184
- end