signwell_sdk 0.1.2 → 0.2.0
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/.github/workflows/ci.yml +3 -3
- data/.github/workflows/generator-ownership.yml +1 -1
- data/.github/workflows/manual-release.yml +1 -1
- data/.github/workflows/release.yml +1 -1
- data/.release-please-manifest.json +1 -1
- data/CHANGELOG.md +20 -0
- data/Gemfile.lock +16 -12
- data/README.md +11 -0
- data/docs/AdditionalFieldsInnerInner.md +4 -0
- data/docs/BulkSendCsvRequest.md +1 -1
- data/docs/ConditionalLogicDecisionInfo.md +26 -0
- data/docs/ConditionalRuleInfo.md +26 -0
- data/docs/ConditionalRuleInfoConditionsInner.md +26 -0
- data/docs/ConditionalRuleRequest.md +28 -0
- data/docs/ConditionalRuleRequestConditionsInner.md +26 -0
- data/docs/CopiedPlaceholdersInner.md +1 -1
- data/docs/CreateBulkSendRequest.md +2 -2
- data/docs/DocumentApi.md +82 -8
- data/docs/DocumentFromTemplateRequest.md +11 -3
- data/docs/DocumentFromTemplateResponse.md +11 -1
- data/docs/DocumentFromTemplateResponseFieldsInnerInner.md +4 -0
- data/docs/DocumentFromTemplateResponseRecipientsInner.md +6 -0
- data/docs/DocumentRequest.md +10 -4
- data/docs/DocumentResponse.md +11 -1
- data/docs/DocumentResponseFieldsInnerInner.md +4 -0
- data/docs/DocumentResponseRecipientsInner.md +6 -0
- data/docs/DocumentResponseRecipientsInnerPasscodeDelivery.md +22 -0
- data/docs/DocumentResponseRecipientsInnerSms.md +30 -0
- data/docs/DocumentTemplateRequest.md +5 -3
- data/docs/DocumentTemplateResponse.md +3 -1
- data/docs/DocumentTemplateResponsePlaceholdersInner.md +3 -1
- data/docs/DocumentTemplateUpdateRequest.md +5 -3
- data/docs/EmbeddedBranding.md +18 -0
- data/docs/EmbeddedBrandingBranding.md +26 -0
- data/docs/EmbeddedBrandingRequest.md +26 -0
- data/docs/EmbeddedBrandingRequestCompanyLogo.md +20 -0
- data/docs/EmbeddedRequest.md +18 -0
- data/docs/FieldsInnerInner.md +4 -0
- data/docs/PlaceholdersInner.md +4 -2
- data/docs/PlaceholdersInnerPasscodeDelivery.md +22 -0
- data/docs/RecipientsInner.md +14 -4
- data/docs/RecipientsInnerPasscodeDelivery.md +22 -0
- data/docs/ReminderRecipientsInner.md +1 -1
- data/docs/SendReminderRequest.md +1 -1
- data/docs/TemplateFieldsInnerInner.md +4 -0
- data/docs/TemplateRecipientsInner.md +14 -4
- data/docs/UpdateAuthenticationRequest.md +18 -0
- data/docs/UpdateAuthenticationRequestRecipientsInner.md +22 -0
- data/docs/UpdateDocumentAndSendRequest.md +9 -3
- data/docs/UpdateRecipientsMapInner.md +4 -2
- data/docs/UpdateRecipientsMapInnerPasscodeDelivery.md +22 -0
- data/docs/WebhooksApi.md +1 -1
- data/lib/signwell_sdk/api/api_application_api.rb +1 -2
- data/lib/signwell_sdk/api/bulk_send_api.rb +1 -2
- data/lib/signwell_sdk/api/document_api.rb +87 -14
- data/lib/signwell_sdk/api/me_api.rb +1 -2
- data/lib/signwell_sdk/api/regional_api.rb +1 -2
- data/lib/signwell_sdk/api/template_api.rb +1 -2
- data/lib/signwell_sdk/api/webhooks_api.rb +3 -4
- data/lib/signwell_sdk/api_client.rb +26 -6
- data/lib/signwell_sdk/api_error.rb +1 -2
- data/lib/signwell_sdk/api_model_base.rb +88 -0
- data/lib/signwell_sdk/configuration.rb +1 -1
- data/lib/signwell_sdk/extras/rate_limit.rb +17 -0
- data/lib/signwell_sdk/models/account_info_response.rb +1 -2
- data/lib/signwell_sdk/models/account_info_response_active_users_inner.rb +1 -2
- data/lib/signwell_sdk/models/account_info_response_preferences.rb +1 -2
- data/lib/signwell_sdk/models/additional_fields_inner_inner.rb +24 -3
- data/lib/signwell_sdk/models/additional_fields_inner_inner_value.rb +3 -4
- data/lib/signwell_sdk/models/additional_files_inner.rb +1 -2
- data/lib/signwell_sdk/models/api_application_response.rb +1 -2
- data/lib/signwell_sdk/models/api_application_response_owner.rb +1 -2
- data/lib/signwell_sdk/models/api_application_response_preferences.rb +1 -2
- data/lib/signwell_sdk/models/attachment_request_info.rb +1 -2
- data/lib/signwell_sdk/models/attachment_requests_inner.rb +1 -2
- data/lib/signwell_sdk/models/bulk_send_create_response.rb +1 -2
- data/lib/signwell_sdk/models/bulk_send_csv_request.rb +2 -3
- data/lib/signwell_sdk/models/bulk_send_csv_template_response.rb +1 -2
- data/lib/signwell_sdk/models/bulk_send_documents_response.rb +1 -2
- data/lib/signwell_sdk/models/bulk_send_list_item.rb +1 -2
- data/lib/signwell_sdk/models/bulk_send_list_response.rb +1 -2
- data/lib/signwell_sdk/models/bulk_send_response.rb +1 -2
- data/lib/signwell_sdk/models/bulk_send_response_templates_inner.rb +1 -2
- data/lib/signwell_sdk/models/bulk_send_validate_csv_response.rb +1 -2
- data/lib/signwell_sdk/models/checkbox_group_info.rb +1 -2
- data/lib/signwell_sdk/models/checkbox_groups_inner.rb +1 -2
- data/lib/signwell_sdk/models/checkbox_validation.rb +4 -3
- data/lib/signwell_sdk/models/completed_pdf_response.rb +3 -4
- data/lib/signwell_sdk/models/completed_pdf_url_response.rb +1 -2
- data/lib/signwell_sdk/models/conditional_logic_decision_info.rb +365 -0
- data/lib/signwell_sdk/models/conditional_rule_info.rb +351 -0
- data/lib/signwell_sdk/models/conditional_rule_info_conditions_inner.rb +340 -0
- data/lib/signwell_sdk/models/conditional_rule_request.rb +322 -0
- data/lib/signwell_sdk/models/conditional_rule_request_conditions_inner.rb +371 -0
- data/lib/signwell_sdk/models/copied_contact_info.rb +1 -2
- data/lib/signwell_sdk/models/copied_contacts_inner.rb +1 -2
- data/lib/signwell_sdk/models/copied_placeholders_inner.rb +2 -3
- data/lib/signwell_sdk/models/create_bulk_send_request.rb +3 -4
- data/lib/signwell_sdk/models/create_webhook_request.rb +1 -2
- data/lib/signwell_sdk/models/date_format.rb +4 -3
- data/lib/signwell_sdk/models/detailed_option.rb +1 -2
- data/lib/signwell_sdk/models/document_from_template_request.rb +90 -6
- data/lib/signwell_sdk/models/document_from_template_response.rb +101 -6
- data/lib/signwell_sdk/models/document_from_template_response_fields_inner_inner.rb +24 -3
- data/lib/signwell_sdk/models/document_from_template_response_fields_inner_inner_recipient.rb +1 -2
- data/lib/signwell_sdk/models/document_from_template_response_recipients_inner.rb +71 -3
- data/lib/signwell_sdk/models/document_list_response.rb +1 -2
- data/lib/signwell_sdk/models/document_request.rb +42 -7
- data/lib/signwell_sdk/models/document_response.rb +101 -6
- data/lib/signwell_sdk/models/document_response_attachment_requests_inner.rb +1 -2
- data/lib/signwell_sdk/models/document_response_fields_inner_inner.rb +24 -3
- data/lib/signwell_sdk/models/document_response_fields_inner_inner_options_inner.rb +1 -2
- data/lib/signwell_sdk/models/document_response_fields_inner_inner_recipient.rb +1 -2
- data/lib/signwell_sdk/models/document_response_fields_inner_inner_value.rb +3 -4
- data/lib/signwell_sdk/models/document_response_recipients_inner.rb +71 -3
- data/lib/signwell_sdk/models/document_response_recipients_inner_passcode_delivery.rb +246 -0
- data/lib/signwell_sdk/models/document_response_recipients_inner_sms.rb +292 -0
- data/lib/signwell_sdk/models/document_template_list_response.rb +1 -2
- data/lib/signwell_sdk/models/document_template_request.rb +18 -6
- data/lib/signwell_sdk/models/document_template_response.rb +17 -6
- data/lib/signwell_sdk/models/document_template_response_copied_placeholders_inner.rb +1 -2
- data/lib/signwell_sdk/models/document_template_response_placeholders_inner.rb +15 -6
- data/lib/signwell_sdk/models/document_template_update_request.rb +18 -6
- data/lib/signwell_sdk/models/dropdown_option.rb +3 -4
- data/lib/signwell_sdk/models/embedded_branding.rb +241 -0
- data/lib/signwell_sdk/models/embedded_branding_branding.rb +307 -0
- data/lib/signwell_sdk/models/embedded_branding_request.rb +297 -0
- data/lib/signwell_sdk/models/embedded_branding_request_company_logo.rb +236 -0
- data/lib/signwell_sdk/models/embedded_request.rb +225 -0
- data/lib/signwell_sdk/models/error_response.rb +1 -2
- data/lib/signwell_sdk/models/error_response_meta.rb +1 -2
- data/lib/signwell_sdk/models/field_type.rb +4 -3
- data/lib/signwell_sdk/models/fields_inner_inner.rb +24 -3
- data/lib/signwell_sdk/models/file_format.rb +4 -3
- data/lib/signwell_sdk/models/file_info.rb +1 -2
- data/lib/signwell_sdk/models/files_inner.rb +1 -2
- data/lib/signwell_sdk/models/label_info.rb +1 -2
- data/lib/signwell_sdk/models/label_request.rb +1 -2
- data/lib/signwell_sdk/models/label_response.rb +1 -2
- data/lib/signwell_sdk/models/me_response.rb +1 -2
- data/lib/signwell_sdk/models/me_response_contact.rb +1 -2
- data/lib/signwell_sdk/models/me_response_user.rb +1 -2
- data/lib/signwell_sdk/models/me_response_user_preferences.rb +1 -2
- data/lib/signwell_sdk/models/nom151_certificate_response.rb +1 -2
- data/lib/signwell_sdk/models/nom151_certificate_response_nom151.rb +1 -2
- data/lib/signwell_sdk/models/nom151_url_response.rb +1 -2
- data/lib/signwell_sdk/models/pagination_meta.rb +1 -2
- data/lib/signwell_sdk/models/placeholders_inner.rb +16 -7
- data/lib/signwell_sdk/models/placeholders_inner_passcode_delivery.rb +271 -0
- data/lib/signwell_sdk/models/rate_limit_error_response.rb +1 -2
- data/lib/signwell_sdk/models/recipients_inner.rb +103 -23
- data/lib/signwell_sdk/models/recipients_inner_passcode_delivery.rb +271 -0
- data/lib/signwell_sdk/models/reminder_recipients_inner.rb +2 -3
- data/lib/signwell_sdk/models/send_reminder_request.rb +2 -3
- data/lib/signwell_sdk/models/template_attachment_requests_inner.rb +1 -2
- data/lib/signwell_sdk/models/template_checkbox_groups_inner.rb +1 -2
- data/lib/signwell_sdk/models/template_field_values_inner.rb +1 -2
- data/lib/signwell_sdk/models/template_field_values_inner_value.rb +3 -4
- data/lib/signwell_sdk/models/template_fields_inner_inner.rb +24 -3
- data/lib/signwell_sdk/models/template_recipients_inner.rb +103 -23
- data/lib/signwell_sdk/models/text_validation.rb +5 -3
- data/lib/signwell_sdk/models/update_authentication_request.rb +243 -0
- data/lib/signwell_sdk/models/update_authentication_request_recipients_inner.rb +262 -0
- data/lib/signwell_sdk/models/update_document_and_send_request.rb +41 -6
- data/lib/signwell_sdk/models/update_recipients_map_inner.rb +16 -7
- data/lib/signwell_sdk/models/update_recipients_map_inner_passcode_delivery.rb +271 -0
- data/lib/signwell_sdk/models/update_recipients_request.rb +1 -2
- data/lib/signwell_sdk/models/validation_error_response.rb +1 -2
- data/lib/signwell_sdk/models/webhook_response.rb +1 -2
- data/lib/signwell_sdk/version.rb +4 -4
- data/lib/signwell_sdk.rb +19 -2
- data/openapi.yaml +2231 -972
- data/package-lock.json +542 -136
- data/package.json +4 -1
- data/signwell_sdk.gemspec +1 -2
- data/spec/api/api_application_api_spec.rb +1 -2
- data/spec/api/bulk_send_api_spec.rb +1 -2
- data/spec/api/document_api_spec.rb +11 -4
- data/spec/api/me_api_spec.rb +1 -2
- data/spec/api/regional_api_spec.rb +1 -2
- data/spec/api/template_api_spec.rb +1 -2
- data/spec/api/webhooks_api_spec.rb +1 -2
- data/spec/models/account_info_response_active_users_inner_spec.rb +1 -2
- data/spec/models/account_info_response_preferences_spec.rb +1 -2
- data/spec/models/account_info_response_spec.rb +1 -2
- data/spec/models/additional_fields_inner_inner_spec.rb +13 -2
- data/spec/models/additional_fields_inner_inner_value_spec.rb +1 -2
- data/spec/models/additional_files_inner_spec.rb +1 -2
- data/spec/models/api_application_response_owner_spec.rb +1 -2
- data/spec/models/api_application_response_preferences_spec.rb +1 -2
- data/spec/models/api_application_response_spec.rb +1 -2
- data/spec/models/attachment_request_info_spec.rb +1 -2
- data/spec/models/attachment_requests_inner_spec.rb +1 -2
- data/spec/models/bulk_send_create_response_spec.rb +1 -2
- data/spec/models/bulk_send_csv_request_spec.rb +1 -2
- data/spec/models/bulk_send_csv_template_response_spec.rb +1 -2
- data/spec/models/bulk_send_documents_response_spec.rb +1 -2
- data/spec/models/bulk_send_list_item_spec.rb +1 -2
- data/spec/models/bulk_send_list_response_spec.rb +1 -2
- data/spec/models/bulk_send_response_spec.rb +1 -2
- data/spec/models/bulk_send_response_templates_inner_spec.rb +1 -2
- data/spec/models/bulk_send_validate_csv_response_spec.rb +1 -2
- data/spec/models/checkbox_group_info_spec.rb +1 -2
- data/spec/models/checkbox_groups_inner_spec.rb +1 -2
- data/spec/models/checkbox_validation_spec.rb +1 -2
- data/spec/models/completed_pdf_response_spec.rb +1 -2
- data/spec/models/completed_pdf_url_response_spec.rb +1 -2
- data/spec/models/conditional_logic_decision_info_spec.rb +58 -0
- data/spec/models/conditional_rule_info_conditions_inner_spec.rb +58 -0
- data/spec/models/conditional_rule_info_spec.rb +58 -0
- data/spec/models/conditional_rule_request_conditions_inner_spec.rb +58 -0
- data/spec/models/conditional_rule_request_spec.rb +64 -0
- data/spec/models/copied_contact_info_spec.rb +1 -2
- data/spec/models/copied_contacts_inner_spec.rb +1 -2
- data/spec/models/copied_placeholders_inner_spec.rb +1 -2
- data/spec/models/create_bulk_send_request_spec.rb +1 -2
- data/spec/models/create_webhook_request_spec.rb +1 -2
- data/spec/models/date_format_spec.rb +1 -2
- data/spec/models/detailed_option_spec.rb +1 -2
- data/spec/models/document_from_template_request_spec.rb +25 -2
- data/spec/models/document_from_template_response_fields_inner_inner_recipient_spec.rb +1 -2
- data/spec/models/document_from_template_response_fields_inner_inner_spec.rb +13 -2
- data/spec/models/document_from_template_response_recipients_inner_spec.rb +19 -2
- data/spec/models/document_from_template_response_spec.rb +31 -2
- data/spec/models/document_list_response_spec.rb +1 -2
- data/spec/models/document_request_spec.rb +19 -2
- data/spec/models/document_response_attachment_requests_inner_spec.rb +1 -2
- data/spec/models/document_response_fields_inner_inner_options_inner_spec.rb +1 -2
- data/spec/models/document_response_fields_inner_inner_recipient_spec.rb +1 -2
- data/spec/models/document_response_fields_inner_inner_spec.rb +13 -2
- data/spec/models/document_response_fields_inner_inner_value_spec.rb +1 -2
- data/spec/models/document_response_recipients_inner_passcode_delivery_spec.rb +46 -0
- data/spec/models/document_response_recipients_inner_sms_spec.rb +70 -0
- data/spec/models/document_response_recipients_inner_spec.rb +19 -2
- data/spec/models/document_response_spec.rb +31 -2
- data/spec/models/document_template_list_response_spec.rb +1 -2
- data/spec/models/document_template_request_spec.rb +7 -2
- data/spec/models/document_template_response_copied_placeholders_inner_spec.rb +1 -2
- data/spec/models/document_template_response_placeholders_inner_spec.rb +7 -2
- data/spec/models/document_template_response_spec.rb +7 -2
- data/spec/models/document_template_update_request_spec.rb +7 -2
- data/spec/models/dropdown_option_spec.rb +1 -2
- data/spec/models/embedded_branding_branding_spec.rb +58 -0
- data/spec/models/embedded_branding_request_company_logo_spec.rb +40 -0
- data/spec/models/embedded_branding_request_spec.rb +58 -0
- data/spec/models/embedded_branding_spec.rb +34 -0
- data/spec/models/embedded_request_spec.rb +34 -0
- data/spec/models/error_response_meta_spec.rb +1 -2
- data/spec/models/error_response_spec.rb +1 -2
- data/spec/models/field_type_spec.rb +1 -2
- data/spec/models/fields_inner_inner_spec.rb +13 -2
- data/spec/models/file_format_spec.rb +1 -2
- data/spec/models/file_info_spec.rb +1 -2
- data/spec/models/files_inner_spec.rb +1 -2
- data/spec/models/label_info_spec.rb +1 -2
- data/spec/models/label_request_spec.rb +1 -2
- data/spec/models/label_response_spec.rb +1 -2
- data/spec/models/me_response_contact_spec.rb +1 -2
- data/spec/models/me_response_spec.rb +1 -2
- data/spec/models/me_response_user_preferences_spec.rb +1 -2
- data/spec/models/me_response_user_spec.rb +1 -2
- data/spec/models/nom151_certificate_response_nom151_spec.rb +1 -2
- data/spec/models/nom151_certificate_response_spec.rb +1 -2
- data/spec/models/nom151_url_response_spec.rb +1 -2
- data/spec/models/pagination_meta_spec.rb +1 -2
- data/spec/models/placeholders_inner_passcode_delivery_spec.rb +46 -0
- data/spec/models/placeholders_inner_spec.rb +7 -2
- data/spec/models/rate_limit_error_response_spec.rb +1 -2
- data/spec/models/recipients_inner_passcode_delivery_spec.rb +46 -0
- data/spec/models/recipients_inner_spec.rb +31 -2
- data/spec/models/reminder_recipients_inner_spec.rb +1 -2
- data/spec/models/send_reminder_request_spec.rb +1 -2
- data/spec/models/template_attachment_requests_inner_spec.rb +1 -2
- data/spec/models/template_checkbox_groups_inner_spec.rb +1 -2
- data/spec/models/template_field_values_inner_spec.rb +1 -2
- data/spec/models/template_field_values_inner_value_spec.rb +1 -2
- data/spec/models/template_fields_inner_inner_spec.rb +13 -2
- data/spec/models/template_recipients_inner_spec.rb +31 -2
- data/spec/models/text_validation_spec.rb +1 -2
- data/spec/models/update_authentication_request_recipients_inner_spec.rb +46 -0
- data/spec/models/update_authentication_request_spec.rb +34 -0
- data/spec/models/update_document_and_send_request_spec.rb +19 -2
- data/spec/models/update_recipients_map_inner_passcode_delivery_spec.rb +46 -0
- data/spec/models/update_recipients_map_inner_spec.rb +7 -2
- data/spec/models/update_recipients_request_spec.rb +1 -2
- data/spec/models/validation_error_response_spec.rb +1 -2
- data/spec/models/webhook_response_spec.rb +1 -2
- data/spec/regressions/api_client_spec.rb +56 -1
- data/spec/spec_helper.rb +1 -2
- metadata +73 -3
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
SignWell Developer API
|
|
3
|
+
|
|
4
|
+
API for creating, managing, and tracking electronic signature workflows.
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: v1
|
|
7
|
+
Contact: support@signwell.com
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.26.0
|
|
10
|
+
=end
|
|
11
|
+
|
|
12
|
+
require 'date'
|
|
13
|
+
require 'time'
|
|
14
|
+
|
|
15
|
+
module SignWell
|
|
16
|
+
module Models
|
|
17
|
+
class ConditionalRuleInfoConditionsInner
|
|
18
|
+
# How field_api_ids combine within this condition
|
|
19
|
+
# @return [String]
|
|
20
|
+
attr_accessor :condition_type
|
|
21
|
+
|
|
22
|
+
# Field state that satisfies this condition
|
|
23
|
+
# @return [String]
|
|
24
|
+
attr_accessor :status
|
|
25
|
+
|
|
26
|
+
# How this condition joins with the next one in the rule
|
|
27
|
+
# @return [String]
|
|
28
|
+
attr_accessor :join_operator
|
|
29
|
+
|
|
30
|
+
# api_ids of fields evaluated by this condition
|
|
31
|
+
# @return [Array<String>]
|
|
32
|
+
attr_accessor :field_api_ids
|
|
33
|
+
|
|
34
|
+
# Order of this condition within the rule
|
|
35
|
+
# @return [Integer]
|
|
36
|
+
attr_accessor :position
|
|
37
|
+
|
|
38
|
+
class EnumAttributeValidator
|
|
39
|
+
attr_reader :datatype
|
|
40
|
+
attr_reader :allowable_values
|
|
41
|
+
|
|
42
|
+
def initialize(datatype, allowable_values)
|
|
43
|
+
@allowable_values = allowable_values.map do |value|
|
|
44
|
+
case datatype.to_s
|
|
45
|
+
when /Integer/i
|
|
46
|
+
value.to_i
|
|
47
|
+
when /Float/i
|
|
48
|
+
value.to_f
|
|
49
|
+
else
|
|
50
|
+
value
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def valid?(value)
|
|
56
|
+
!value || allowable_values.include?(value)
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
61
|
+
def self.attribute_map
|
|
62
|
+
{
|
|
63
|
+
:'condition_type' => :'condition_type',
|
|
64
|
+
:'status' => :'status',
|
|
65
|
+
:'join_operator' => :'join_operator',
|
|
66
|
+
:'field_api_ids' => :'field_api_ids',
|
|
67
|
+
:'position' => :'position'
|
|
68
|
+
}
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# Returns attribute mapping this model knows about
|
|
72
|
+
def self.acceptable_attribute_map
|
|
73
|
+
attribute_map
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# Returns all the JSON keys this model knows about
|
|
77
|
+
def self.acceptable_attributes
|
|
78
|
+
acceptable_attribute_map.values
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# Attribute type mapping.
|
|
82
|
+
def self.openapi_types
|
|
83
|
+
{
|
|
84
|
+
:'condition_type' => :'String',
|
|
85
|
+
:'status' => :'String',
|
|
86
|
+
:'join_operator' => :'String',
|
|
87
|
+
:'field_api_ids' => :'Array<String>',
|
|
88
|
+
:'position' => :'Integer'
|
|
89
|
+
}
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# List of attributes with nullable: true
|
|
93
|
+
def self.openapi_nullable
|
|
94
|
+
Set.new([
|
|
95
|
+
])
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# Initializes the object
|
|
99
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
100
|
+
def initialize(attributes = {})
|
|
101
|
+
if (!attributes.is_a?(Hash))
|
|
102
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `SignWell::ConditionalRuleInfoConditionsInner` initialize method"
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
106
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
107
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
108
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
109
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `SignWell::ConditionalRuleInfoConditionsInner`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
110
|
+
end
|
|
111
|
+
h[k.to_sym] = v
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if attributes.key?(:'condition_type')
|
|
115
|
+
self.condition_type = attributes[:'condition_type']
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
if attributes.key?(:'status')
|
|
119
|
+
self.status = attributes[:'status']
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
if attributes.key?(:'join_operator')
|
|
123
|
+
self.join_operator = attributes[:'join_operator']
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
if attributes.key?(:'field_api_ids')
|
|
127
|
+
if (value = attributes[:'field_api_ids']).is_a?(Array)
|
|
128
|
+
self.field_api_ids = value
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
if attributes.key?(:'position')
|
|
133
|
+
self.position = attributes[:'position']
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
139
|
+
# @return Array for valid properties with the reasons
|
|
140
|
+
def list_invalid_properties
|
|
141
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
142
|
+
invalid_properties = Array.new
|
|
143
|
+
invalid_properties
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
# Check to see if the all the properties in the model are valid
|
|
147
|
+
# @return true if the model is valid
|
|
148
|
+
def valid?
|
|
149
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
150
|
+
condition_type_validator = EnumAttributeValidator.new('String', %w[any_of all_of none_of not_all_of unknown_default_open_api])
|
|
151
|
+
return false unless condition_type_validator.valid?(@condition_type)
|
|
152
|
+
status_validator = EnumAttributeValidator.new('String', %w[completed not_completed unknown_default_open_api])
|
|
153
|
+
return false unless status_validator.valid?(@status)
|
|
154
|
+
join_operator_validator = EnumAttributeValidator.new('String', %w[and_operator or_operator unknown_default_open_api])
|
|
155
|
+
return false unless join_operator_validator.valid?(@join_operator)
|
|
156
|
+
true
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
160
|
+
# @param [Object] condition_type Object to be assigned
|
|
161
|
+
def condition_type=(condition_type)
|
|
162
|
+
validator = EnumAttributeValidator.new('String', %w[any_of all_of none_of not_all_of unknown_default_open_api])
|
|
163
|
+
unless validator.valid?(condition_type)
|
|
164
|
+
if condition_type.is_a?(String)
|
|
165
|
+
condition_type = "unknown_default_open_api"
|
|
166
|
+
else
|
|
167
|
+
fail ArgumentError, "invalid value for \"condition_type\", must be one of #{validator.allowable_values}."
|
|
168
|
+
end
|
|
169
|
+
end
|
|
170
|
+
@condition_type = condition_type
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
174
|
+
# @param [Object] status Object to be assigned
|
|
175
|
+
def status=(status)
|
|
176
|
+
validator = EnumAttributeValidator.new('String', %w[completed not_completed unknown_default_open_api])
|
|
177
|
+
unless validator.valid?(status)
|
|
178
|
+
if status.is_a?(String)
|
|
179
|
+
status = "unknown_default_open_api"
|
|
180
|
+
else
|
|
181
|
+
fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
|
|
182
|
+
end
|
|
183
|
+
end
|
|
184
|
+
@status = status
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
188
|
+
# @param [Object] join_operator Object to be assigned
|
|
189
|
+
def join_operator=(join_operator)
|
|
190
|
+
validator = EnumAttributeValidator.new('String', %w[and_operator or_operator unknown_default_open_api])
|
|
191
|
+
unless validator.valid?(join_operator)
|
|
192
|
+
if join_operator.is_a?(String)
|
|
193
|
+
join_operator = "unknown_default_open_api"
|
|
194
|
+
else
|
|
195
|
+
fail ArgumentError, "invalid value for \"join_operator\", must be one of #{validator.allowable_values}."
|
|
196
|
+
end
|
|
197
|
+
end
|
|
198
|
+
@join_operator = join_operator
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
# Checks equality by comparing each attribute.
|
|
202
|
+
# @param [Object] other Object to be compared
|
|
203
|
+
def ==(o)
|
|
204
|
+
return true if self.equal?(o)
|
|
205
|
+
self.class == o.class &&
|
|
206
|
+
condition_type == o.condition_type &&
|
|
207
|
+
status == o.status &&
|
|
208
|
+
join_operator == o.join_operator &&
|
|
209
|
+
field_api_ids == o.field_api_ids &&
|
|
210
|
+
position == o.position
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
# @see the `==` method
|
|
214
|
+
# @param [Object] other Object to be compared
|
|
215
|
+
def eql?(o)
|
|
216
|
+
self == o
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
# Calculates hash code according to all attributes.
|
|
220
|
+
# @return [Integer] Hash code
|
|
221
|
+
def hash
|
|
222
|
+
[condition_type, status, join_operator, field_api_ids, position].hash
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
# Builds the object from hash
|
|
226
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
227
|
+
# @return [Object] Returns the model itself
|
|
228
|
+
def self.build_from_hash(attributes)
|
|
229
|
+
return nil unless attributes.is_a?(Hash)
|
|
230
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
231
|
+
transformed_hash = {}
|
|
232
|
+
openapi_types.each_pair do |key, type|
|
|
233
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
234
|
+
transformed_hash["#{key}"] = nil
|
|
235
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
236
|
+
# check to ensure the input is an array given that the attribute
|
|
237
|
+
# is documented as an array but the input is not
|
|
238
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
239
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
240
|
+
end
|
|
241
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
242
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
243
|
+
end
|
|
244
|
+
end
|
|
245
|
+
new(transformed_hash)
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
# Deserializes the data based on type
|
|
249
|
+
# @param [String] type Data type
|
|
250
|
+
# @param [String] value Value to be deserialized
|
|
251
|
+
# @return [Object] Deserialized data
|
|
252
|
+
def self._deserialize(type, value)
|
|
253
|
+
case type.to_sym
|
|
254
|
+
when :Time
|
|
255
|
+
Time.parse(value)
|
|
256
|
+
when :Date
|
|
257
|
+
Date.parse(value)
|
|
258
|
+
when :String
|
|
259
|
+
value.to_s
|
|
260
|
+
when :Integer
|
|
261
|
+
value.to_i
|
|
262
|
+
when :Float
|
|
263
|
+
value.to_f
|
|
264
|
+
when :Boolean
|
|
265
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
266
|
+
true
|
|
267
|
+
else
|
|
268
|
+
false
|
|
269
|
+
end
|
|
270
|
+
when :Object
|
|
271
|
+
# generic object (usually a Hash), return directly
|
|
272
|
+
value
|
|
273
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
274
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
275
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
276
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
277
|
+
k_type = Regexp.last_match[:k_type]
|
|
278
|
+
v_type = Regexp.last_match[:v_type]
|
|
279
|
+
{}.tap do |hash|
|
|
280
|
+
value.each do |k, v|
|
|
281
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
282
|
+
end
|
|
283
|
+
end
|
|
284
|
+
else # model
|
|
285
|
+
# models (e.g. Pet) or oneOf
|
|
286
|
+
klass = SignWell::Models.const_get(type)
|
|
287
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
288
|
+
end
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
# Returns the string representation of the object
|
|
292
|
+
# @return [String] String presentation of the object
|
|
293
|
+
def to_s
|
|
294
|
+
to_hash.to_s
|
|
295
|
+
end
|
|
296
|
+
|
|
297
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
298
|
+
# @return [Hash] Returns the object in the form of hash
|
|
299
|
+
def to_body
|
|
300
|
+
to_hash
|
|
301
|
+
end
|
|
302
|
+
|
|
303
|
+
# Returns the object in the form of hash
|
|
304
|
+
# @return [Hash] Returns the object in the form of hash
|
|
305
|
+
def to_hash
|
|
306
|
+
normalize_for_serialization! if respond_to?(:normalize_for_serialization!, true)
|
|
307
|
+
|
|
308
|
+
hash = {}
|
|
309
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
310
|
+
value = self.send(attr)
|
|
311
|
+
if value.nil?
|
|
312
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
313
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
314
|
+
end
|
|
315
|
+
|
|
316
|
+
hash[param] = _to_hash(value)
|
|
317
|
+
end
|
|
318
|
+
hash
|
|
319
|
+
end
|
|
320
|
+
|
|
321
|
+
# Outputs non-array value in the form of hash
|
|
322
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
323
|
+
# @param [Object] value Any valid value
|
|
324
|
+
# @return [Hash] Returns the value in the form of hash
|
|
325
|
+
def _to_hash(value)
|
|
326
|
+
if value.is_a?(Array)
|
|
327
|
+
value.compact.map { |v| _to_hash(v) }
|
|
328
|
+
elsif value.is_a?(Hash)
|
|
329
|
+
{}.tap do |hash|
|
|
330
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
331
|
+
end
|
|
332
|
+
elsif value.respond_to? :to_hash
|
|
333
|
+
value.to_hash
|
|
334
|
+
else
|
|
335
|
+
value
|
|
336
|
+
end
|
|
337
|
+
end
|
|
338
|
+
end
|
|
339
|
+
end
|
|
340
|
+
end
|
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
SignWell Developer API
|
|
3
|
+
|
|
4
|
+
API for creating, managing, and tracking electronic signature workflows.
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: v1
|
|
7
|
+
Contact: support@signwell.com
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.26.0
|
|
10
|
+
=end
|
|
11
|
+
|
|
12
|
+
require 'date'
|
|
13
|
+
require 'time'
|
|
14
|
+
|
|
15
|
+
module SignWell
|
|
16
|
+
module Models
|
|
17
|
+
# A conditional logic rule. Create requires target_id, action_type, action_field_ids and conditions; id and deleted are ignored on create. On an update (template update or document update-and-send) the rules are an incremental upsert keyed by id: send id + the fields to change to modify a rule, id + deleted: true to remove it, or omit id to add a new rule.
|
|
18
|
+
class ConditionalRuleRequest
|
|
19
|
+
# The rule's persistent ID. Ignored on create (every rule is new). On an update (template update or document update-and-send) include it to modify an existing rule, or pair it with `deleted: true` to remove the rule; omit it to add a new rule.
|
|
20
|
+
# @return [String]
|
|
21
|
+
attr_accessor :id
|
|
22
|
+
|
|
23
|
+
# Only meaningful on an update (template update or document update-and-send): set to true together with the rule's `id` to remove that rule. Ignored on create — there is no existing rule to delete.
|
|
24
|
+
# @return [Boolean]
|
|
25
|
+
attr_accessor :deleted
|
|
26
|
+
|
|
27
|
+
# api_id of the field that owns the rule, or the external_id of a checkbox group when the rule is owned by a group (groups have no api_id). Cannot also appear in action_field_ids (self-reference is forbidden).
|
|
28
|
+
# @return [String]
|
|
29
|
+
attr_accessor :target_id
|
|
30
|
+
|
|
31
|
+
# Action applied to action_field_ids when the conditions are met: `show`, `hide`, or `require`.
|
|
32
|
+
# @return [String]
|
|
33
|
+
attr_accessor :action_type
|
|
34
|
+
|
|
35
|
+
# api_ids of the fields the action applies to. List a checkbox group's member api_ids to target the whole group.
|
|
36
|
+
# @return [Array<String>]
|
|
37
|
+
attr_accessor :action_field_ids
|
|
38
|
+
|
|
39
|
+
# The conditions that trigger the rule. At least 1, at most 5.
|
|
40
|
+
# @return [Array<ConditionalRuleRequestConditionsInner>]
|
|
41
|
+
attr_accessor :conditions
|
|
42
|
+
|
|
43
|
+
class EnumAttributeValidator
|
|
44
|
+
attr_reader :datatype
|
|
45
|
+
attr_reader :allowable_values
|
|
46
|
+
|
|
47
|
+
def initialize(datatype, allowable_values)
|
|
48
|
+
@allowable_values = allowable_values.map do |value|
|
|
49
|
+
case datatype.to_s
|
|
50
|
+
when /Integer/i
|
|
51
|
+
value.to_i
|
|
52
|
+
when /Float/i
|
|
53
|
+
value.to_f
|
|
54
|
+
else
|
|
55
|
+
value
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def valid?(value)
|
|
61
|
+
!value || allowable_values.include?(value)
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
66
|
+
def self.attribute_map
|
|
67
|
+
{
|
|
68
|
+
:'id' => :'id',
|
|
69
|
+
:'deleted' => :'deleted',
|
|
70
|
+
:'target_id' => :'target_id',
|
|
71
|
+
:'action_type' => :'action_type',
|
|
72
|
+
:'action_field_ids' => :'action_field_ids',
|
|
73
|
+
:'conditions' => :'conditions'
|
|
74
|
+
}
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Returns attribute mapping this model knows about
|
|
78
|
+
def self.acceptable_attribute_map
|
|
79
|
+
attribute_map
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# Returns all the JSON keys this model knows about
|
|
83
|
+
def self.acceptable_attributes
|
|
84
|
+
acceptable_attribute_map.values
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# Attribute type mapping.
|
|
88
|
+
def self.openapi_types
|
|
89
|
+
{
|
|
90
|
+
:'id' => :'String',
|
|
91
|
+
:'deleted' => :'Boolean',
|
|
92
|
+
:'target_id' => :'String',
|
|
93
|
+
:'action_type' => :'String',
|
|
94
|
+
:'action_field_ids' => :'Array<String>',
|
|
95
|
+
:'conditions' => :'Array<ConditionalRuleRequestConditionsInner>'
|
|
96
|
+
}
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
# List of attributes with nullable: true
|
|
100
|
+
def self.openapi_nullable
|
|
101
|
+
Set.new([
|
|
102
|
+
])
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# Initializes the object
|
|
106
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
107
|
+
def initialize(attributes = {})
|
|
108
|
+
if (!attributes.is_a?(Hash))
|
|
109
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `SignWell::ConditionalRuleRequest` initialize method"
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
113
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
114
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
115
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
116
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `SignWell::ConditionalRuleRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
117
|
+
end
|
|
118
|
+
h[k.to_sym] = v
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if attributes.key?(:'id')
|
|
122
|
+
self.id = attributes[:'id']
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
if attributes.key?(:'deleted')
|
|
126
|
+
self.deleted = attributes[:'deleted']
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
if attributes.key?(:'target_id')
|
|
130
|
+
self.target_id = attributes[:'target_id']
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
if attributes.key?(:'action_type')
|
|
134
|
+
self.action_type = attributes[:'action_type']
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
if attributes.key?(:'action_field_ids')
|
|
138
|
+
if (value = attributes[:'action_field_ids']).is_a?(Array)
|
|
139
|
+
self.action_field_ids = value
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
if attributes.key?(:'conditions')
|
|
144
|
+
if (value = attributes[:'conditions']).is_a?(Array)
|
|
145
|
+
self.conditions = value
|
|
146
|
+
end
|
|
147
|
+
end
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
152
|
+
# @return Array for valid properties with the reasons
|
|
153
|
+
def list_invalid_properties
|
|
154
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
155
|
+
invalid_properties = Array.new
|
|
156
|
+
invalid_properties
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
# Check to see if the all the properties in the model are valid
|
|
160
|
+
# @return true if the model is valid
|
|
161
|
+
def valid?
|
|
162
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
163
|
+
action_type_validator = EnumAttributeValidator.new('String', %w[show hide require unknown_default_open_api])
|
|
164
|
+
return false unless action_type_validator.valid?(@action_type)
|
|
165
|
+
true
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
169
|
+
# @param [Object] action_type Object to be assigned
|
|
170
|
+
def action_type=(action_type)
|
|
171
|
+
validator = EnumAttributeValidator.new('String', %w[show hide require unknown_default_open_api])
|
|
172
|
+
unless validator.valid?(action_type)
|
|
173
|
+
if action_type.is_a?(String)
|
|
174
|
+
action_type = "unknown_default_open_api"
|
|
175
|
+
else
|
|
176
|
+
fail ArgumentError, "invalid value for \"action_type\", must be one of #{validator.allowable_values}."
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
@action_type = action_type
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
# Checks equality by comparing each attribute.
|
|
183
|
+
# @param [Object] other Object to be compared
|
|
184
|
+
def ==(o)
|
|
185
|
+
return true if self.equal?(o)
|
|
186
|
+
self.class == o.class &&
|
|
187
|
+
id == o.id &&
|
|
188
|
+
deleted == o.deleted &&
|
|
189
|
+
target_id == o.target_id &&
|
|
190
|
+
action_type == o.action_type &&
|
|
191
|
+
action_field_ids == o.action_field_ids &&
|
|
192
|
+
conditions == o.conditions
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
# @see the `==` method
|
|
196
|
+
# @param [Object] other Object to be compared
|
|
197
|
+
def eql?(o)
|
|
198
|
+
self == o
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
# Calculates hash code according to all attributes.
|
|
202
|
+
# @return [Integer] Hash code
|
|
203
|
+
def hash
|
|
204
|
+
[id, deleted, target_id, action_type, action_field_ids, conditions].hash
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
# Builds the object from hash
|
|
208
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
209
|
+
# @return [Object] Returns the model itself
|
|
210
|
+
def self.build_from_hash(attributes)
|
|
211
|
+
return nil unless attributes.is_a?(Hash)
|
|
212
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
213
|
+
transformed_hash = {}
|
|
214
|
+
openapi_types.each_pair do |key, type|
|
|
215
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
216
|
+
transformed_hash["#{key}"] = nil
|
|
217
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
218
|
+
# check to ensure the input is an array given that the attribute
|
|
219
|
+
# is documented as an array but the input is not
|
|
220
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
221
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
222
|
+
end
|
|
223
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
224
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
225
|
+
end
|
|
226
|
+
end
|
|
227
|
+
new(transformed_hash)
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
# Deserializes the data based on type
|
|
231
|
+
# @param [String] type Data type
|
|
232
|
+
# @param [String] value Value to be deserialized
|
|
233
|
+
# @return [Object] Deserialized data
|
|
234
|
+
def self._deserialize(type, value)
|
|
235
|
+
case type.to_sym
|
|
236
|
+
when :Time
|
|
237
|
+
Time.parse(value)
|
|
238
|
+
when :Date
|
|
239
|
+
Date.parse(value)
|
|
240
|
+
when :String
|
|
241
|
+
value.to_s
|
|
242
|
+
when :Integer
|
|
243
|
+
value.to_i
|
|
244
|
+
when :Float
|
|
245
|
+
value.to_f
|
|
246
|
+
when :Boolean
|
|
247
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
248
|
+
true
|
|
249
|
+
else
|
|
250
|
+
false
|
|
251
|
+
end
|
|
252
|
+
when :Object
|
|
253
|
+
# generic object (usually a Hash), return directly
|
|
254
|
+
value
|
|
255
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
256
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
257
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
258
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
259
|
+
k_type = Regexp.last_match[:k_type]
|
|
260
|
+
v_type = Regexp.last_match[:v_type]
|
|
261
|
+
{}.tap do |hash|
|
|
262
|
+
value.each do |k, v|
|
|
263
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
264
|
+
end
|
|
265
|
+
end
|
|
266
|
+
else # model
|
|
267
|
+
# models (e.g. Pet) or oneOf
|
|
268
|
+
klass = SignWell::Models.const_get(type)
|
|
269
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
270
|
+
end
|
|
271
|
+
end
|
|
272
|
+
|
|
273
|
+
# Returns the string representation of the object
|
|
274
|
+
# @return [String] String presentation of the object
|
|
275
|
+
def to_s
|
|
276
|
+
to_hash.to_s
|
|
277
|
+
end
|
|
278
|
+
|
|
279
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
280
|
+
# @return [Hash] Returns the object in the form of hash
|
|
281
|
+
def to_body
|
|
282
|
+
to_hash
|
|
283
|
+
end
|
|
284
|
+
|
|
285
|
+
# Returns the object in the form of hash
|
|
286
|
+
# @return [Hash] Returns the object in the form of hash
|
|
287
|
+
def to_hash
|
|
288
|
+
normalize_for_serialization! if respond_to?(:normalize_for_serialization!, true)
|
|
289
|
+
|
|
290
|
+
hash = {}
|
|
291
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
292
|
+
value = self.send(attr)
|
|
293
|
+
if value.nil?
|
|
294
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
295
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
296
|
+
end
|
|
297
|
+
|
|
298
|
+
hash[param] = _to_hash(value)
|
|
299
|
+
end
|
|
300
|
+
hash
|
|
301
|
+
end
|
|
302
|
+
|
|
303
|
+
# Outputs non-array value in the form of hash
|
|
304
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
305
|
+
# @param [Object] value Any valid value
|
|
306
|
+
# @return [Hash] Returns the value in the form of hash
|
|
307
|
+
def _to_hash(value)
|
|
308
|
+
if value.is_a?(Array)
|
|
309
|
+
value.compact.map { |v| _to_hash(v) }
|
|
310
|
+
elsif value.is_a?(Hash)
|
|
311
|
+
{}.tap do |hash|
|
|
312
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
313
|
+
end
|
|
314
|
+
elsif value.respond_to? :to_hash
|
|
315
|
+
value.to_hash
|
|
316
|
+
else
|
|
317
|
+
value
|
|
318
|
+
end
|
|
319
|
+
end
|
|
320
|
+
end
|
|
321
|
+
end
|
|
322
|
+
end
|