fastly 16.1.0 → 17.0.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/CHANGELOG.md +58 -0
- data/Gemfile.lock +1 -1
- data/README.md +101 -58
- data/docs/Action.md +11 -0
- data/docs/ActionType.md +9 -0
- data/docs/AgentKey.md +14 -0
- data/docs/AgentKeyMeta.md +10 -0
- data/docs/Backend.md +3 -1
- data/docs/BackendApi.md +12 -4
- data/docs/BackendResponse.md +3 -1
- data/docs/BotManagementRequestUpdateConfiguration.md +10 -0
- data/docs/BotManagementResponseConfiguration.md +10 -0
- data/docs/BotManagementResponseConfigurationConfiguration.md +10 -0
- data/docs/BotManagementResponseConfigure.md +13 -0
- data/docs/ClientSideProtectionApi.md +821 -0
- data/docs/ConditionOperator.md +9 -0
- data/docs/ConditionType.md +9 -0
- data/docs/DdosProtectionApi.md +4 -4
- data/docs/Directive.md +11 -0
- data/docs/DmDomainsApi.md +2 -2
- data/docs/DmRoutingConfigsApi.md +912 -0
- data/docs/DomainOwnershipsApi.md +2 -2
- data/docs/DomainResearchApi.md +2 -2
- data/docs/DraftDiff.md +12 -0
- data/docs/DraftUpdate.md +10 -0
- data/docs/EventsResponse.md +1 -1
- data/docs/HeaderEvent.md +14 -0
- data/docs/InitialVersion.md +12 -0
- data/docs/InitialVersionPath.md +11 -0
- data/docs/InlineResponse20010.md +2 -2
- data/docs/InlineResponse20011.md +2 -2
- data/docs/InlineResponse20012.md +1 -1
- data/docs/InlineResponse20013.md +2 -2
- data/docs/InlineResponse20014.md +2 -1
- data/docs/InlineResponse20015.md +10 -0
- data/docs/InlineResponse20016.md +10 -0
- data/docs/InlineResponse20017.md +11 -0
- data/docs/InlineResponse20018.md +11 -0
- data/docs/InlineResponse20019.md +11 -0
- data/docs/InlineResponse20020.md +11 -0
- data/docs/InlineResponse20021.md +11 -0
- data/docs/InlineResponse20022.md +10 -0
- data/docs/InlineResponse2005.md +2 -2
- data/docs/InlineResponse2006.md +2 -2
- data/docs/InlineResponse2007.md +2 -2
- data/docs/InlineResponse2008.md +2 -1
- data/docs/InlineResponse2009.md +2 -1
- data/docs/InvitationsResponse.md +1 -1
- data/docs/KvStoreApi.md +2 -2
- data/docs/KvStoreItemApi.md +2 -2
- data/docs/KvStoreResponseBodyEnable.md +12 -0
- data/docs/KvStoreResponseCustomer.md +10 -0
- data/docs/KvStoreResponseLinks.md +10 -0
- data/docs/KvStoreResponseLinksLinks.md +10 -0
- data/docs/KvStoreResponseProduct.md +10 -0
- data/docs/KvStoreResponseProductProduct.md +11 -0
- data/docs/LoggingAzureblobApi.md +4 -4
- data/docs/LoggingAzureblobResponse.md +1 -1
- data/docs/LoggingCloudfilesApi.md +4 -4
- data/docs/LoggingCloudfilesResponse.md +1 -1
- data/docs/LoggingDigitaloceanApi.md +4 -4
- data/docs/LoggingDigitaloceanResponse.md +1 -1
- data/docs/LoggingFtpApi.md +4 -4
- data/docs/LoggingFtpResponse.md +1 -1
- data/docs/LoggingGcsApi.md +4 -4
- data/docs/LoggingGcsResponse.md +1 -1
- data/docs/LoggingGenericCommon.md +1 -1
- data/docs/LoggingGenericCommonResponse.md +1 -1
- data/docs/LoggingGenericCommonResponseAllOf.md +1 -1
- data/docs/LoggingHttpsAdditional.md +1 -1
- data/docs/LoggingHttpsApi.md +4 -4
- data/docs/LoggingHttpsResponse.md +1 -1
- data/docs/LoggingOpenstackApi.md +4 -4
- data/docs/LoggingOpenstackResponse.md +1 -1
- data/docs/LoggingS3Api.md +4 -4
- data/docs/LoggingS3Response.md +1 -1
- data/docs/LoggingSftpApi.md +4 -4
- data/docs/LoggingSftpResponse.md +1 -1
- data/docs/LoggingSumologicAdditional.md +1 -1
- data/docs/LoggingSumologicApi.md +4 -4
- data/docs/LoggingSumologicResponse.md +1 -1
- data/docs/LoggingSyslogAdditional.md +1 -1
- data/docs/LoggingSyslogApi.md +4 -4
- data/docs/LoggingSyslogResponse.md +1 -1
- data/docs/MutualAuthenticationsResponse.md +1 -1
- data/docs/NgwafAgentKeysApi.md +55 -0
- data/docs/NgwafSimulateApi.md +61 -0
- data/docs/Notification.md +11 -0
- data/docs/NotificationConfig.md +10 -0
- data/docs/Page.md +17 -0
- data/docs/PageCreate.md +14 -0
- data/docs/PageUpdate.md +14 -0
- data/docs/Pagination.md +1 -1
- data/docs/PaginationMeta.md +4 -4
- data/docs/PaginationMeta1.md +13 -0
- data/docs/PathChange.md +15 -0
- data/docs/PathCreate.md +10 -0
- data/docs/PathResponse.md +14 -0
- data/docs/PathResponseAllOf.md +12 -0
- data/docs/PathUpdate.md +10 -0
- data/docs/PathWithRules.md +11 -0
- data/docs/PathsResponse.md +11 -0
- data/docs/Policy.md +17 -0
- data/docs/PolicyCreate.md +13 -0
- data/docs/PolicyUpdate.md +13 -0
- data/docs/Position.md +11 -0
- data/docs/ProductBotManagementApi.md +78 -0
- data/docs/ProductKvStoreApi.md +115 -0
- data/docs/RealtimeEntry.md +1 -1
- data/docs/RealtimeEntryAggregated.md +34 -3
- data/docs/RealtimeEntryDatacenter.md +345 -0
- data/docs/RealtimeMeasurements.md +34 -3
- data/docs/Report.md +15 -0
- data/docs/RequestBodyForCreate.md +1 -0
- data/docs/RequestBodyForUpdate.md +1 -0
- data/docs/Results.md +34 -3
- data/docs/RoutingConfig.md +11 -0
- data/docs/RoutingConfigCondition.md +13 -0
- data/docs/RoutingConfigResponse.md +16 -0
- data/docs/RoutingConfigResponseAllOf.md +14 -0
- data/docs/RoutingConfigState.md +9 -0
- data/docs/RoutingConfigVersionResponse.md +13 -0
- data/docs/RoutingConfigsResponse.md +11 -0
- data/docs/RuleChange.md +12 -0
- data/docs/RuleCreate.md +12 -0
- data/docs/RuleResponse.md +15 -0
- data/docs/RuleResponseAllOf.md +13 -0
- data/docs/RuleUpdate.md +12 -0
- data/docs/RulesResponse.md +11 -0
- data/docs/Script.md +20 -0
- data/docs/ScriptUpdate.md +12 -0
- data/docs/SecretStoreApi.md +2 -2
- data/docs/SecretStoreItemApi.md +2 -2
- data/docs/SecurityHeader.md +12 -0
- data/docs/ServiceAuthorizationsApi.md +2 -2
- data/docs/ServiceAuthorizationsResponse.md +1 -1
- data/docs/SuccessfulResponseAsObject.md +1 -0
- data/docs/SuccessfulResponseAsObjectAllOf.md +1 -0
- data/docs/TlsActivationsResponse.md +1 -1
- data/docs/TlsBulkCertificatesResponse.md +1 -1
- data/docs/TlsCertificatesResponse.md +1 -1
- data/docs/TlsConfigurationsResponse.md +1 -1
- data/docs/TlsDomainsResponse.md +1 -1
- data/docs/TlsPrivateKeysResponse.md +1 -1
- data/docs/TlsSubscriptionsResponse.md +1 -1
- data/docs/VersionsResponse.md +11 -0
- data/docs/WafSimulateRequest.md +11 -0
- data/docs/WafSimulateResponse.md +11 -0
- data/docs/WafSimulateSignal.md +16 -0
- data/docs/Website.md +14 -0
- data/docs/WebsiteCreate.md +10 -0
- data/docs/WebsiteUpdate.md +10 -0
- data/lib/fastly/api/backend_api.rb +16 -4
- data/lib/fastly/api/client_side_protection_api.rb +1465 -0
- data/lib/fastly/api/ddos_protection_api.rb +6 -6
- data/lib/fastly/api/dm_domains_api.rb +3 -3
- data/lib/fastly/api/dm_routing_configs_api.rb +1596 -0
- data/lib/fastly/api/domain_ownerships_api.rb +3 -3
- data/lib/fastly/api/domain_research_api.rb +3 -3
- data/lib/fastly/api/kv_store_api.rb +3 -3
- data/lib/fastly/api/kv_store_item_api.rb +3 -3
- data/lib/fastly/api/logging_azureblob_api.rb +6 -6
- data/lib/fastly/api/logging_cloudfiles_api.rb +6 -6
- data/lib/fastly/api/logging_digitalocean_api.rb +6 -6
- data/lib/fastly/api/logging_ftp_api.rb +6 -6
- data/lib/fastly/api/logging_gcs_api.rb +6 -6
- data/lib/fastly/api/logging_https_api.rb +4 -4
- data/lib/fastly/api/logging_openstack_api.rb +6 -6
- data/lib/fastly/api/logging_s3_api.rb +6 -6
- data/lib/fastly/api/logging_sftp_api.rb +6 -6
- data/lib/fastly/api/logging_sumologic_api.rb +4 -4
- data/lib/fastly/api/logging_syslog_api.rb +4 -4
- data/lib/fastly/api/ngwaf_agent_keys_api.rb +83 -0
- data/lib/fastly/api/ngwaf_simulate_api.rb +95 -0
- data/lib/fastly/api/product_bot_management_api.rb +133 -0
- data/lib/fastly/api/product_kv_store_api.rb +186 -0
- data/lib/fastly/api/secret_store_api.rb +3 -3
- data/lib/fastly/api/secret_store_item_api.rb +3 -3
- data/lib/fastly/api/service_authorizations_api.rb +3 -3
- data/lib/fastly/configuration.rb +294 -0
- data/lib/fastly/models/action.rb +237 -0
- data/lib/fastly/models/action_type.rb +34 -0
- data/lib/fastly/models/agent_key.rb +283 -0
- data/lib/fastly/models/agent_key_meta.rb +223 -0
- data/lib/fastly/models/backend.rb +24 -2
- data/lib/fastly/models/backend_response.rb +24 -2
- data/lib/fastly/models/bot_management_request_update_configuration.rb +256 -0
- data/lib/fastly/models/bot_management_response_configuration.rb +216 -0
- data/lib/fastly/models/bot_management_response_configuration_configuration.rb +217 -0
- data/lib/fastly/models/bot_management_response_configure.rb +253 -0
- data/lib/fastly/models/condition_operator.rb +37 -0
- data/lib/fastly/models/condition_type.rb +34 -0
- data/lib/fastly/models/directive.rb +229 -0
- data/lib/fastly/models/draft_diff.rb +244 -0
- data/lib/fastly/models/draft_update.rb +218 -0
- data/lib/fastly/models/events_response.rb +1 -1
- data/lib/fastly/models/header_event.rb +252 -0
- data/lib/fastly/models/initial_version.rb +242 -0
- data/lib/fastly/models/initial_version_path.rb +254 -0
- data/lib/fastly/models/inline_response20010.rb +2 -2
- data/lib/fastly/models/inline_response20011.rb +2 -2
- data/lib/fastly/models/inline_response20012.rb +1 -1
- data/lib/fastly/models/inline_response20013.rb +11 -1
- data/lib/fastly/models/inline_response20014.rb +15 -4
- data/lib/fastly/models/inline_response20015.rb +217 -0
- data/lib/fastly/models/inline_response20016.rb +218 -0
- data/lib/fastly/models/inline_response20017.rb +227 -0
- data/lib/fastly/models/inline_response20018.rb +227 -0
- data/lib/fastly/models/inline_response20019.rb +228 -0
- data/lib/fastly/models/inline_response20020.rb +227 -0
- data/lib/fastly/models/inline_response20021.rb +227 -0
- data/lib/fastly/models/inline_response20022.rb +218 -0
- data/lib/fastly/models/inline_response2005.rb +2 -2
- data/lib/fastly/models/inline_response2006.rb +2 -12
- data/lib/fastly/models/inline_response2007.rb +2 -4
- data/lib/fastly/models/inline_response2008.rb +18 -8
- data/lib/fastly/models/inline_response2009.rb +17 -8
- data/lib/fastly/models/invitations_response.rb +1 -1
- data/lib/fastly/models/kv_store_response_body_enable.rb +243 -0
- data/lib/fastly/models/kv_store_response_customer.rb +216 -0
- data/lib/fastly/models/kv_store_response_links.rb +216 -0
- data/lib/fastly/models/kv_store_response_links_links.rb +217 -0
- data/lib/fastly/models/kv_store_response_product.rb +216 -0
- data/lib/fastly/models/kv_store_response_product_product.rb +227 -0
- data/lib/fastly/models/logging_azureblob_response.rb +3 -3
- data/lib/fastly/models/logging_cloudfiles_response.rb +3 -3
- data/lib/fastly/models/logging_digitalocean_response.rb +3 -3
- data/lib/fastly/models/logging_ftp_response.rb +3 -3
- data/lib/fastly/models/logging_gcs_response.rb +3 -3
- data/lib/fastly/models/logging_generic_common.rb +3 -3
- data/lib/fastly/models/logging_generic_common_response.rb +3 -3
- data/lib/fastly/models/logging_generic_common_response_all_of.rb +3 -3
- data/lib/fastly/models/logging_https_additional.rb +1 -1
- data/lib/fastly/models/logging_https_response.rb +1 -1
- data/lib/fastly/models/logging_message_type.rb +1 -1
- data/lib/fastly/models/logging_openstack_response.rb +3 -3
- data/lib/fastly/models/logging_s3_response.rb +3 -3
- data/lib/fastly/models/logging_sftp_response.rb +3 -3
- data/lib/fastly/models/logging_sumologic_additional.rb +1 -1
- data/lib/fastly/models/logging_sumologic_response.rb +1 -1
- data/lib/fastly/models/logging_syslog_additional.rb +1 -1
- data/lib/fastly/models/logging_syslog_response.rb +1 -1
- data/lib/fastly/models/mutual_authentications_response.rb +1 -1
- data/lib/fastly/models/notification.rb +270 -0
- data/lib/fastly/models/notification_config.rb +218 -0
- data/lib/fastly/models/page.rb +289 -0
- data/lib/fastly/models/page_create.rb +266 -0
- data/lib/fastly/models/page_update.rb +256 -0
- data/lib/fastly/models/pagination.rb +1 -1
- data/lib/fastly/models/pagination_meta.rb +30 -55
- data/lib/fastly/models/pagination_meta1.rb +273 -0
- data/lib/fastly/models/path_change.rb +274 -0
- data/lib/fastly/models/path_create.rb +242 -0
- data/lib/fastly/models/path_response.rb +285 -0
- data/lib/fastly/models/path_response_all_of.rb +254 -0
- data/lib/fastly/models/path_update.rb +233 -0
- data/lib/fastly/models/path_with_rules.rb +228 -0
- data/lib/fastly/models/paths_response.rb +228 -0
- data/lib/fastly/models/policy.rb +315 -0
- data/lib/fastly/models/policy_create.rb +289 -0
- data/lib/fastly/models/policy_update.rb +279 -0
- data/lib/fastly/models/position.rb +228 -0
- data/lib/fastly/models/realtime_entry.rb +2 -5
- data/lib/fastly/models/realtime_entry_aggregated.rb +344 -34
- data/lib/fastly/models/realtime_entry_datacenter.rb +3577 -0
- data/lib/fastly/models/realtime_measurements.rb +344 -34
- data/lib/fastly/models/report.rb +261 -0
- data/lib/fastly/models/request_body_for_create.rb +12 -1
- data/lib/fastly/models/request_body_for_update.rb +12 -1
- data/lib/fastly/models/results.rb +341 -31
- data/lib/fastly/models/routing_config.rb +251 -0
- data/lib/fastly/models/routing_config_condition.rb +261 -0
- data/lib/fastly/models/routing_config_response.rb +305 -0
- data/lib/fastly/models/routing_config_response_all_of.rb +274 -0
- data/lib/fastly/models/routing_config_state.rb +36 -0
- data/lib/fastly/models/routing_config_version_response.rb +250 -0
- data/lib/fastly/models/routing_configs_response.rb +228 -0
- data/lib/fastly/models/rule_change.rb +236 -0
- data/lib/fastly/models/rule_create.rb +267 -0
- data/lib/fastly/models/rule_response.rb +279 -0
- data/lib/fastly/models/rule_response_all_of.rb +248 -0
- data/lib/fastly/models/rule_update.rb +252 -0
- data/lib/fastly/models/rules_response.rb +228 -0
- data/lib/fastly/models/script.rb +350 -0
- data/lib/fastly/models/script_update.rb +271 -0
- data/lib/fastly/models/security_header.rb +234 -0
- data/lib/fastly/models/service_authorizations_response.rb +1 -1
- data/lib/fastly/models/successful_response_as_object.rb +12 -1
- data/lib/fastly/models/successful_response_as_object_all_of.rb +12 -1
- data/lib/fastly/models/tls_activations_response.rb +1 -1
- data/lib/fastly/models/tls_bulk_certificates_response.rb +1 -1
- data/lib/fastly/models/tls_certificates_response.rb +1 -1
- data/lib/fastly/models/tls_configurations_response.rb +1 -1
- data/lib/fastly/models/tls_domains_response.rb +1 -1
- data/lib/fastly/models/tls_private_keys_response.rb +1 -1
- data/lib/fastly/models/tls_subscriptions_response.rb +1 -1
- data/lib/fastly/models/versions_response.rb +228 -0
- data/lib/fastly/models/waf_simulate_request.rb +233 -0
- data/lib/fastly/models/waf_simulate_response.rb +240 -0
- data/lib/fastly/models/waf_simulate_signal.rb +344 -0
- data/lib/fastly/models/website.rb +257 -0
- data/lib/fastly/models/website_create.rb +222 -0
- data/lib/fastly/models/website_update.rb +217 -0
- data/lib/fastly/version.rb +1 -1
- data/lib/fastly.rb +77 -0
- data/sig.json +1 -1
- metadata +156 -2
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Fastly API
|
|
3
|
+
|
|
4
|
+
#Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/)
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
Contact: oss@fastly.com
|
|
8
|
+
|
|
9
|
+
=end
|
|
10
|
+
|
|
11
|
+
require 'date'
|
|
12
|
+
require 'time'
|
|
13
|
+
|
|
14
|
+
module Fastly
|
|
15
|
+
# A signal detected during WAF simulation. The `type`, `detector`, `detector_scope`, and `redaction` fields are always present. The `location`, `name`, and `value` fields are present only when applicable to the signal category.
|
|
16
|
+
class WafSimulateSignal
|
|
17
|
+
# The type of signal detected (e.g., `SQLI`, `XSS`, `CMDEXE`, `TRAVERSAL`, `BACKDOOR`, `LOG4J-JNDI`, `BLOCKED`).
|
|
18
|
+
attr_accessor :type
|
|
19
|
+
|
|
20
|
+
# The detector engine that identified the signal (e.g., `SQLI`, `LIBINJECTIONV5`, `LIBINJECTIONJS`, or a rule ID).
|
|
21
|
+
attr_accessor :detector
|
|
22
|
+
|
|
23
|
+
# The scope of the detector that identified the signal. Derived from the signal type and detection type at simulation time. `system` — built-in WAF rule (e.g., `SQLI`, `XSS`). `workspace` — workspace-level custom rule or signal (e.g., `site.*` prefix). `account` — account-level custom signal (e.g., `corp.*` prefix). `unknown` — scope could not be determined (e.g., tags fetch failed or unrecognized type).
|
|
24
|
+
attr_accessor :detector_scope
|
|
25
|
+
|
|
26
|
+
# The redaction level applied to the detected value. Clients should handle unexpected string values gracefully, as new redaction types may be added.
|
|
27
|
+
attr_accessor :redaction
|
|
28
|
+
|
|
29
|
+
# Where in the request the signal was detected (e.g., `QUERYSTRING`, `POSTBODY`, `HEADER`, `HEADEROUT`, `POSTARG`). Present for detection signals; absent for custom and action signals.
|
|
30
|
+
attr_accessor :location
|
|
31
|
+
|
|
32
|
+
# The parameter or header name that triggered detection. Present when the WAF engine identifies a specific parameter or header.
|
|
33
|
+
attr_accessor :name
|
|
34
|
+
|
|
35
|
+
# The matched payload value that triggered signal detection. For detection signals, contains the matched content. For `BLOCKED` signals, carries the WAF response code as a string. Absent for custom signals.
|
|
36
|
+
attr_accessor :value
|
|
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
|
+
:'type' => :'type',
|
|
64
|
+
:'detector' => :'detector',
|
|
65
|
+
:'detector_scope' => :'detector_scope',
|
|
66
|
+
:'redaction' => :'redaction',
|
|
67
|
+
:'location' => :'location',
|
|
68
|
+
:'name' => :'name',
|
|
69
|
+
:'value' => :'value'
|
|
70
|
+
}
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Returns all the JSON keys this model knows about
|
|
74
|
+
def self.acceptable_attributes
|
|
75
|
+
attribute_map.values
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# Attribute type mapping.
|
|
79
|
+
def self.fastly_types
|
|
80
|
+
{
|
|
81
|
+
:'type' => :'String',
|
|
82
|
+
:'detector' => :'String',
|
|
83
|
+
:'detector_scope' => :'String',
|
|
84
|
+
:'redaction' => :'String',
|
|
85
|
+
:'location' => :'String',
|
|
86
|
+
:'name' => :'String',
|
|
87
|
+
:'value' => :'String'
|
|
88
|
+
}
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# List of attributes with nullable: true
|
|
92
|
+
def self.fastly_nullable
|
|
93
|
+
Set.new([
|
|
94
|
+
])
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# Initializes the object
|
|
98
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
99
|
+
def initialize(attributes = {})
|
|
100
|
+
if (!attributes.is_a?(Hash))
|
|
101
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::WafSimulateSignal` initialize method"
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
105
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
106
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
107
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::WafSimulateSignal`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
108
|
+
end
|
|
109
|
+
h[k.to_sym] = v
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if attributes.key?(:'type')
|
|
113
|
+
self.type = attributes[:'type']
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
if attributes.key?(:'detector')
|
|
117
|
+
self.detector = attributes[:'detector']
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
if attributes.key?(:'detector_scope')
|
|
121
|
+
self.detector_scope = attributes[:'detector_scope']
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
if attributes.key?(:'redaction')
|
|
125
|
+
self.redaction = attributes[:'redaction']
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
if attributes.key?(:'location')
|
|
129
|
+
self.location = attributes[:'location']
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
if attributes.key?(:'name')
|
|
133
|
+
self.name = attributes[:'name']
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
if attributes.key?(:'value')
|
|
137
|
+
self.value = attributes[:'value']
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
142
|
+
# @return Array for valid properties with the reasons
|
|
143
|
+
def list_invalid_properties
|
|
144
|
+
invalid_properties = Array.new
|
|
145
|
+
if @type.nil?
|
|
146
|
+
invalid_properties.push('invalid value for "type", type cannot be nil.')
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
if @detector.nil?
|
|
150
|
+
invalid_properties.push('invalid value for "detector", detector cannot be nil.')
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
if @detector_scope.nil?
|
|
154
|
+
invalid_properties.push('invalid value for "detector_scope", detector_scope cannot be nil.')
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
if @redaction.nil?
|
|
158
|
+
invalid_properties.push('invalid value for "redaction", redaction cannot be nil.')
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
invalid_properties
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
# Check to see if the all the properties in the model are valid
|
|
165
|
+
# @return true if the model is valid
|
|
166
|
+
def valid?
|
|
167
|
+
return false if @type.nil?
|
|
168
|
+
return false if @detector.nil?
|
|
169
|
+
return false if @detector_scope.nil?
|
|
170
|
+
detector_scope_validator = EnumAttributeValidator.new('String', ["system", "workspace", "account", "unknown"])
|
|
171
|
+
return false unless detector_scope_validator.valid?(@detector_scope)
|
|
172
|
+
return false if @redaction.nil?
|
|
173
|
+
redaction_validator = EnumAttributeValidator.new('String', ["none", "param", "credit_card", "ssn", "guid", "iban", "request_header", "response_header", "custom_param", "custom_request_header", "custom_response_header", "jsession_id", "unknown"])
|
|
174
|
+
return false unless redaction_validator.valid?(@redaction)
|
|
175
|
+
true
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
179
|
+
# @param [Object] detector_scope Object to be assigned
|
|
180
|
+
def detector_scope=(detector_scope)
|
|
181
|
+
validator = EnumAttributeValidator.new('String', ["system", "workspace", "account", "unknown"])
|
|
182
|
+
unless validator.valid?(detector_scope)
|
|
183
|
+
fail ArgumentError, "invalid value for \"detector_scope\", must be one of #{validator.allowable_values}."
|
|
184
|
+
end
|
|
185
|
+
@detector_scope = detector_scope
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
189
|
+
# @param [Object] redaction Object to be assigned
|
|
190
|
+
def redaction=(redaction)
|
|
191
|
+
validator = EnumAttributeValidator.new('String', ["none", "param", "credit_card", "ssn", "guid", "iban", "request_header", "response_header", "custom_param", "custom_request_header", "custom_response_header", "jsession_id", "unknown"])
|
|
192
|
+
unless validator.valid?(redaction)
|
|
193
|
+
fail ArgumentError, "invalid value for \"redaction\", must be one of #{validator.allowable_values}."
|
|
194
|
+
end
|
|
195
|
+
@redaction = redaction
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
# Checks equality by comparing each attribute.
|
|
199
|
+
# @param [Object] Object to be compared
|
|
200
|
+
def ==(o)
|
|
201
|
+
return true if self.equal?(o)
|
|
202
|
+
self.class == o.class &&
|
|
203
|
+
type == o.type &&
|
|
204
|
+
detector == o.detector &&
|
|
205
|
+
detector_scope == o.detector_scope &&
|
|
206
|
+
redaction == o.redaction &&
|
|
207
|
+
location == o.location &&
|
|
208
|
+
name == o.name &&
|
|
209
|
+
value == o.value
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
# @see the `==` method
|
|
213
|
+
# @param [Object] Object to be compared
|
|
214
|
+
def eql?(o)
|
|
215
|
+
self == o
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
# Calculates hash code according to all attributes.
|
|
219
|
+
# @return [Integer] Hash code
|
|
220
|
+
def hash
|
|
221
|
+
[type, detector, detector_scope, redaction, location, name, value].hash
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
# Builds the object from hash
|
|
225
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
226
|
+
# @return [Object] Returns the model itself
|
|
227
|
+
def self.build_from_hash(attributes)
|
|
228
|
+
new.build_from_hash(attributes)
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
# Builds the object from hash
|
|
232
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
233
|
+
# @return [Object] Returns the model itself
|
|
234
|
+
def build_from_hash(attributes)
|
|
235
|
+
return nil unless attributes.is_a?(Hash)
|
|
236
|
+
self.class.fastly_types.each_pair do |key, type|
|
|
237
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
|
|
238
|
+
self.send("#{key}=", nil)
|
|
239
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
240
|
+
# check to ensure the input is an array given that the attribute
|
|
241
|
+
# is documented as an array but the input is not
|
|
242
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
243
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
244
|
+
end
|
|
245
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
246
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
247
|
+
end
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
self
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
# Deserializes the data based on type
|
|
254
|
+
# @param string type Data type
|
|
255
|
+
# @param string value Value to be deserialized
|
|
256
|
+
# @return [Object] Deserialized data
|
|
257
|
+
def _deserialize(type, value)
|
|
258
|
+
case type.to_sym
|
|
259
|
+
when :Time
|
|
260
|
+
Time.parse(value)
|
|
261
|
+
when :Date
|
|
262
|
+
Date.parse(value)
|
|
263
|
+
when :String
|
|
264
|
+
value.to_s
|
|
265
|
+
when :Integer
|
|
266
|
+
value.to_i
|
|
267
|
+
when :Float
|
|
268
|
+
value.to_f
|
|
269
|
+
when :Boolean
|
|
270
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
271
|
+
true
|
|
272
|
+
else
|
|
273
|
+
false
|
|
274
|
+
end
|
|
275
|
+
when :Object
|
|
276
|
+
# generic object (usually a Hash), return directly
|
|
277
|
+
value
|
|
278
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
279
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
280
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
281
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
282
|
+
k_type = Regexp.last_match[:k_type]
|
|
283
|
+
v_type = Regexp.last_match[:v_type]
|
|
284
|
+
{}.tap do |hash|
|
|
285
|
+
value.each do |k, v|
|
|
286
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
287
|
+
end
|
|
288
|
+
end
|
|
289
|
+
else # model
|
|
290
|
+
# models (e.g. Pet) or oneOf
|
|
291
|
+
klass = Fastly.const_get(type)
|
|
292
|
+
klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
293
|
+
end
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
# Returns the string representation of the object
|
|
297
|
+
# @return [String] String presentation of the object
|
|
298
|
+
def to_s
|
|
299
|
+
to_hash.to_s
|
|
300
|
+
end
|
|
301
|
+
|
|
302
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
303
|
+
# @return [Hash] Returns the object in the form of hash
|
|
304
|
+
def to_body
|
|
305
|
+
to_hash
|
|
306
|
+
end
|
|
307
|
+
|
|
308
|
+
# Returns the object in the form of hash
|
|
309
|
+
# @return [Hash] Returns the object in the form of hash
|
|
310
|
+
def to_hash
|
|
311
|
+
hash = {}
|
|
312
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
313
|
+
value = self.send(attr)
|
|
314
|
+
if value.nil?
|
|
315
|
+
is_nullable = self.class.fastly_nullable.include?(attr)
|
|
316
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
317
|
+
end
|
|
318
|
+
|
|
319
|
+
hash[param] = _to_hash(value)
|
|
320
|
+
end
|
|
321
|
+
hash
|
|
322
|
+
end
|
|
323
|
+
|
|
324
|
+
# Outputs non-array value in the form of hash
|
|
325
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
326
|
+
# @param [Object] value Any valid value
|
|
327
|
+
# @return [Hash] Returns the value in the form of hash
|
|
328
|
+
def _to_hash(value)
|
|
329
|
+
if value.is_a?(Array)
|
|
330
|
+
value.compact.map { |v| _to_hash(v) }
|
|
331
|
+
elsif value.is_a?(Hash)
|
|
332
|
+
{}.tap do |hash|
|
|
333
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
334
|
+
end
|
|
335
|
+
elsif value.respond_to? :to_hash
|
|
336
|
+
value.to_hash
|
|
337
|
+
else
|
|
338
|
+
value
|
|
339
|
+
end
|
|
340
|
+
end
|
|
341
|
+
|
|
342
|
+
end
|
|
343
|
+
|
|
344
|
+
end
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Fastly API
|
|
3
|
+
|
|
4
|
+
#Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/)
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
Contact: oss@fastly.com
|
|
8
|
+
|
|
9
|
+
=end
|
|
10
|
+
|
|
11
|
+
require 'date'
|
|
12
|
+
require 'time'
|
|
13
|
+
|
|
14
|
+
module Fastly
|
|
15
|
+
class Website
|
|
16
|
+
# Unique website identifier
|
|
17
|
+
attr_accessor :id
|
|
18
|
+
|
|
19
|
+
# Website domain
|
|
20
|
+
attr_accessor :domain
|
|
21
|
+
|
|
22
|
+
# IDs of pages associated with this website
|
|
23
|
+
attr_accessor :page_ids
|
|
24
|
+
|
|
25
|
+
attr_accessor :created_at
|
|
26
|
+
|
|
27
|
+
attr_accessor :updated_at
|
|
28
|
+
|
|
29
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
30
|
+
def self.attribute_map
|
|
31
|
+
{
|
|
32
|
+
:'id' => :'id',
|
|
33
|
+
:'domain' => :'domain',
|
|
34
|
+
:'page_ids' => :'page_ids',
|
|
35
|
+
:'created_at' => :'created_at',
|
|
36
|
+
:'updated_at' => :'updated_at'
|
|
37
|
+
}
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Returns all the JSON keys this model knows about
|
|
41
|
+
def self.acceptable_attributes
|
|
42
|
+
attribute_map.values
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Attribute type mapping.
|
|
46
|
+
def self.fastly_types
|
|
47
|
+
{
|
|
48
|
+
:'id' => :'String',
|
|
49
|
+
:'domain' => :'String',
|
|
50
|
+
:'page_ids' => :'Array<String>',
|
|
51
|
+
:'created_at' => :'Time',
|
|
52
|
+
:'updated_at' => :'Time'
|
|
53
|
+
}
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# List of attributes with nullable: true
|
|
57
|
+
def self.fastly_nullable
|
|
58
|
+
Set.new([
|
|
59
|
+
])
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# Initializes the object
|
|
63
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
64
|
+
def initialize(attributes = {})
|
|
65
|
+
if (!attributes.is_a?(Hash))
|
|
66
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Fastly::Website` initialize method"
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
70
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
71
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
72
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::Website`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
73
|
+
end
|
|
74
|
+
h[k.to_sym] = v
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if attributes.key?(:'id')
|
|
78
|
+
self.id = attributes[:'id']
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
if attributes.key?(:'domain')
|
|
82
|
+
self.domain = attributes[:'domain']
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
if attributes.key?(:'page_ids')
|
|
86
|
+
if (value = attributes[:'page_ids']).is_a?(Array)
|
|
87
|
+
self.page_ids = value
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
if attributes.key?(:'created_at')
|
|
92
|
+
self.created_at = attributes[:'created_at']
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
if attributes.key?(:'updated_at')
|
|
96
|
+
self.updated_at = attributes[:'updated_at']
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
101
|
+
# @return Array for valid properties with the reasons
|
|
102
|
+
def list_invalid_properties
|
|
103
|
+
invalid_properties = Array.new
|
|
104
|
+
invalid_properties
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# Check to see if the all the properties in the model are valid
|
|
108
|
+
# @return true if the model is valid
|
|
109
|
+
def valid?
|
|
110
|
+
true
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
# Checks equality by comparing each attribute.
|
|
114
|
+
# @param [Object] Object to be compared
|
|
115
|
+
def ==(o)
|
|
116
|
+
return true if self.equal?(o)
|
|
117
|
+
self.class == o.class &&
|
|
118
|
+
id == o.id &&
|
|
119
|
+
domain == o.domain &&
|
|
120
|
+
page_ids == o.page_ids &&
|
|
121
|
+
created_at == o.created_at &&
|
|
122
|
+
updated_at == o.updated_at
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
# @see the `==` method
|
|
126
|
+
# @param [Object] Object to be compared
|
|
127
|
+
def eql?(o)
|
|
128
|
+
self == o
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# Calculates hash code according to all attributes.
|
|
132
|
+
# @return [Integer] Hash code
|
|
133
|
+
def hash
|
|
134
|
+
[id, domain, page_ids, created_at, updated_at].hash
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
# Builds the object from hash
|
|
138
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
139
|
+
# @return [Object] Returns the model itself
|
|
140
|
+
def self.build_from_hash(attributes)
|
|
141
|
+
new.build_from_hash(attributes)
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
# Builds the object from hash
|
|
145
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
146
|
+
# @return [Object] Returns the model itself
|
|
147
|
+
def build_from_hash(attributes)
|
|
148
|
+
return nil unless attributes.is_a?(Hash)
|
|
149
|
+
self.class.fastly_types.each_pair do |key, type|
|
|
150
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.fastly_nullable.include?(key)
|
|
151
|
+
self.send("#{key}=", nil)
|
|
152
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
153
|
+
# check to ensure the input is an array given that the attribute
|
|
154
|
+
# is documented as an array but the input is not
|
|
155
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
156
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
157
|
+
end
|
|
158
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
159
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
self
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
# Deserializes the data based on type
|
|
167
|
+
# @param string type Data type
|
|
168
|
+
# @param string value Value to be deserialized
|
|
169
|
+
# @return [Object] Deserialized data
|
|
170
|
+
def _deserialize(type, value)
|
|
171
|
+
case type.to_sym
|
|
172
|
+
when :Time
|
|
173
|
+
Time.parse(value)
|
|
174
|
+
when :Date
|
|
175
|
+
Date.parse(value)
|
|
176
|
+
when :String
|
|
177
|
+
value.to_s
|
|
178
|
+
when :Integer
|
|
179
|
+
value.to_i
|
|
180
|
+
when :Float
|
|
181
|
+
value.to_f
|
|
182
|
+
when :Boolean
|
|
183
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
184
|
+
true
|
|
185
|
+
else
|
|
186
|
+
false
|
|
187
|
+
end
|
|
188
|
+
when :Object
|
|
189
|
+
# generic object (usually a Hash), return directly
|
|
190
|
+
value
|
|
191
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
192
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
193
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
194
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
195
|
+
k_type = Regexp.last_match[:k_type]
|
|
196
|
+
v_type = Regexp.last_match[:v_type]
|
|
197
|
+
{}.tap do |hash|
|
|
198
|
+
value.each do |k, v|
|
|
199
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
200
|
+
end
|
|
201
|
+
end
|
|
202
|
+
else # model
|
|
203
|
+
# models (e.g. Pet) or oneOf
|
|
204
|
+
klass = Fastly.const_get(type)
|
|
205
|
+
klass.respond_to?(:fastly_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
206
|
+
end
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
# Returns the string representation of the object
|
|
210
|
+
# @return [String] String presentation of the object
|
|
211
|
+
def to_s
|
|
212
|
+
to_hash.to_s
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
216
|
+
# @return [Hash] Returns the object in the form of hash
|
|
217
|
+
def to_body
|
|
218
|
+
to_hash
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
# Returns the object in the form of hash
|
|
222
|
+
# @return [Hash] Returns the object in the form of hash
|
|
223
|
+
def to_hash
|
|
224
|
+
hash = {}
|
|
225
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
226
|
+
value = self.send(attr)
|
|
227
|
+
if value.nil?
|
|
228
|
+
is_nullable = self.class.fastly_nullable.include?(attr)
|
|
229
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
hash[param] = _to_hash(value)
|
|
233
|
+
end
|
|
234
|
+
hash
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
# Outputs non-array value in the form of hash
|
|
238
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
239
|
+
# @param [Object] value Any valid value
|
|
240
|
+
# @return [Hash] Returns the value in the form of hash
|
|
241
|
+
def _to_hash(value)
|
|
242
|
+
if value.is_a?(Array)
|
|
243
|
+
value.compact.map { |v| _to_hash(v) }
|
|
244
|
+
elsif value.is_a?(Hash)
|
|
245
|
+
{}.tap do |hash|
|
|
246
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
247
|
+
end
|
|
248
|
+
elsif value.respond_to? :to_hash
|
|
249
|
+
value.to_hash
|
|
250
|
+
else
|
|
251
|
+
value
|
|
252
|
+
end
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
end
|
|
256
|
+
|
|
257
|
+
end
|