citypay_api_client 1.0.3 → 1.1.2
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/README.md +111 -39
- data/citypay_api_client.gemspec +5 -5
- data/docs/AccountCreate.md +10 -9
- data/docs/AccountStatus.md +8 -7
- data/docs/Acknowledgement.md +14 -13
- data/docs/AclCheckRequest.md +18 -0
- data/docs/AclCheckResponseModel.md +24 -0
- data/docs/AirlineAdvice.md +38 -37
- data/docs/AirlineSegment.md +22 -21
- data/docs/AuthReference.md +34 -33
- data/docs/AuthReferences.md +8 -7
- data/docs/AuthRequest.md +52 -49
- data/docs/AuthResponse.md +64 -59
- data/docs/AuthenRequired.md +12 -11
- data/docs/AuthorisationAndPaymentApi.md +850 -0
- data/docs/Batch.md +22 -0
- data/docs/BatchProcessingApi.md +218 -0
- data/docs/BatchReportRequest.md +20 -0
- data/docs/BatchReportResponseModel.md +28 -0
- data/docs/BatchTransaction.md +24 -0
- data/docs/BatchTransactionResultModel.md +44 -0
- data/docs/Bin.md +34 -0
- data/docs/BinLookup.md +18 -0
- data/docs/CResAuthRequest.md +8 -7
- data/docs/CaptureRequest.md +18 -17
- data/docs/Card.md +46 -41
- data/docs/CardHolderAccount.md +24 -21
- data/docs/CardHolderAccountApi.md +387 -111
- data/docs/CardStatus.md +10 -9
- data/docs/ChargeRequest.md +38 -31
- data/docs/CheckBatchStatus.md +20 -0
- data/docs/CheckBatchStatusResponse.md +18 -0
- data/docs/ContactDetails.md +32 -31
- data/docs/Decision.md +12 -11
- data/docs/DirectPostApi.md +389 -0
- data/docs/DirectPostRequest.md +60 -0
- data/docs/DirectTokenAuthRequest.md +24 -0
- data/docs/DomainKeyCheckRequest.md +18 -0
- data/docs/DomainKeyRequest.md +22 -0
- data/docs/DomainKeyResponse.md +26 -0
- data/docs/Error.md +16 -13
- data/docs/EventDataModel.md +26 -0
- data/docs/Exists.md +22 -0
- data/docs/ExternalMPI.md +16 -15
- data/docs/ListMerchantsResponse.md +12 -11
- data/docs/MCC6012.md +14 -13
- data/docs/Merchant.md +16 -15
- data/docs/OperationalFunctionsApi.md +375 -0
- data/docs/PaResAuthRequest.md +10 -9
- data/docs/PaylinkAddress.md +30 -0
- data/docs/PaylinkAdjustmentRequest.md +22 -0
- data/docs/PaylinkApi.md +806 -0
- data/docs/PaylinkAttachmentRequest.md +26 -0
- data/docs/PaylinkAttachmentResult.md +22 -0
- data/docs/PaylinkBillPaymentTokenRequest.md +32 -0
- data/docs/PaylinkCardHolder.md +36 -0
- data/docs/PaylinkCart.md +30 -0
- data/docs/PaylinkCartItemModel.md +32 -0
- data/docs/PaylinkConfig.md +60 -0
- data/docs/PaylinkCustomParam.md +38 -0
- data/docs/PaylinkEmailNotificationPath.md +26 -0
- data/docs/PaylinkErrorCode.md +20 -0
- data/docs/PaylinkFieldGuardModel.md +30 -0
- data/docs/PaylinkPartPayments.md +28 -0
- data/docs/PaylinkSMSNotificationPath.md +20 -0
- data/docs/PaylinkStateEvent.md +22 -0
- data/docs/PaylinkTokenCreated.md +44 -0
- data/docs/PaylinkTokenRequestModel.md +42 -0
- data/docs/PaylinkTokenStatus.md +72 -0
- data/docs/PaylinkTokenStatusChangeRequest.md +26 -0
- data/docs/PaylinkTokenStatusChangeResponse.md +20 -0
- data/docs/PaylinkUI.md +24 -0
- data/docs/Ping.md +8 -7
- data/docs/ProcessBatchRequest.md +24 -0
- data/docs/ProcessBatchResponse.md +20 -0
- data/docs/RefundRequest.md +26 -0
- data/docs/RegisterCard.md +16 -13
- data/docs/RequestChallenged.md +16 -15
- data/docs/RetrieveRequest.md +12 -11
- data/docs/ThreeDSecure.md +32 -15
- data/docs/TokenisationResponseModel.md +36 -0
- data/docs/VoidRequest.md +12 -13
- data/docs/images/3dsv1-challenge.png +0 -0
- data/docs/images/3dsv2-challenge.png +0 -0
- data/docs/images/3dsv2-frictionless.png +0 -0
- data/docs/images/3dsv2-method-challenge.png +0 -0
- data/docs/images/3dsv2-method-frictionless.png +0 -0
- data/docs/images/3dsv2-no3d.png +0 -0
- data/docs/images/citypay-logo.svg +1 -0
- data/docs/images/direct-post-flow.png +0 -0
- data/docs/images/favicon.ico +0 -0
- data/docs/images/header.png +0 -0
- data/docs/images/logo.ai +1913 -4
- data/docs/images/logo.png +0 -0
- data/docs/images/logo.svg +1 -0
- data/docs/images/merchant-BPS-workflow.png +0 -0
- data/docs/images/paylink-field-guards.png +0 -0
- data/lib/.DS_Store +0 -0
- data/lib/citypay_api_client/api/authorisation_and_payment_api__.rb +565 -0
- data/lib/citypay_api_client/api/batch_processing_api__.rb +225 -0
- data/lib/citypay_api_client/api/{card_holder_account_api.rb → card_holder_account_api__.rb} +136 -46
- data/lib/citypay_api_client/api/direct_post_api__.rb +373 -0
- data/lib/citypay_api_client/api/operational_functions_api__.rb +356 -0
- data/lib/citypay_api_client/api/paylink_api__.rb +614 -0
- data/lib/citypay_api_client/api_client.rb +72 -70
- data/lib/citypay_api_client/api_error.rb +3 -2
- data/lib/citypay_api_client/configuration.rb +74 -17
- data/lib/citypay_api_client/models/account_create.rb +33 -23
- data/lib/citypay_api_client/models/account_status.rb +31 -23
- data/lib/citypay_api_client/models/acknowledgement.rb +43 -27
- data/lib/citypay_api_client/models/acl_check_request.rb +221 -0
- data/lib/citypay_api_client/models/acl_check_response_model.rb +244 -0
- data/lib/citypay_api_client/models/airline_advice.rb +63 -34
- data/lib/citypay_api_client/models/airline_segment.rb +51 -25
- data/lib/citypay_api_client/models/auth_reference.rb +80 -31
- data/lib/citypay_api_client/models/auth_references.rb +31 -23
- data/lib/citypay_api_client/models/auth_request.rb +137 -56
- data/lib/citypay_api_client/models/auth_response.rb +83 -123
- data/lib/citypay_api_client/models/authen_required.rb +31 -23
- data/lib/citypay_api_client/models/batch.rb +267 -0
- data/lib/citypay_api_client/models/batch_report_request.rb +278 -0
- data/lib/citypay_api_client/models/batch_report_response_model.rb +364 -0
- data/lib/citypay_api_client/models/batch_transaction.rb +324 -0
- data/lib/citypay_api_client/models/batch_transaction_result_model.rb +452 -0
- data/lib/citypay_api_client/models/bin.rb +294 -0
- data/lib/citypay_api_client/models/bin_lookup.rb +231 -0
- data/lib/citypay_api_client/models/c_res_auth_request.rb +31 -23
- data/lib/citypay_api_client/models/capture_request.rb +59 -38
- data/lib/citypay_api_client/models/card.rb +93 -29
- data/lib/citypay_api_client/models/card_holder_account.rb +49 -27
- data/lib/citypay_api_client/models/card_status.rb +31 -23
- data/lib/citypay_api_client/models/charge_request.rb +154 -47
- data/lib/citypay_api_client/models/check_batch_status.rb +260 -0
- data/lib/citypay_api_client/models/check_batch_status_response.rb +215 -0
- data/lib/citypay_api_client/models/contact_details.rb +130 -52
- data/lib/citypay_api_client/models/decision.rb +31 -23
- data/lib/citypay_api_client/models/direct_post_request.rb +707 -0
- data/lib/citypay_api_client/models/direct_token_auth_request.rb +244 -0
- data/lib/citypay_api_client/models/domain_key_check_request.rb +249 -0
- data/lib/citypay_api_client/models/domain_key_request.rb +249 -0
- data/lib/citypay_api_client/models/domain_key_response.rb +297 -0
- data/lib/citypay_api_client/models/error.rb +57 -31
- data/lib/citypay_api_client/models/event_data_model.rb +254 -0
- data/lib/citypay_api_client/models/exists.rb +241 -0
- data/lib/citypay_api_client/models/external_mpi.rb +61 -27
- data/lib/citypay_api_client/models/list_merchants_response.rb +37 -25
- data/lib/citypay_api_client/models/mcc6012.rb +31 -23
- data/lib/citypay_api_client/models/merchant.rb +31 -23
- data/lib/citypay_api_client/models/pa_res_auth_request.rb +36 -24
- data/lib/citypay_api_client/models/paylink_address.rb +425 -0
- data/lib/citypay_api_client/models/paylink_adjustment_request.rb +272 -0
- data/lib/citypay_api_client/models/paylink_attachment_request.rb +268 -0
- data/lib/citypay_api_client/models/paylink_attachment_result.rb +248 -0
- data/lib/citypay_api_client/models/paylink_bill_payment_token_request.rb +289 -0
- data/lib/citypay_api_client/models/paylink_card_holder.rb +360 -0
- data/lib/citypay_api_client/models/paylink_cart.rb +275 -0
- data/lib/citypay_api_client/models/paylink_cart_item_model.rb +284 -0
- data/lib/citypay_api_client/models/paylink_config.rb +428 -0
- data/lib/citypay_api_client/models/paylink_custom_param.rb +321 -0
- data/lib/citypay_api_client/models/paylink_email_notification_path.rb +265 -0
- data/lib/citypay_api_client/models/paylink_error_code.rb +238 -0
- data/lib/citypay_api_client/models/paylink_field_guard_model.rb +274 -0
- data/lib/citypay_api_client/models/paylink_part_payments.rb +264 -0
- data/lib/citypay_api_client/models/paylink_sms_notification_path.rb +231 -0
- data/lib/citypay_api_client/models/paylink_state_event.rb +234 -0
- data/lib/citypay_api_client/models/paylink_token_created.rb +365 -0
- data/lib/citypay_api_client/models/paylink_token_request_model.rb +427 -0
- data/lib/citypay_api_client/models/paylink_token_status.rb +485 -0
- data/lib/citypay_api_client/models/paylink_token_status_change_request.rb +269 -0
- data/lib/citypay_api_client/models/paylink_token_status_change_response.rb +232 -0
- data/lib/citypay_api_client/models/paylink_ui.rb +244 -0
- data/lib/citypay_api_client/models/ping.rb +37 -25
- data/lib/citypay_api_client/models/process_batch_request.rb +313 -0
- data/lib/citypay_api_client/models/process_batch_response.rb +231 -0
- data/lib/citypay_api_client/models/refund_request.rb +339 -0
- data/lib/citypay_api_client/models/register_card.rb +79 -27
- data/lib/citypay_api_client/models/request_challenged.rb +39 -31
- data/lib/citypay_api_client/models/retrieve_request.rb +39 -25
- data/lib/citypay_api_client/models/three_d_secure.rb +116 -28
- data/lib/citypay_api_client/models/tokenisation_response_model.rb +332 -0
- data/lib/citypay_api_client/models/void_request.rb +39 -37
- data/lib/citypay_api_client/utils/digest_utils.rb +18 -0
- data/lib/citypay_api_client/utils/direct_post_mac.rb +22 -0
- data/lib/citypay_api_client/version.rb +3 -4
- data/lib/citypay_api_client.rb +53 -6
- data/spec/.DS_Store +0 -0
- data/spec/api/authorisation_and_payment_api___spec.rb +130 -0
- data/spec/api/batch_processing_api___spec.rb +70 -0
- data/spec/api/{card_holder_account_api_spec.rb → card_holder_account_api___spec.rb} +15 -3
- data/spec/api/direct_post_api___spec.rb +98 -0
- data/spec/api/operational_functions_api___spec.rb +94 -0
- data/spec/api/paylink_api___spec.rb +131 -0
- data/spec/api_client_spec.rb +4 -4
- data/spec/configuration_spec.rb +5 -5
- data/spec/it_api_sandbox_spec.rb +117 -55
- data/spec/models/account_create_spec.rb +1 -2
- data/spec/models/account_status_spec.rb +2 -2
- data/spec/models/acknowledgement_spec.rb +7 -22
- data/spec/models/acl_check_request_spec.rb +33 -0
- data/spec/models/acl_check_response_model_spec.rb +51 -0
- data/spec/models/airline_advice_spec.rb +0 -2
- data/spec/models/airline_segment_spec.rb +0 -2
- data/spec/models/auth_references_spec.rb +7 -8
- data/spec/models/auth_request_spec.rb +0 -2
- data/spec/models/auth_response_spec.rb +77 -33
- data/spec/models/batch_report_request_spec.rb +37 -0
- data/spec/models/batch_report_response_model_spec.rb +61 -0
- data/spec/models/batch_spec.rb +43 -0
- data/spec/models/batch_transaction_result_model_spec.rb +85 -0
- data/spec/models/batch_transaction_spec.rb +49 -0
- data/spec/models/bin_lookup_spec.rb +31 -0
- data/spec/models/bin_spec.rb +81 -0
- data/spec/models/capture_request_spec.rb +0 -2
- data/spec/models/card_holder_account_spec.rb +8 -7
- data/spec/models/charge_request_spec.rb +0 -2
- data/spec/models/check_batch_status_response_spec.rb +45 -0
- data/spec/models/check_batch_status_spec.rb +39 -0
- data/spec/models/decision_spec.rb +1 -1
- data/spec/models/direct_post_request_spec.rb +151 -0
- data/spec/models/direct_token_auth_request_spec.rb +51 -0
- data/spec/models/domain_key_check_request_spec.rb +31 -0
- data/spec/models/domain_key_request_spec.rb +45 -0
- data/spec/models/domain_key_response_spec.rb +57 -0
- data/spec/models/event_data_model_spec.rb +57 -0
- data/spec/{api/operational_api_spec.rb → models/exists_spec.rb} +14 -20
- data/spec/models/list_merchants_response_spec.rb +2 -2
- data/spec/models/paylink_address_spec.rb +69 -0
- data/spec/models/paylink_adjustment_request_spec.rb +45 -0
- data/spec/models/paylink_attachment_request_spec.rb +45 -0
- data/spec/models/paylink_attachment_result_spec.rb +45 -0
- data/spec/models/paylink_bill_payment_token_request_spec.rb +63 -0
- data/spec/models/paylink_card_holder_spec.rb +87 -0
- data/spec/models/paylink_cart_item_model_spec.rb +75 -0
- data/spec/models/paylink_cart_spec.rb +69 -0
- data/spec/models/paylink_config_spec.rb +159 -0
- data/spec/models/paylink_custom_param_spec.rb +87 -0
- data/spec/models/paylink_email_notification_path_spec.rb +57 -0
- data/spec/models/paylink_error_code_spec.rb +39 -0
- data/spec/models/paylink_field_guard_model_spec.rb +45 -0
- data/spec/models/paylink_part_payments_spec.rb +63 -0
- data/spec/models/paylink_sms_notification_path_spec.rb +39 -0
- data/spec/models/paylink_state_event_spec.rb +45 -0
- data/spec/models/paylink_token_created_spec.rb +111 -0
- data/spec/models/paylink_token_request_model_spec.rb +91 -0
- data/spec/models/paylink_token_status_change_request_spec.rb +57 -0
- data/spec/models/paylink_token_status_change_response_spec.rb +39 -0
- data/spec/models/paylink_token_status_spec.rb +195 -0
- data/spec/models/paylink_ui_spec.rb +51 -0
- data/spec/models/process_batch_request_spec.rb +49 -0
- data/spec/models/process_batch_response_spec.rb +39 -0
- data/spec/models/refund_request_spec.rb +62 -0
- data/spec/models/register_card_spec.rb +0 -2
- data/spec/models/tokenisation_response_model_spec.rb +87 -0
- data/spec/spec_helper.rb +2 -2
- data/spec/utils/direct_post_mac_spec.rb +13 -0
- metadata +230 -44
- data/Gemfile.lock +0 -70
- data/docs/OperationalApi.md +0 -112
- data/docs/PaymentProcessingApi.md +0 -320
- data/git_push.sh +0 -58
- data/lib/citypay_api_client/api/operational_api.rb +0 -147
- data/lib/citypay_api_client/api/payment_processing_api.rb +0 -405
- data/lib/citypay_api_client/test.rb +0 -20
- data/spec/api/payment_processing_api_spec.rb +0 -106
@@ -0,0 +1,289 @@
|
|
1
|
+
=begin
|
2
|
+
#CityPay Payment API
|
3
|
+
|
4
|
+
# This CityPay API is an HTTP RESTful payment API used for direct server to server transactional processing. It provides a number of payment mechanisms including: Internet, MOTO, Continuous Authority transaction processing, 3-D Secure decision handling using RFA Secure, Authorisation, Refunding, Pre-Authorisation, Cancellation/Voids and Completion processing. The API is also capable of tokenized payments using cardholder Accounts. ## Compliance and Security Your application will need to adhere to PCI-DSS standards to operate safely and to meet requirements set out by Visa and MasterCard and the PCI Security Standards Council. These include * Data must be collected using TLS version 1.2 using [strong cryptography](https://citypay.github.io/api-docs/payment-api/#enabled-tls-ciphers). We will not accept calls to our API at lower grade encryption levels. We regularly scan our TLS endpoints for vulnerabilities and perform TLS assessments as part of our compliance program. * The application must not store sensitive cardholder data (CHD) such as the card security code (CSC) or primary access number (PAN) * The application must not display the full card number on receipts, it is recommended to mask the PAN and show the last 4 digits. The API will return this for you for ease of receipt creation * If you are developing a website, you will be required to perform regular scans on the network where you host the application to meet your compliance obligations * You will be required to be PCI Compliant and the application must adhere to the security standard. Further information is available from [https://www.pcisecuritystandards.org/](https://www.pcisecuritystandards.org/) * The API verifies that the request is for a valid account and originates from a trusted source using the remote IP address. Our application firewalls analyse data that may be an attempt to break a large number of security common security vulnerabilities.
|
5
|
+
|
6
|
+
Contact: support@citypay.com
|
7
|
+
Generated by: https://openapi-generator.tech
|
8
|
+
OpenAPI Generator version: 7.2.0
|
9
|
+
|
10
|
+
=end
|
11
|
+
|
12
|
+
require 'date'
|
13
|
+
require 'time'
|
14
|
+
|
15
|
+
module CityPayApiClient
|
16
|
+
class PaylinkBillPaymentTokenRequest
|
17
|
+
# Who the bill payment request intended for. This should be a readable name such as a person or company.
|
18
|
+
attr_accessor :addressee
|
19
|
+
|
20
|
+
attr_accessor :attachments
|
21
|
+
|
22
|
+
# A descriptor for the bill payment used to describe what the payment request is for for instance \"Invoice\". The descriptor can be used as descriptive text on emails or the payment page. For instance an invoice may have a button saying \"View Invoice\" or an email may say \"to pay your Invoice online\".
|
23
|
+
attr_accessor :descriptor
|
24
|
+
|
25
|
+
# A date that the invoice is due. This can be displayed on the payment page.
|
26
|
+
attr_accessor :due
|
27
|
+
|
28
|
+
attr_accessor :email_notification_path
|
29
|
+
|
30
|
+
# A memo that can be added to the payment page and email to provide to the customer.
|
31
|
+
attr_accessor :memo
|
32
|
+
|
33
|
+
attr_accessor :request
|
34
|
+
|
35
|
+
attr_accessor :sms_notification_path
|
36
|
+
|
37
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
38
|
+
def self.attribute_map
|
39
|
+
{
|
40
|
+
:'addressee' => :'addressee',
|
41
|
+
:'attachments' => :'attachments',
|
42
|
+
:'descriptor' => :'descriptor',
|
43
|
+
:'due' => :'due',
|
44
|
+
:'email_notification_path' => :'email_notification_path',
|
45
|
+
:'memo' => :'memo',
|
46
|
+
:'request' => :'request',
|
47
|
+
:'sms_notification_path' => :'sms_notification_path'
|
48
|
+
}
|
49
|
+
end
|
50
|
+
|
51
|
+
# Returns all the JSON keys this model knows about
|
52
|
+
def self.acceptable_attributes
|
53
|
+
attribute_map.values
|
54
|
+
end
|
55
|
+
|
56
|
+
# Attribute type mapping.
|
57
|
+
def self.openapi_types
|
58
|
+
{
|
59
|
+
:'addressee' => :'String',
|
60
|
+
:'attachments' => :'Array<PaylinkAttachmentRequest>',
|
61
|
+
:'descriptor' => :'String',
|
62
|
+
:'due' => :'Date',
|
63
|
+
:'email_notification_path' => :'PaylinkEmailNotificationPath',
|
64
|
+
:'memo' => :'String',
|
65
|
+
:'request' => :'PaylinkTokenRequestModel',
|
66
|
+
:'sms_notification_path' => :'PaylinkSMSNotificationPath'
|
67
|
+
}
|
68
|
+
end
|
69
|
+
|
70
|
+
# List of attributes with nullable: true
|
71
|
+
def self.openapi_nullable
|
72
|
+
Set.new([
|
73
|
+
])
|
74
|
+
end
|
75
|
+
|
76
|
+
# Initializes the object
|
77
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
78
|
+
def initialize(attributes = {})
|
79
|
+
if (!attributes.is_a?(Hash))
|
80
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `CityPayApiClient::PaylinkBillPaymentTokenRequest` initialize method"
|
81
|
+
end
|
82
|
+
|
83
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
84
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
85
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
86
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `CityPayApiClient::PaylinkBillPaymentTokenRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
87
|
+
end
|
88
|
+
h[k.to_sym] = v
|
89
|
+
}
|
90
|
+
|
91
|
+
if attributes.key?(:'addressee')
|
92
|
+
self.addressee = attributes[:'addressee']
|
93
|
+
end
|
94
|
+
|
95
|
+
if attributes.key?(:'attachments')
|
96
|
+
if (value = attributes[:'attachments']).is_a?(Array)
|
97
|
+
self.attachments = value
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
if attributes.key?(:'descriptor')
|
102
|
+
self.descriptor = attributes[:'descriptor']
|
103
|
+
end
|
104
|
+
|
105
|
+
if attributes.key?(:'due')
|
106
|
+
self.due = attributes[:'due']
|
107
|
+
end
|
108
|
+
|
109
|
+
if attributes.key?(:'email_notification_path')
|
110
|
+
self.email_notification_path = attributes[:'email_notification_path']
|
111
|
+
end
|
112
|
+
|
113
|
+
if attributes.key?(:'memo')
|
114
|
+
self.memo = attributes[:'memo']
|
115
|
+
end
|
116
|
+
|
117
|
+
if attributes.key?(:'request')
|
118
|
+
self.request = attributes[:'request']
|
119
|
+
else
|
120
|
+
self.request = nil
|
121
|
+
end
|
122
|
+
|
123
|
+
if attributes.key?(:'sms_notification_path')
|
124
|
+
self.sms_notification_path = attributes[:'sms_notification_path']
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
129
|
+
# @return Array for valid properties with the reasons
|
130
|
+
def list_invalid_properties
|
131
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
132
|
+
invalid_properties = Array.new
|
133
|
+
if @request.nil?
|
134
|
+
invalid_properties.push('invalid value for "request", request cannot be nil.')
|
135
|
+
end
|
136
|
+
|
137
|
+
invalid_properties
|
138
|
+
end
|
139
|
+
|
140
|
+
# Check to see if the all the properties in the model are valid
|
141
|
+
# @return true if the model is valid
|
142
|
+
def valid?
|
143
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
144
|
+
return false if @request.nil?
|
145
|
+
true
|
146
|
+
end
|
147
|
+
|
148
|
+
# Checks equality by comparing each attribute.
|
149
|
+
# @param [Object] Object to be compared
|
150
|
+
def ==(o)
|
151
|
+
return true if self.equal?(o)
|
152
|
+
self.class == o.class &&
|
153
|
+
addressee == o.addressee &&
|
154
|
+
attachments == o.attachments &&
|
155
|
+
descriptor == o.descriptor &&
|
156
|
+
due == o.due &&
|
157
|
+
email_notification_path == o.email_notification_path &&
|
158
|
+
memo == o.memo &&
|
159
|
+
request == o.request &&
|
160
|
+
sms_notification_path == o.sms_notification_path
|
161
|
+
end
|
162
|
+
|
163
|
+
# @see the `==` method
|
164
|
+
# @param [Object] Object to be compared
|
165
|
+
def eql?(o)
|
166
|
+
self == o
|
167
|
+
end
|
168
|
+
|
169
|
+
# Calculates hash code according to all attributes.
|
170
|
+
# @return [Integer] Hash code
|
171
|
+
def hash
|
172
|
+
[addressee, attachments, descriptor, due, email_notification_path, memo, request, sms_notification_path].hash
|
173
|
+
end
|
174
|
+
|
175
|
+
# Builds the object from hash
|
176
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
177
|
+
# @return [Object] Returns the model itself
|
178
|
+
def self.build_from_hash(attributes)
|
179
|
+
return nil unless attributes.is_a?(Hash)
|
180
|
+
attributes = attributes.transform_keys(&:to_sym)
|
181
|
+
transformed_hash = {}
|
182
|
+
openapi_types.each_pair do |key, type|
|
183
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
184
|
+
transformed_hash["#{key}"] = nil
|
185
|
+
elsif type =~ /\AArray<(.*)>/i
|
186
|
+
# check to ensure the input is an array given that the attribute
|
187
|
+
# is documented as an array but the input is not
|
188
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
189
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
190
|
+
end
|
191
|
+
elsif !attributes[attribute_map[key]].nil?
|
192
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
193
|
+
end
|
194
|
+
end
|
195
|
+
new(transformed_hash)
|
196
|
+
end
|
197
|
+
|
198
|
+
# Deserializes the data based on type
|
199
|
+
# @param string type Data type
|
200
|
+
# @param string value Value to be deserialized
|
201
|
+
# @return [Object] Deserialized data
|
202
|
+
def self._deserialize(type, value)
|
203
|
+
case type.to_sym
|
204
|
+
when :Time
|
205
|
+
Time.parse(value)
|
206
|
+
when :Date
|
207
|
+
Date.parse(value)
|
208
|
+
when :String
|
209
|
+
value.to_s
|
210
|
+
when :Integer
|
211
|
+
value.to_i
|
212
|
+
when :Float
|
213
|
+
value.to_f
|
214
|
+
when :Boolean
|
215
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
216
|
+
true
|
217
|
+
else
|
218
|
+
false
|
219
|
+
end
|
220
|
+
when :Object
|
221
|
+
# generic object (usually a Hash), return directly
|
222
|
+
value
|
223
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
224
|
+
inner_type = Regexp.last_match[:inner_type]
|
225
|
+
value.map { |v| _deserialize(inner_type, v) }
|
226
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
227
|
+
k_type = Regexp.last_match[:k_type]
|
228
|
+
v_type = Regexp.last_match[:v_type]
|
229
|
+
{}.tap do |hash|
|
230
|
+
value.each do |k, v|
|
231
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
232
|
+
end
|
233
|
+
end
|
234
|
+
else # model
|
235
|
+
# models (e.g. Pet) or oneOf
|
236
|
+
klass = CityPayApiClient.const_get(type)
|
237
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
241
|
+
# Returns the string representation of the object
|
242
|
+
# @return [String] String presentation of the object
|
243
|
+
def to_s
|
244
|
+
to_hash.to_s
|
245
|
+
end
|
246
|
+
|
247
|
+
# to_body is an alias to to_hash (backward compatibility)
|
248
|
+
# @return [Hash] Returns the object in the form of hash
|
249
|
+
def to_body
|
250
|
+
to_hash
|
251
|
+
end
|
252
|
+
|
253
|
+
# Returns the object in the form of hash
|
254
|
+
# @return [Hash] Returns the object in the form of hash
|
255
|
+
def to_hash
|
256
|
+
hash = {}
|
257
|
+
self.class.attribute_map.each_pair do |attr, param|
|
258
|
+
value = self.send(attr)
|
259
|
+
if value.nil?
|
260
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
261
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
262
|
+
end
|
263
|
+
|
264
|
+
hash[param] = _to_hash(value)
|
265
|
+
end
|
266
|
+
hash
|
267
|
+
end
|
268
|
+
|
269
|
+
# Outputs non-array value in the form of hash
|
270
|
+
# For object, use to_hash. Otherwise, just return the value
|
271
|
+
# @param [Object] value Any valid value
|
272
|
+
# @return [Hash] Returns the value in the form of hash
|
273
|
+
def _to_hash(value)
|
274
|
+
if value.is_a?(Array)
|
275
|
+
value.compact.map { |v| _to_hash(v) }
|
276
|
+
elsif value.is_a?(Hash)
|
277
|
+
{}.tap do |hash|
|
278
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
279
|
+
end
|
280
|
+
elsif value.respond_to? :to_hash
|
281
|
+
value.to_hash
|
282
|
+
else
|
283
|
+
value
|
284
|
+
end
|
285
|
+
end
|
286
|
+
|
287
|
+
end
|
288
|
+
|
289
|
+
end
|
@@ -0,0 +1,360 @@
|
|
1
|
+
=begin
|
2
|
+
#CityPay Payment API
|
3
|
+
|
4
|
+
# This CityPay API is an HTTP RESTful payment API used for direct server to server transactional processing. It provides a number of payment mechanisms including: Internet, MOTO, Continuous Authority transaction processing, 3-D Secure decision handling using RFA Secure, Authorisation, Refunding, Pre-Authorisation, Cancellation/Voids and Completion processing. The API is also capable of tokenized payments using cardholder Accounts. ## Compliance and Security Your application will need to adhere to PCI-DSS standards to operate safely and to meet requirements set out by Visa and MasterCard and the PCI Security Standards Council. These include * Data must be collected using TLS version 1.2 using [strong cryptography](https://citypay.github.io/api-docs/payment-api/#enabled-tls-ciphers). We will not accept calls to our API at lower grade encryption levels. We regularly scan our TLS endpoints for vulnerabilities and perform TLS assessments as part of our compliance program. * The application must not store sensitive cardholder data (CHD) such as the card security code (CSC) or primary access number (PAN) * The application must not display the full card number on receipts, it is recommended to mask the PAN and show the last 4 digits. The API will return this for you for ease of receipt creation * If you are developing a website, you will be required to perform regular scans on the network where you host the application to meet your compliance obligations * You will be required to be PCI Compliant and the application must adhere to the security standard. Further information is available from [https://www.pcisecuritystandards.org/](https://www.pcisecuritystandards.org/) * The API verifies that the request is for a valid account and originates from a trusted source using the remote IP address. Our application firewalls analyse data that may be an attempt to break a large number of security common security vulnerabilities.
|
5
|
+
|
6
|
+
Contact: support@citypay.com
|
7
|
+
Generated by: https://openapi-generator.tech
|
8
|
+
OpenAPI Generator version: 7.2.0
|
9
|
+
|
10
|
+
=end
|
11
|
+
|
12
|
+
require 'date'
|
13
|
+
require 'time'
|
14
|
+
|
15
|
+
module CityPayApiClient
|
16
|
+
class PaylinkCardHolder
|
17
|
+
# The accept headers string generated by the Customer Browser. This field may be used to lock the payment process to the customer's browser. If the customer were to attempt to use a different browser an error will be generated.
|
18
|
+
attr_accessor :accept_headers
|
19
|
+
|
20
|
+
attr_accessor :address
|
21
|
+
|
22
|
+
# The company name for the card holder.
|
23
|
+
attr_accessor :company
|
24
|
+
|
25
|
+
# The cardholder's email address. This field can be used to send a receipt to the payment cardholder. If this value is not supplied, no email will be sent.
|
26
|
+
attr_accessor :email
|
27
|
+
|
28
|
+
# The first name of the card holder.
|
29
|
+
attr_accessor :firstname
|
30
|
+
|
31
|
+
# The last name or surname of the card holder.
|
32
|
+
attr_accessor :lastname
|
33
|
+
|
34
|
+
# The mobile number of the cardholder. This can be used for data collection via the Paylink Payment Form or to send an SMS on completion of a transaction. This feature is a licensable option and is not configured by default.
|
35
|
+
attr_accessor :mobile_no
|
36
|
+
|
37
|
+
# Specifies the remote IP address of the customer's browser. This field may be used to lock the payment form to the customer's IP address. Should the address change or a malicious third party attempted to hijack the transaction, an error will be generated.
|
38
|
+
attr_accessor :remote_addr
|
39
|
+
|
40
|
+
# A title for the card holder such as Mr, Mrs, Ms, M. Mme. etc.
|
41
|
+
attr_accessor :title
|
42
|
+
|
43
|
+
# Specifies the user agent string of the Customer Browser. This field may be used to lock the payment form to the browser. Should a different user agent attempt to process the transaction or a malicious third party attempted to hijack the transaction, an error is generated.
|
44
|
+
attr_accessor :user_agent
|
45
|
+
|
46
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
47
|
+
def self.attribute_map
|
48
|
+
{
|
49
|
+
:'accept_headers' => :'accept_headers',
|
50
|
+
:'address' => :'address',
|
51
|
+
:'company' => :'company',
|
52
|
+
:'email' => :'email',
|
53
|
+
:'firstname' => :'firstname',
|
54
|
+
:'lastname' => :'lastname',
|
55
|
+
:'mobile_no' => :'mobile_no',
|
56
|
+
:'remote_addr' => :'remote_addr',
|
57
|
+
:'title' => :'title',
|
58
|
+
:'user_agent' => :'user_agent'
|
59
|
+
}
|
60
|
+
end
|
61
|
+
|
62
|
+
# Returns all the JSON keys this model knows about
|
63
|
+
def self.acceptable_attributes
|
64
|
+
attribute_map.values
|
65
|
+
end
|
66
|
+
|
67
|
+
# Attribute type mapping.
|
68
|
+
def self.openapi_types
|
69
|
+
{
|
70
|
+
:'accept_headers' => :'String',
|
71
|
+
:'address' => :'PaylinkAddress',
|
72
|
+
:'company' => :'String',
|
73
|
+
:'email' => :'String',
|
74
|
+
:'firstname' => :'String',
|
75
|
+
:'lastname' => :'String',
|
76
|
+
:'mobile_no' => :'String',
|
77
|
+
:'remote_addr' => :'String',
|
78
|
+
:'title' => :'String',
|
79
|
+
:'user_agent' => :'String'
|
80
|
+
}
|
81
|
+
end
|
82
|
+
|
83
|
+
# List of attributes with nullable: true
|
84
|
+
def self.openapi_nullable
|
85
|
+
Set.new([
|
86
|
+
])
|
87
|
+
end
|
88
|
+
|
89
|
+
# Initializes the object
|
90
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
91
|
+
def initialize(attributes = {})
|
92
|
+
if (!attributes.is_a?(Hash))
|
93
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `CityPayApiClient::PaylinkCardHolder` initialize method"
|
94
|
+
end
|
95
|
+
|
96
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
97
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
98
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
99
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `CityPayApiClient::PaylinkCardHolder`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
100
|
+
end
|
101
|
+
h[k.to_sym] = v
|
102
|
+
}
|
103
|
+
|
104
|
+
if attributes.key?(:'accept_headers')
|
105
|
+
self.accept_headers = attributes[:'accept_headers']
|
106
|
+
end
|
107
|
+
|
108
|
+
if attributes.key?(:'address')
|
109
|
+
self.address = attributes[:'address']
|
110
|
+
end
|
111
|
+
|
112
|
+
if attributes.key?(:'company')
|
113
|
+
self.company = attributes[:'company']
|
114
|
+
end
|
115
|
+
|
116
|
+
if attributes.key?(:'email')
|
117
|
+
self.email = attributes[:'email']
|
118
|
+
end
|
119
|
+
|
120
|
+
if attributes.key?(:'firstname')
|
121
|
+
self.firstname = attributes[:'firstname']
|
122
|
+
end
|
123
|
+
|
124
|
+
if attributes.key?(:'lastname')
|
125
|
+
self.lastname = attributes[:'lastname']
|
126
|
+
end
|
127
|
+
|
128
|
+
if attributes.key?(:'mobile_no')
|
129
|
+
self.mobile_no = attributes[:'mobile_no']
|
130
|
+
end
|
131
|
+
|
132
|
+
if attributes.key?(:'remote_addr')
|
133
|
+
self.remote_addr = attributes[:'remote_addr']
|
134
|
+
end
|
135
|
+
|
136
|
+
if attributes.key?(:'title')
|
137
|
+
self.title = attributes[:'title']
|
138
|
+
end
|
139
|
+
|
140
|
+
if attributes.key?(:'user_agent')
|
141
|
+
self.user_agent = attributes[:'user_agent']
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
146
|
+
# @return Array for valid properties with the reasons
|
147
|
+
def list_invalid_properties
|
148
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
149
|
+
invalid_properties = Array.new
|
150
|
+
if !@company.nil? && @company.to_s.length > 50
|
151
|
+
invalid_properties.push('invalid value for "company", the character length must be smaller than or equal to 50.')
|
152
|
+
end
|
153
|
+
|
154
|
+
if !@email.nil? && @email.to_s.length > 254
|
155
|
+
invalid_properties.push('invalid value for "email", the character length must be smaller than or equal to 254.')
|
156
|
+
end
|
157
|
+
|
158
|
+
if !@mobile_no.nil? && @mobile_no.to_s.length > 20
|
159
|
+
invalid_properties.push('invalid value for "mobile_no", the character length must be smaller than or equal to 20.')
|
160
|
+
end
|
161
|
+
|
162
|
+
invalid_properties
|
163
|
+
end
|
164
|
+
|
165
|
+
# Check to see if the all the properties in the model are valid
|
166
|
+
# @return true if the model is valid
|
167
|
+
def valid?
|
168
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
169
|
+
return false if !@company.nil? && @company.to_s.length > 50
|
170
|
+
return false if !@email.nil? && @email.to_s.length > 254
|
171
|
+
return false if !@mobile_no.nil? && @mobile_no.to_s.length > 20
|
172
|
+
true
|
173
|
+
end
|
174
|
+
|
175
|
+
# Custom attribute writer method with validation
|
176
|
+
# @param [Object] company Value to be assigned
|
177
|
+
def company=(company)
|
178
|
+
if company.nil?
|
179
|
+
fail ArgumentError, 'company cannot be nil'
|
180
|
+
end
|
181
|
+
|
182
|
+
if company.to_s.length > 50
|
183
|
+
fail ArgumentError, 'invalid value for "company", the character length must be smaller than or equal to 50.'
|
184
|
+
end
|
185
|
+
|
186
|
+
@company = company
|
187
|
+
end
|
188
|
+
|
189
|
+
# Custom attribute writer method with validation
|
190
|
+
# @param [Object] email Value to be assigned
|
191
|
+
def email=(email)
|
192
|
+
if email.nil?
|
193
|
+
fail ArgumentError, 'email cannot be nil'
|
194
|
+
end
|
195
|
+
|
196
|
+
if email.to_s.length > 254
|
197
|
+
fail ArgumentError, 'invalid value for "email", the character length must be smaller than or equal to 254.'
|
198
|
+
end
|
199
|
+
|
200
|
+
@email = email
|
201
|
+
end
|
202
|
+
|
203
|
+
# Custom attribute writer method with validation
|
204
|
+
# @param [Object] mobile_no Value to be assigned
|
205
|
+
def mobile_no=(mobile_no)
|
206
|
+
if mobile_no.nil?
|
207
|
+
fail ArgumentError, 'mobile_no cannot be nil'
|
208
|
+
end
|
209
|
+
|
210
|
+
if mobile_no.to_s.length > 20
|
211
|
+
fail ArgumentError, 'invalid value for "mobile_no", the character length must be smaller than or equal to 20.'
|
212
|
+
end
|
213
|
+
|
214
|
+
@mobile_no = mobile_no
|
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
|
+
accept_headers == o.accept_headers &&
|
223
|
+
address == o.address &&
|
224
|
+
company == o.company &&
|
225
|
+
email == o.email &&
|
226
|
+
firstname == o.firstname &&
|
227
|
+
lastname == o.lastname &&
|
228
|
+
mobile_no == o.mobile_no &&
|
229
|
+
remote_addr == o.remote_addr &&
|
230
|
+
title == o.title &&
|
231
|
+
user_agent == o.user_agent
|
232
|
+
end
|
233
|
+
|
234
|
+
# @see the `==` method
|
235
|
+
# @param [Object] Object to be compared
|
236
|
+
def eql?(o)
|
237
|
+
self == o
|
238
|
+
end
|
239
|
+
|
240
|
+
# Calculates hash code according to all attributes.
|
241
|
+
# @return [Integer] Hash code
|
242
|
+
def hash
|
243
|
+
[accept_headers, address, company, email, firstname, lastname, mobile_no, remote_addr, title, user_agent].hash
|
244
|
+
end
|
245
|
+
|
246
|
+
# Builds the object from hash
|
247
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
248
|
+
# @return [Object] Returns the model itself
|
249
|
+
def self.build_from_hash(attributes)
|
250
|
+
return nil unless attributes.is_a?(Hash)
|
251
|
+
attributes = attributes.transform_keys(&:to_sym)
|
252
|
+
transformed_hash = {}
|
253
|
+
openapi_types.each_pair do |key, type|
|
254
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
255
|
+
transformed_hash["#{key}"] = nil
|
256
|
+
elsif type =~ /\AArray<(.*)>/i
|
257
|
+
# check to ensure the input is an array given that the attribute
|
258
|
+
# is documented as an array but the input is not
|
259
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
260
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
261
|
+
end
|
262
|
+
elsif !attributes[attribute_map[key]].nil?
|
263
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
264
|
+
end
|
265
|
+
end
|
266
|
+
new(transformed_hash)
|
267
|
+
end
|
268
|
+
|
269
|
+
# Deserializes the data based on type
|
270
|
+
# @param string type Data type
|
271
|
+
# @param string value Value to be deserialized
|
272
|
+
# @return [Object] Deserialized data
|
273
|
+
def self._deserialize(type, value)
|
274
|
+
case type.to_sym
|
275
|
+
when :Time
|
276
|
+
Time.parse(value)
|
277
|
+
when :Date
|
278
|
+
Date.parse(value)
|
279
|
+
when :String
|
280
|
+
value.to_s
|
281
|
+
when :Integer
|
282
|
+
value.to_i
|
283
|
+
when :Float
|
284
|
+
value.to_f
|
285
|
+
when :Boolean
|
286
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
287
|
+
true
|
288
|
+
else
|
289
|
+
false
|
290
|
+
end
|
291
|
+
when :Object
|
292
|
+
# generic object (usually a Hash), return directly
|
293
|
+
value
|
294
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
295
|
+
inner_type = Regexp.last_match[:inner_type]
|
296
|
+
value.map { |v| _deserialize(inner_type, v) }
|
297
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
298
|
+
k_type = Regexp.last_match[:k_type]
|
299
|
+
v_type = Regexp.last_match[:v_type]
|
300
|
+
{}.tap do |hash|
|
301
|
+
value.each do |k, v|
|
302
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
303
|
+
end
|
304
|
+
end
|
305
|
+
else # model
|
306
|
+
# models (e.g. Pet) or oneOf
|
307
|
+
klass = CityPayApiClient.const_get(type)
|
308
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
309
|
+
end
|
310
|
+
end
|
311
|
+
|
312
|
+
# Returns the string representation of the object
|
313
|
+
# @return [String] String presentation of the object
|
314
|
+
def to_s
|
315
|
+
to_hash.to_s
|
316
|
+
end
|
317
|
+
|
318
|
+
# to_body is an alias to to_hash (backward compatibility)
|
319
|
+
# @return [Hash] Returns the object in the form of hash
|
320
|
+
def to_body
|
321
|
+
to_hash
|
322
|
+
end
|
323
|
+
|
324
|
+
# Returns the object in the form of hash
|
325
|
+
# @return [Hash] Returns the object in the form of hash
|
326
|
+
def to_hash
|
327
|
+
hash = {}
|
328
|
+
self.class.attribute_map.each_pair do |attr, param|
|
329
|
+
value = self.send(attr)
|
330
|
+
if value.nil?
|
331
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
332
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
333
|
+
end
|
334
|
+
|
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
|
+
|
358
|
+
end
|
359
|
+
|
360
|
+
end
|