cybersource_rest_client 0.0.80 → 0.0.81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/AuthenticationSDK/authentication/jwt/JwtToken.rb +17 -7
- data/lib/AuthenticationSDK/core/Authorization.rb +2 -2
- data/lib/AuthenticationSDK/core/MerchantConfig.rb +277 -23
- data/lib/AuthenticationSDK/util/Cache.rb +144 -8
- data/lib/AuthenticationSDK/util/CachedMLEKId.rb +17 -0
- data/lib/AuthenticationSDK/util/CertificateUtility.rb +109 -29
- data/lib/AuthenticationSDK/util/Constants.rb +4 -0
- data/lib/AuthenticationSDK/util/MLEUtility.rb +167 -11
- data/lib/AuthenticationSDK/util/Utility.rb +37 -1
- data/lib/cybersource_rest_client/api/bank_account_validation_api.rb +6 -2
- data/lib/cybersource_rest_client/api/batches_api.rb +24 -8
- data/lib/cybersource_rest_client/api/billing_agreements_api.rb +18 -6
- data/lib/cybersource_rest_client/api/bin_lookup_api.rb +6 -2
- data/lib/cybersource_rest_client/api/capture_api.rb +6 -2
- data/lib/cybersource_rest_client/api/chargeback_details_api.rb +6 -2
- data/lib/cybersource_rest_client/api/chargeback_summaries_api.rb +6 -2
- data/lib/cybersource_rest_client/api/conversion_details_api.rb +6 -2
- data/lib/cybersource_rest_client/api/create_new_webhooks_api.rb +18 -6
- data/lib/cybersource_rest_client/api/credit_api.rb +6 -2
- data/lib/cybersource_rest_client/api/customer_api.rb +24 -8
- data/lib/cybersource_rest_client/api/customer_payment_instrument_api.rb +30 -10
- data/lib/cybersource_rest_client/api/customer_shipping_address_api.rb +30 -10
- data/lib/cybersource_rest_client/api/decision_manager_api.rb +30 -10
- data/lib/cybersource_rest_client/api/device_de_association_api.rb +12 -4
- data/lib/cybersource_rest_client/api/device_search_api.rb +12 -4
- data/lib/cybersource_rest_client/api/download_dtd_api.rb +6 -2
- data/lib/cybersource_rest_client/api/download_xsd_api.rb +6 -2
- data/lib/cybersource_rest_client/api/emv_tag_details_api.rb +12 -4
- data/lib/cybersource_rest_client/api/enrollment_api.rb +104 -0
- data/lib/cybersource_rest_client/api/flex_api_api.rb +6 -2
- data/lib/cybersource_rest_client/api/instructions_api.rb +452 -0
- data/lib/cybersource_rest_client/api/instrument_identifier_api.rb +36 -12
- data/lib/cybersource_rest_client/api/interchange_clearing_level_details_api.rb +6 -2
- data/lib/cybersource_rest_client/api/invoice_settings_api.rb +12 -4
- data/lib/cybersource_rest_client/api/invoices_api.rb +42 -14
- data/lib/cybersource_rest_client/api/manage_webhooks_api.rb +42 -14
- data/lib/cybersource_rest_client/api/merchant_boarding_api.rb +12 -4
- data/lib/cybersource_rest_client/api/merchant_defined_fields_api.rb +24 -8
- data/lib/cybersource_rest_client/api/microform_integration_api.rb +6 -2
- data/lib/cybersource_rest_client/api/net_fundings_api.rb +6 -2
- data/lib/cybersource_rest_client/api/notification_of_changes_api.rb +6 -2
- data/lib/cybersource_rest_client/api/offers_api.rb +12 -4
- data/lib/cybersource_rest_client/api/orders_api.rb +12 -4
- data/lib/cybersource_rest_client/api/payer_authentication_api.rb +18 -6
- data/lib/cybersource_rest_client/api/payment_batch_summaries_api.rb +6 -2
- data/lib/cybersource_rest_client/api/payment_instrument_api.rb +24 -8
- data/lib/cybersource_rest_client/api/payment_links_api.rb +24 -8
- data/lib/cybersource_rest_client/api/payment_tokens_api.rb +6 -2
- data/lib/cybersource_rest_client/api/payments_api.rb +36 -12
- data/lib/cybersource_rest_client/api/payouts_api.rb +6 -2
- data/lib/cybersource_rest_client/api/plans_api.rb +48 -16
- data/lib/cybersource_rest_client/api/purchase_and_refund_details_api.rb +6 -2
- data/lib/cybersource_rest_client/api/push_funds_api.rb +6 -2
- data/lib/cybersource_rest_client/api/refund_api.rb +12 -4
- data/lib/cybersource_rest_client/api/report_definitions_api.rb +12 -4
- data/lib/cybersource_rest_client/api/report_downloads_api.rb +6 -2
- data/lib/cybersource_rest_client/api/report_subscriptions_api.rb +30 -10
- data/lib/cybersource_rest_client/api/reports_api.rb +18 -6
- data/lib/cybersource_rest_client/api/retrieval_details_api.rb +6 -2
- data/lib/cybersource_rest_client/api/retrieval_summaries_api.rb +6 -2
- data/lib/cybersource_rest_client/api/reversal_api.rb +12 -4
- data/lib/cybersource_rest_client/api/search_transactions_api.rb +12 -4
- data/lib/cybersource_rest_client/api/secure_file_share_api.rb +12 -4
- data/lib/cybersource_rest_client/api/subscriptions_api.rb +48 -16
- data/lib/cybersource_rest_client/api/subscriptions_follow_ons_api.rb +12 -4
- data/lib/cybersource_rest_client/api/taxes_api.rb +12 -4
- data/lib/cybersource_rest_client/api/token_api.rb +12 -4
- data/lib/cybersource_rest_client/api/tokenize_api.rb +6 -2
- data/lib/cybersource_rest_client/api/tokenized_card_api.rb +24 -8
- data/lib/cybersource_rest_client/api/transaction_batches_api.rb +24 -8
- data/lib/cybersource_rest_client/api/transaction_details_api.rb +6 -2
- data/lib/cybersource_rest_client/api/transient_token_data_api.rb +12 -4
- data/lib/cybersource_rest_client/api/unified_checkout_capture_context_api.rb +6 -2
- data/lib/cybersource_rest_client/api/user_management_api.rb +6 -2
- data/lib/cybersource_rest_client/api/user_management_search_api.rb +6 -2
- data/lib/cybersource_rest_client/api/verification_api.rb +12 -4
- data/lib/cybersource_rest_client/api/void_api.rb +30 -10
- data/lib/cybersource_rest_client/api_client.rb +20 -3
- data/lib/cybersource_rest_client/models/acpv1instructions_decline_threshold.rb +232 -0
- data/lib/cybersource_rest_client/models/acpv1instructions_mandates.rb +405 -0
- data/lib/cybersource_rest_client/models/acpv1instructions_recurring_payment_information.rb +191 -0
- data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idconf_processor_info_payment_instrument_verifi_results.rb +213 -0
- data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idconfirmations_confirmation_data.rb +229 -0
- data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idconfirmations_merchant_information.rb +258 -0
- data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idconfirmations_order_information.rb +377 -0
- data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idconfirmations_order_information_shipping_details.rb +206 -0
- data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idconfirmations_processor_information.rb +425 -0
- data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idconfirmations_processor_information_payment_instrument.rb +190 -0
- data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_attachments.rb +258 -0
- data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_client_reference_information.rb +215 -0
- data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_mandate_reference_data.rb +205 -0
- data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_merchant_information.rb +334 -0
- data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_merchant_information_merchant_descriptor.rb +250 -0
- data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_order_information.rb +228 -0
- data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_order_information_amount_detail.rb +354 -0
- data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_order_information_items.rb +367 -0
- data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_order_information_items_additional_info.rb +231 -0
- data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_order_information_items_policies.rb +346 -0
- data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_order_information_line_items.rb +190 -0
- data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_order_information_ship_to.rb +686 -0
- data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_payment_options.rb +217 -0
- data/lib/cybersource_rest_client/models/acpv1instructionsinstruction_idcredentials_transaction_data.rb +348 -0
- data/lib/cybersource_rest_client/models/acpv1tokens_assurance_data.rb +313 -0
- data/lib/cybersource_rest_client/models/acpv1tokens_authenticated_identities.rb +237 -0
- data/lib/cybersource_rest_client/models/acpv1tokens_authentication_context.rb +191 -0
- data/lib/cybersource_rest_client/models/acpv1tokens_bill_to.rb +400 -0
- data/lib/cybersource_rest_client/models/acpv1tokens_buyer_information.rb +229 -0
- data/lib/cybersource_rest_client/models/acpv1tokens_buyer_information_personal_identification.rb +212 -0
- data/lib/cybersource_rest_client/models/acpv1tokens_consent_data.rb +297 -0
- data/lib/cybersource_rest_client/models/acpv1tokens_consumer_identity.rb +268 -0
- data/lib/cybersource_rest_client/models/acpv1tokens_device_information.rb +378 -0
- data/lib/cybersource_rest_client/models/acpv1tokens_device_information_device_data.rb +302 -0
- data/lib/cybersource_rest_client/models/acpv1tokens_enrollment_reference_data.rb +207 -0
- data/lib/cybersource_rest_client/models/acpv1tokens_payment_information.rb +215 -0
- data/lib/cybersource_rest_client/models/acpv1tokens_payment_information_customer.rb +197 -0
- data/lib/cybersource_rest_client/models/acpv1tokens_payment_information_instrument_identifier.rb +206 -0
- data/lib/cybersource_rest_client/models/acpv1tokens_payment_information_payment_instrument.rb +197 -0
- data/lib/cybersource_rest_client/models/agentic_cancel_purchase_intent_request.rb +257 -0
- data/lib/cybersource_rest_client/models/agentic_card_enrollment_bad_request_response400.rb +189 -0
- data/lib/cybersource_rest_client/models/agentic_card_enrollment_bad_request_response400_error.rb +238 -0
- data/lib/cybersource_rest_client/models/agentic_card_enrollment_bad_request_response400_error_detail.rb +224 -0
- data/lib/cybersource_rest_client/models/agentic_card_enrollment_request.rb +325 -0
- data/lib/cybersource_rest_client/models/agentic_card_enrollment_response200.rb +206 -0
- data/lib/cybersource_rest_client/models/agentic_card_enrollment_response202.rb +219 -0
- data/lib/cybersource_rest_client/models/agentic_confirm_transaction_events_request.rb +247 -0
- data/lib/cybersource_rest_client/models/agentic_confirm_transaction_events_response202.rb +195 -0
- data/lib/cybersource_rest_client/models/agentic_create_purchase_intent_request.rb +327 -0
- data/lib/cybersource_rest_client/models/agentic_create_purchase_intent_response200.rb +222 -0
- data/lib/cybersource_rest_client/models/agentic_pending_purchase_intent_response202.rb +241 -0
- data/lib/cybersource_rest_client/models/agentic_retrieve_payment_credentials_request.rb +247 -0
- data/lib/cybersource_rest_client/models/agentic_retrieve_payment_credentials_response200.rb +200 -0
- data/lib/cybersource_rest_client/models/agentic_retrieve_payment_credentials_response200_transaction_response_complete.rb +244 -0
- data/lib/cybersource_rest_client/models/agentic_retrieve_payment_credentials_response200_transaction_response_with_pending_events.rb +235 -0
- data/lib/cybersource_rest_client/models/agentic_update_purchase_intent_request.rb +315 -0
- data/lib/cybersource_rest_client/models/boardingv1registrations_organization_information_business_information.rb +36 -1
- data/lib/cybersource_rest_client/models/boardingv1registrations_organization_information_business_information_localized_names.rb +254 -0
- data/lib/cybersource_rest_client/models/ptsv2payments_travel_information_transit_airline_ancillary_information.rb +22 -5
- data/lib/cybersource_rest_client/models/ptsv2payments_travel_information_transit_airline_ancillary_information_service.rb +39 -5
- data/lib/cybersource_rest_client/models/ptsv2paymentsidrefunds_travel_information.rb +246 -0
- data/lib/cybersource_rest_client/models/ptsv2paymentsidrefunds_travel_information_transit.rb +189 -0
- data/lib/cybersource_rest_client/models/ptsv2paymentsidrefunds_travel_information_transit_airline.rb +889 -0
- data/lib/cybersource_rest_client/models/ptsv2paymentsidrefunds_travel_information_transit_airline_ancillary_information.rb +259 -0
- data/lib/cybersource_rest_client/models/ptsv2paymentsidrefunds_travel_information_transit_airline_ancillary_information_service.rb +213 -0
- data/lib/cybersource_rest_client/models/refund_capture_request.rb +1 -1
- data/lib/cybersource_rest_client/models/refund_payment_request.rb +1 -1
- data/lib/cybersource_rest_client/models/upv1capturecontexts_data.rb +4 -2
- data/lib/cybersource_rest_client/models/upv1capturecontexts_data_merchant_defined_information.rb +3 -2
- data/lib/cybersource_rest_client/utilities/jwe_utility.rb +1 -1
- data/lib/cybersource_rest_client.rb +64 -0
- metadata +68 -3
- /data/lib/AuthenticationSDK/util/{JWEUtility.rb → AuthJWEUtility.rb} +0 -0
|
@@ -0,0 +1,378 @@
|
|
|
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.4.38
|
|
10
|
+
=end
|
|
11
|
+
|
|
12
|
+
require 'date'
|
|
13
|
+
|
|
14
|
+
module CyberSource
|
|
15
|
+
# Device and Application instance data.
|
|
16
|
+
class Acpv1tokensDeviceInformation
|
|
17
|
+
# Base64 Encoded userAgent string of the connecting client application, with no padding. User agent string of the connecting client application. Conditionality: - Required for browsers - Optional for non-browsers
|
|
18
|
+
attr_accessor :user_agent
|
|
19
|
+
|
|
20
|
+
# Name of the connecting client application.
|
|
21
|
+
attr_accessor :application_name
|
|
22
|
+
|
|
23
|
+
# Device Fingerprinting Session identifier.
|
|
24
|
+
attr_accessor :fingerprint_session_id
|
|
25
|
+
|
|
26
|
+
# ISO 3166-1 alpha-2 country code. The country where the Consumer is accessing the service from.
|
|
27
|
+
attr_accessor :country
|
|
28
|
+
|
|
29
|
+
attr_accessor :device_data
|
|
30
|
+
|
|
31
|
+
# IP address of the consumer's device.
|
|
32
|
+
attr_accessor :ip_address
|
|
33
|
+
|
|
34
|
+
# Unique identifier of the consumer's device.
|
|
35
|
+
attr_accessor :client_device_id
|
|
36
|
+
|
|
37
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
38
|
+
def self.attribute_map
|
|
39
|
+
{
|
|
40
|
+
:'user_agent' => :'userAgent',
|
|
41
|
+
:'application_name' => :'applicationName',
|
|
42
|
+
:'fingerprint_session_id' => :'fingerprintSessionId',
|
|
43
|
+
:'country' => :'country',
|
|
44
|
+
:'device_data' => :'deviceData',
|
|
45
|
+
:'ip_address' => :'ipAddress',
|
|
46
|
+
:'client_device_id' => :'clientDeviceId'
|
|
47
|
+
}
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Attribute mapping from JSON key to ruby-style variable name.
|
|
51
|
+
def self.json_map
|
|
52
|
+
{
|
|
53
|
+
:'user_agent' => :'user_agent',
|
|
54
|
+
:'application_name' => :'application_name',
|
|
55
|
+
:'fingerprint_session_id' => :'fingerprint_session_id',
|
|
56
|
+
:'country' => :'country',
|
|
57
|
+
:'device_data' => :'device_data',
|
|
58
|
+
:'ip_address' => :'ip_address',
|
|
59
|
+
:'client_device_id' => :'client_device_id'
|
|
60
|
+
}
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# Attribute type mapping.
|
|
64
|
+
def self.swagger_types
|
|
65
|
+
{
|
|
66
|
+
:'user_agent' => :'String',
|
|
67
|
+
:'application_name' => :'String',
|
|
68
|
+
:'fingerprint_session_id' => :'String',
|
|
69
|
+
:'country' => :'String',
|
|
70
|
+
:'device_data' => :'Acpv1tokensDeviceInformationDeviceData',
|
|
71
|
+
:'ip_address' => :'String',
|
|
72
|
+
:'client_device_id' => :'String'
|
|
73
|
+
}
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# Initializes the object
|
|
77
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
78
|
+
def initialize(attributes = {})
|
|
79
|
+
return unless attributes.is_a?(Hash)
|
|
80
|
+
|
|
81
|
+
# convert string to symbol for hash key
|
|
82
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
|
83
|
+
|
|
84
|
+
if attributes.has_key?(:'userAgent')
|
|
85
|
+
self.user_agent = attributes[:'userAgent']
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
if attributes.has_key?(:'applicationName')
|
|
89
|
+
self.application_name = attributes[:'applicationName']
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
if attributes.has_key?(:'fingerprintSessionId')
|
|
93
|
+
self.fingerprint_session_id = attributes[:'fingerprintSessionId']
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
if attributes.has_key?(:'country')
|
|
97
|
+
self.country = attributes[:'country']
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
if attributes.has_key?(:'deviceData')
|
|
101
|
+
self.device_data = attributes[:'deviceData']
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
if attributes.has_key?(:'ipAddress')
|
|
105
|
+
self.ip_address = attributes[:'ipAddress']
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
if attributes.has_key?(:'clientDeviceId')
|
|
109
|
+
self.client_device_id = attributes[:'clientDeviceId']
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
114
|
+
# @return Array for valid properties with the reasons
|
|
115
|
+
def list_invalid_properties
|
|
116
|
+
invalid_properties = Array.new
|
|
117
|
+
#if !@user_agent.nil? && @user_agent !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)
|
|
118
|
+
#invalid_properties.push('invalid value for "user_agent", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/.')
|
|
119
|
+
#end
|
|
120
|
+
|
|
121
|
+
if @application_name.nil?
|
|
122
|
+
invalid_properties.push('invalid value for "application_name", application_name cannot be nil.')
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
#if @application_name !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)
|
|
126
|
+
#invalid_properties.push('invalid value for "application_name", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/.')
|
|
127
|
+
#end
|
|
128
|
+
|
|
129
|
+
if @fingerprint_session_id.nil?
|
|
130
|
+
invalid_properties.push('invalid value for "fingerprint_session_id", fingerprint_session_id cannot be nil.')
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
#if @fingerprint_session_id !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)
|
|
134
|
+
#invalid_properties.push('invalid value for "fingerprint_session_id", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/.')
|
|
135
|
+
#end
|
|
136
|
+
|
|
137
|
+
#if !@country.nil? && @country !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.+$/)
|
|
138
|
+
#invalid_properties.push('invalid value for "country", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.+$/.')
|
|
139
|
+
#end
|
|
140
|
+
|
|
141
|
+
if @device_data.nil?
|
|
142
|
+
invalid_properties.push('invalid value for "device_data", device_data cannot be nil.')
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
if @ip_address.nil?
|
|
146
|
+
invalid_properties.push('invalid value for "ip_address", ip_address cannot be nil.')
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
#if @ip_address !~ Regexp.new(/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(?:[^0-9]*(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))*$/)
|
|
150
|
+
#invalid_properties.push('invalid value for "ip_address", must conform to the pattern /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(?:[^0-9]*(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))*$/.')
|
|
151
|
+
#end
|
|
152
|
+
|
|
153
|
+
#if !@client_device_id.nil? && @client_device_id !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)
|
|
154
|
+
#invalid_properties.push('invalid value for "client_device_id", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/.')
|
|
155
|
+
#end
|
|
156
|
+
|
|
157
|
+
invalid_properties
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
# Check to see if the all the properties in the model are valid
|
|
161
|
+
# @return true if the model is valid
|
|
162
|
+
def valid?
|
|
163
|
+
#return false if !@user_agent.nil? && @user_agent !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)
|
|
164
|
+
return false if @application_name.nil?
|
|
165
|
+
#return false if @application_name !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)
|
|
166
|
+
return false if @fingerprint_session_id.nil?
|
|
167
|
+
#return false if @fingerprint_session_id !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)
|
|
168
|
+
#return false if !@country.nil? && @country !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.+$/)
|
|
169
|
+
return false if @device_data.nil?
|
|
170
|
+
return false if @ip_address.nil?
|
|
171
|
+
#return false if @ip_address !~ Regexp.new(/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(?:[^0-9]*(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))*$/)
|
|
172
|
+
#return false if !@client_device_id.nil? && @client_device_id !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)
|
|
173
|
+
true
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
# Custom attribute writer method with validation
|
|
177
|
+
# @param [Object] user_agent Value to be assigned
|
|
178
|
+
def user_agent=(user_agent)
|
|
179
|
+
#if !user_agent.nil? && user_agent !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)
|
|
180
|
+
#fail ArgumentError, 'invalid value for "user_agent", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/.'
|
|
181
|
+
#end
|
|
182
|
+
|
|
183
|
+
@user_agent = user_agent
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
# Custom attribute writer method with validation
|
|
187
|
+
# @param [Object] application_name Value to be assigned
|
|
188
|
+
def application_name=(application_name)
|
|
189
|
+
#if application_name.nil?
|
|
190
|
+
#fail ArgumentError, 'application_name cannot be nil'
|
|
191
|
+
#end
|
|
192
|
+
|
|
193
|
+
#if application_name !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)
|
|
194
|
+
#fail ArgumentError, 'invalid value for "application_name", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/.'
|
|
195
|
+
#end
|
|
196
|
+
|
|
197
|
+
@application_name = application_name
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
# Custom attribute writer method with validation
|
|
201
|
+
# @param [Object] fingerprint_session_id Value to be assigned
|
|
202
|
+
def fingerprint_session_id=(fingerprint_session_id)
|
|
203
|
+
#if fingerprint_session_id.nil?
|
|
204
|
+
#fail ArgumentError, 'fingerprint_session_id cannot be nil'
|
|
205
|
+
#end
|
|
206
|
+
|
|
207
|
+
#if fingerprint_session_id !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)
|
|
208
|
+
#fail ArgumentError, 'invalid value for "fingerprint_session_id", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/.'
|
|
209
|
+
#end
|
|
210
|
+
|
|
211
|
+
@fingerprint_session_id = fingerprint_session_id
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
# Custom attribute writer method with validation
|
|
215
|
+
# @param [Object] country Value to be assigned
|
|
216
|
+
def country=(country)
|
|
217
|
+
#if !country.nil? && country !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.+$/)
|
|
218
|
+
#fail ArgumentError, 'invalid value for "country", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.+$/.'
|
|
219
|
+
#end
|
|
220
|
+
|
|
221
|
+
@country = country
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
# Custom attribute writer method with validation
|
|
225
|
+
# @param [Object] ip_address Value to be assigned
|
|
226
|
+
def ip_address=(ip_address)
|
|
227
|
+
#if ip_address.nil?
|
|
228
|
+
#fail ArgumentError, 'ip_address cannot be nil'
|
|
229
|
+
#end
|
|
230
|
+
|
|
231
|
+
#if ip_address !~ Regexp.new(/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(?:[^0-9]*(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))*$/)
|
|
232
|
+
#fail ArgumentError, 'invalid value for "ip_address", must conform to the pattern /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(?:[^0-9]*(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))*$/.'
|
|
233
|
+
#end
|
|
234
|
+
|
|
235
|
+
@ip_address = ip_address
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
# Custom attribute writer method with validation
|
|
239
|
+
# @param [Object] client_device_id Value to be assigned
|
|
240
|
+
def client_device_id=(client_device_id)
|
|
241
|
+
#if !client_device_id.nil? && client_device_id !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)
|
|
242
|
+
#fail ArgumentError, 'invalid value for "client_device_id", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/.'
|
|
243
|
+
#end
|
|
244
|
+
|
|
245
|
+
@client_device_id = client_device_id
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
# Checks equality by comparing each attribute.
|
|
249
|
+
# @param [Object] Object to be compared
|
|
250
|
+
def ==(o)
|
|
251
|
+
return true if self.equal?(o)
|
|
252
|
+
self.class == o.class &&
|
|
253
|
+
user_agent == o.user_agent &&
|
|
254
|
+
application_name == o.application_name &&
|
|
255
|
+
fingerprint_session_id == o.fingerprint_session_id &&
|
|
256
|
+
country == o.country &&
|
|
257
|
+
device_data == o.device_data &&
|
|
258
|
+
ip_address == o.ip_address &&
|
|
259
|
+
client_device_id == o.client_device_id
|
|
260
|
+
end
|
|
261
|
+
|
|
262
|
+
# @see the `==` method
|
|
263
|
+
# @param [Object] Object to be compared
|
|
264
|
+
def eql?(o)
|
|
265
|
+
self == o
|
|
266
|
+
end
|
|
267
|
+
|
|
268
|
+
# Calculates hash code according to all attributes.
|
|
269
|
+
# @return [Fixnum] Hash code
|
|
270
|
+
def hash
|
|
271
|
+
[user_agent, application_name, fingerprint_session_id, country, device_data, ip_address, client_device_id].hash
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
# Builds the object from hash
|
|
275
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
276
|
+
# @return [Object] Returns the model itself
|
|
277
|
+
def build_from_hash(attributes)
|
|
278
|
+
return nil unless attributes.is_a?(Hash)
|
|
279
|
+
self.class.swagger_types.each_pair do |key, type|
|
|
280
|
+
if type =~ /\AArray<(.*)>/i
|
|
281
|
+
# check to ensure the input is an array given that the the attribute
|
|
282
|
+
# is documented as an array but the input is not
|
|
283
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
284
|
+
self.send("#{self.class.json_map[key]}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
285
|
+
end
|
|
286
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
287
|
+
self.send("#{self.class.json_map[key]}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
288
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
self
|
|
292
|
+
end
|
|
293
|
+
|
|
294
|
+
# Deserializes the data based on type
|
|
295
|
+
# @param string type Data type
|
|
296
|
+
# @param string value Value to be deserialized
|
|
297
|
+
# @return [Object] Deserialized data
|
|
298
|
+
def _deserialize(type, value)
|
|
299
|
+
case type.to_sym
|
|
300
|
+
when :DateTime
|
|
301
|
+
DateTime.parse(value)
|
|
302
|
+
when :Date
|
|
303
|
+
Date.parse(value)
|
|
304
|
+
when :String
|
|
305
|
+
value.to_s
|
|
306
|
+
when :Integer
|
|
307
|
+
value.to_i
|
|
308
|
+
when :Float
|
|
309
|
+
value.to_f
|
|
310
|
+
when :BOOLEAN
|
|
311
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
312
|
+
true
|
|
313
|
+
else
|
|
314
|
+
false
|
|
315
|
+
end
|
|
316
|
+
when :Object
|
|
317
|
+
# generic object (usually a Hash), return directly
|
|
318
|
+
value
|
|
319
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
320
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
321
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
322
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
323
|
+
k_type = Regexp.last_match[:k_type]
|
|
324
|
+
v_type = Regexp.last_match[:v_type]
|
|
325
|
+
{}.tap do |hash|
|
|
326
|
+
value.each do |k, v|
|
|
327
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
328
|
+
end
|
|
329
|
+
end
|
|
330
|
+
else # model
|
|
331
|
+
temp_model = CyberSource.const_get(type).new
|
|
332
|
+
temp_model.build_from_hash(value)
|
|
333
|
+
end
|
|
334
|
+
end
|
|
335
|
+
|
|
336
|
+
# Returns the string representation of the object
|
|
337
|
+
# @return [String] String presentation of the object
|
|
338
|
+
def to_s
|
|
339
|
+
to_hash.to_s
|
|
340
|
+
end
|
|
341
|
+
|
|
342
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
343
|
+
# @return [Hash] Returns the object in the form of hash
|
|
344
|
+
def to_body
|
|
345
|
+
to_hash
|
|
346
|
+
end
|
|
347
|
+
|
|
348
|
+
# Returns the object in the form of hash
|
|
349
|
+
# @return [Hash] Returns the object in the form of hash
|
|
350
|
+
def to_hash
|
|
351
|
+
hash = {}
|
|
352
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
353
|
+
value = self.send(attr)
|
|
354
|
+
next if value.nil?
|
|
355
|
+
hash[param] = _to_hash(value)
|
|
356
|
+
end
|
|
357
|
+
hash
|
|
358
|
+
end
|
|
359
|
+
|
|
360
|
+
# Outputs non-array value in the form of hash
|
|
361
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
362
|
+
# @param [Object] value Any valid value
|
|
363
|
+
# @return [Hash] Returns the value in the form of hash
|
|
364
|
+
def _to_hash(value)
|
|
365
|
+
if value.is_a?(Array)
|
|
366
|
+
value.compact.map { |v| _to_hash(v) }
|
|
367
|
+
elsif value.is_a?(Hash)
|
|
368
|
+
{}.tap do |hash|
|
|
369
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
370
|
+
end
|
|
371
|
+
elsif value.respond_to? :to_hash
|
|
372
|
+
value.to_hash
|
|
373
|
+
else
|
|
374
|
+
value
|
|
375
|
+
end
|
|
376
|
+
end
|
|
377
|
+
end
|
|
378
|
+
end
|
|
@@ -0,0 +1,302 @@
|
|
|
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.4.38
|
|
10
|
+
=end
|
|
11
|
+
|
|
12
|
+
require 'date'
|
|
13
|
+
|
|
14
|
+
module CyberSource
|
|
15
|
+
# Device data.
|
|
16
|
+
class Acpv1tokensDeviceInformationDeviceData
|
|
17
|
+
# Type of device being used. Example values are: - Mobile Phone - Tablet - Tablet - Laptop - Personal Assistant - Connected Auto - Home Appliance - Wearable - Stationary Computer - E-Reader - Handheld Gaming Devices - Other
|
|
18
|
+
attr_accessor :type
|
|
19
|
+
|
|
20
|
+
# Manufacturer of the device.
|
|
21
|
+
attr_accessor :manufacturer
|
|
22
|
+
|
|
23
|
+
# Brand name of the device.
|
|
24
|
+
attr_accessor :brand
|
|
25
|
+
|
|
26
|
+
# Specific model of the device.
|
|
27
|
+
attr_accessor :model
|
|
28
|
+
|
|
29
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
30
|
+
def self.attribute_map
|
|
31
|
+
{
|
|
32
|
+
:'type' => :'type',
|
|
33
|
+
:'manufacturer' => :'manufacturer',
|
|
34
|
+
:'brand' => :'brand',
|
|
35
|
+
:'model' => :'model'
|
|
36
|
+
}
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Attribute mapping from JSON key to ruby-style variable name.
|
|
40
|
+
def self.json_map
|
|
41
|
+
{
|
|
42
|
+
:'type' => :'type',
|
|
43
|
+
:'manufacturer' => :'manufacturer',
|
|
44
|
+
:'brand' => :'brand',
|
|
45
|
+
:'model' => :'model'
|
|
46
|
+
}
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Attribute type mapping.
|
|
50
|
+
def self.swagger_types
|
|
51
|
+
{
|
|
52
|
+
:'type' => :'String',
|
|
53
|
+
:'manufacturer' => :'String',
|
|
54
|
+
:'brand' => :'String',
|
|
55
|
+
:'model' => :'String'
|
|
56
|
+
}
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# Initializes the object
|
|
60
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
61
|
+
def initialize(attributes = {})
|
|
62
|
+
return unless attributes.is_a?(Hash)
|
|
63
|
+
|
|
64
|
+
# convert string to symbol for hash key
|
|
65
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
|
66
|
+
|
|
67
|
+
if attributes.has_key?(:'type')
|
|
68
|
+
self.type = attributes[:'type']
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
if attributes.has_key?(:'manufacturer')
|
|
72
|
+
self.manufacturer = attributes[:'manufacturer']
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
if attributes.has_key?(:'brand')
|
|
76
|
+
self.brand = attributes[:'brand']
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
if attributes.has_key?(:'model')
|
|
80
|
+
self.model = attributes[:'model']
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
85
|
+
# @return Array for valid properties with the reasons
|
|
86
|
+
def list_invalid_properties
|
|
87
|
+
invalid_properties = Array.new
|
|
88
|
+
if @type.nil?
|
|
89
|
+
invalid_properties.push('invalid value for "type", type cannot be nil.')
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
#if @type !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)
|
|
93
|
+
#invalid_properties.push('invalid value for "type", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/.')
|
|
94
|
+
#end
|
|
95
|
+
|
|
96
|
+
#if !@manufacturer.nil? && @manufacturer !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)
|
|
97
|
+
#invalid_properties.push('invalid value for "manufacturer", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/.')
|
|
98
|
+
#end
|
|
99
|
+
|
|
100
|
+
if @brand.nil?
|
|
101
|
+
invalid_properties.push('invalid value for "brand", brand cannot be nil.')
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
#if @brand !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)
|
|
105
|
+
#invalid_properties.push('invalid value for "brand", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/.')
|
|
106
|
+
#end
|
|
107
|
+
|
|
108
|
+
#if !@model.nil? && @model !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)
|
|
109
|
+
#invalid_properties.push('invalid value for "model", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/.')
|
|
110
|
+
#end
|
|
111
|
+
|
|
112
|
+
invalid_properties
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
# Check to see if the all the properties in the model are valid
|
|
116
|
+
# @return true if the model is valid
|
|
117
|
+
def valid?
|
|
118
|
+
return false if @type.nil?
|
|
119
|
+
#return false if @type !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)
|
|
120
|
+
#return false if !@manufacturer.nil? && @manufacturer !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)
|
|
121
|
+
return false if @brand.nil?
|
|
122
|
+
#return false if @brand !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)
|
|
123
|
+
#return false if !@model.nil? && @model !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)
|
|
124
|
+
true
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
# Custom attribute writer method with validation
|
|
128
|
+
# @param [Object] type Value to be assigned
|
|
129
|
+
def type=(type)
|
|
130
|
+
#if type.nil?
|
|
131
|
+
#fail ArgumentError, 'type cannot be nil'
|
|
132
|
+
#end
|
|
133
|
+
|
|
134
|
+
#if type !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)
|
|
135
|
+
#fail ArgumentError, 'invalid value for "type", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/.'
|
|
136
|
+
#end
|
|
137
|
+
|
|
138
|
+
@type = type
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
# Custom attribute writer method with validation
|
|
142
|
+
# @param [Object] manufacturer Value to be assigned
|
|
143
|
+
def manufacturer=(manufacturer)
|
|
144
|
+
#if !manufacturer.nil? && manufacturer !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)
|
|
145
|
+
#fail ArgumentError, 'invalid value for "manufacturer", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/.'
|
|
146
|
+
#end
|
|
147
|
+
|
|
148
|
+
@manufacturer = manufacturer
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
# Custom attribute writer method with validation
|
|
152
|
+
# @param [Object] brand Value to be assigned
|
|
153
|
+
def brand=(brand)
|
|
154
|
+
#if brand.nil?
|
|
155
|
+
#fail ArgumentError, 'brand cannot be nil'
|
|
156
|
+
#end
|
|
157
|
+
|
|
158
|
+
#if brand !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)
|
|
159
|
+
#fail ArgumentError, 'invalid value for "brand", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/.'
|
|
160
|
+
#end
|
|
161
|
+
|
|
162
|
+
@brand = brand
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
# Custom attribute writer method with validation
|
|
166
|
+
# @param [Object] model Value to be assigned
|
|
167
|
+
def model=(model)
|
|
168
|
+
#if !model.nil? && model !~ Regexp.new(/(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/)
|
|
169
|
+
#fail ArgumentError, 'invalid value for "model", must conform to the pattern /(?!^[*.,'#_\/-]+$)(?!.*\\.\/.*)^.*$/.'
|
|
170
|
+
#end
|
|
171
|
+
|
|
172
|
+
@model = model
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
# Checks equality by comparing each attribute.
|
|
176
|
+
# @param [Object] Object to be compared
|
|
177
|
+
def ==(o)
|
|
178
|
+
return true if self.equal?(o)
|
|
179
|
+
self.class == o.class &&
|
|
180
|
+
type == o.type &&
|
|
181
|
+
manufacturer == o.manufacturer &&
|
|
182
|
+
brand == o.brand &&
|
|
183
|
+
model == o.model
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
# @see the `==` method
|
|
187
|
+
# @param [Object] Object to be compared
|
|
188
|
+
def eql?(o)
|
|
189
|
+
self == o
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
# Calculates hash code according to all attributes.
|
|
193
|
+
# @return [Fixnum] Hash code
|
|
194
|
+
def hash
|
|
195
|
+
[type, manufacturer, brand, model].hash
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
# Builds the object from hash
|
|
199
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
200
|
+
# @return [Object] Returns the model itself
|
|
201
|
+
def build_from_hash(attributes)
|
|
202
|
+
return nil unless attributes.is_a?(Hash)
|
|
203
|
+
self.class.swagger_types.each_pair do |key, type|
|
|
204
|
+
if type =~ /\AArray<(.*)>/i
|
|
205
|
+
# check to ensure the input is an array given that the the attribute
|
|
206
|
+
# is documented as an array but the input is not
|
|
207
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
208
|
+
self.send("#{self.class.json_map[key]}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
209
|
+
end
|
|
210
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
211
|
+
self.send("#{self.class.json_map[key]}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
212
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
self
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
# Deserializes the data based on type
|
|
219
|
+
# @param string type Data type
|
|
220
|
+
# @param string value Value to be deserialized
|
|
221
|
+
# @return [Object] Deserialized data
|
|
222
|
+
def _deserialize(type, value)
|
|
223
|
+
case type.to_sym
|
|
224
|
+
when :DateTime
|
|
225
|
+
DateTime.parse(value)
|
|
226
|
+
when :Date
|
|
227
|
+
Date.parse(value)
|
|
228
|
+
when :String
|
|
229
|
+
value.to_s
|
|
230
|
+
when :Integer
|
|
231
|
+
value.to_i
|
|
232
|
+
when :Float
|
|
233
|
+
value.to_f
|
|
234
|
+
when :BOOLEAN
|
|
235
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
236
|
+
true
|
|
237
|
+
else
|
|
238
|
+
false
|
|
239
|
+
end
|
|
240
|
+
when :Object
|
|
241
|
+
# generic object (usually a Hash), return directly
|
|
242
|
+
value
|
|
243
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
244
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
245
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
246
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
247
|
+
k_type = Regexp.last_match[:k_type]
|
|
248
|
+
v_type = Regexp.last_match[:v_type]
|
|
249
|
+
{}.tap do |hash|
|
|
250
|
+
value.each do |k, v|
|
|
251
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
252
|
+
end
|
|
253
|
+
end
|
|
254
|
+
else # model
|
|
255
|
+
temp_model = CyberSource.const_get(type).new
|
|
256
|
+
temp_model.build_from_hash(value)
|
|
257
|
+
end
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
# Returns the string representation of the object
|
|
261
|
+
# @return [String] String presentation of the object
|
|
262
|
+
def to_s
|
|
263
|
+
to_hash.to_s
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
267
|
+
# @return [Hash] Returns the object in the form of hash
|
|
268
|
+
def to_body
|
|
269
|
+
to_hash
|
|
270
|
+
end
|
|
271
|
+
|
|
272
|
+
# Returns the object in the form of hash
|
|
273
|
+
# @return [Hash] Returns the object in the form of hash
|
|
274
|
+
def to_hash
|
|
275
|
+
hash = {}
|
|
276
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
277
|
+
value = self.send(attr)
|
|
278
|
+
next if value.nil?
|
|
279
|
+
hash[param] = _to_hash(value)
|
|
280
|
+
end
|
|
281
|
+
hash
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
# Outputs non-array value in the form of hash
|
|
285
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
286
|
+
# @param [Object] value Any valid value
|
|
287
|
+
# @return [Hash] Returns the value in the form of hash
|
|
288
|
+
def _to_hash(value)
|
|
289
|
+
if value.is_a?(Array)
|
|
290
|
+
value.compact.map { |v| _to_hash(v) }
|
|
291
|
+
elsif value.is_a?(Hash)
|
|
292
|
+
{}.tap do |hash|
|
|
293
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
294
|
+
end
|
|
295
|
+
elsif value.respond_to? :to_hash
|
|
296
|
+
value.to_hash
|
|
297
|
+
else
|
|
298
|
+
value
|
|
299
|
+
end
|
|
300
|
+
end
|
|
301
|
+
end
|
|
302
|
+
end
|