zyphr 0.1.30 → 0.1.31

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.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -14
  3. data/docs/DomainsApi.md +2 -290
  4. data/lib/zyphr/api/domains_api.rb +2 -254
  5. data/lib/zyphr.rb +0 -8
  6. data/spec/api/domains_api_spec.rb +0 -48
  7. data/zyphr.gemspec +1 -1
  8. metadata +1 -33
  9. data/docs/DeleteDomainResponse.md +0 -20
  10. data/docs/DeleteDomainResponseData.md +0 -20
  11. data/docs/GetDomain200Response.md +0 -20
  12. data/docs/GetDomain200ResponseMeta.md +0 -18
  13. data/docs/VerificationStatusResponse.md +0 -20
  14. data/docs/VerificationStatusResponseData.md +0 -32
  15. data/docs/VerifyDomainResponse.md +0 -20
  16. data/docs/VerifyDomainResponseData.md +0 -24
  17. data/lib/zyphr/models/delete_domain_response.rb +0 -263
  18. data/lib/zyphr/models/delete_domain_response_data.rb +0 -263
  19. data/lib/zyphr/models/get_domain200_response.rb +0 -229
  20. data/lib/zyphr/models/get_domain200_response_meta.rb +0 -220
  21. data/lib/zyphr/models/verification_status_response.rb +0 -263
  22. data/lib/zyphr/models/verification_status_response_data.rb +0 -415
  23. data/lib/zyphr/models/verify_domain_response.rb +0 -263
  24. data/lib/zyphr/models/verify_domain_response_data.rb +0 -339
  25. data/spec/models/delete_domain_response_data_spec.rb +0 -42
  26. data/spec/models/delete_domain_response_spec.rb +0 -42
  27. data/spec/models/get_domain200_response_meta_spec.rb +0 -36
  28. data/spec/models/get_domain200_response_spec.rb +0 -42
  29. data/spec/models/verification_status_response_data_spec.rb +0 -82
  30. data/spec/models/verification_status_response_spec.rb +0 -42
  31. data/spec/models/verify_domain_response_data_spec.rb +0 -58
  32. data/spec/models/verify_domain_response_spec.rb +0 -42
@@ -44,42 +44,6 @@ describe 'DomainsApi' do
44
44
  end
45
45
  end
46
46
 
47
- # unit tests for delete_domain
48
- # Remove a sending domain
49
- # Remove a sending domain from the project. The domain is also detached from any SES identity that was provisioned for it. Returns 409 if the domain is still referenced by other resources (templates, scheduled sends, etc.) — those must be removed first.
50
- # @param id
51
- # @param [Hash] opts the optional parameters
52
- # @return [DeleteDomainResponse]
53
- describe 'delete_domain test' do
54
- it 'should work' do
55
- # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
56
- end
57
- end
58
-
59
- # unit tests for get_domain
60
- # Get a sending domain
61
- # Retrieve a single sending domain by ID, including DNS records and verification counters.
62
- # @param id
63
- # @param [Hash] opts the optional parameters
64
- # @return [GetDomain200Response]
65
- describe 'get_domain test' do
66
- it 'should work' do
67
- # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
68
- end
69
- end
70
-
71
- # unit tests for get_domain_verification_status
72
- # Get domain verification status
73
- # Returns the current verification status with per-record `verified` flags and aggregate counters. Useful when polling for terminal status from an AI agent (the recommended pattern is to subscribe to the `domain.verified` webhook event instead — see sc-5444).
74
- # @param id Domain ID
75
- # @param [Hash] opts the optional parameters
76
- # @return [VerificationStatusResponse]
77
- describe 'get_domain_verification_status test' do
78
- it 'should work' do
79
- # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
80
- end
81
- end
82
-
83
47
  # unit tests for list_domains
84
48
  # List sending domains
85
49
  # List sending domains on the current project, with verification status and DNS records.
@@ -91,16 +55,4 @@ describe 'DomainsApi' do
91
55
  end
92
56
  end
93
57
 
94
- # unit tests for verify_domain
95
- # Trigger domain verification
96
- # Queue an asynchronous DNS verification check. Returns immediately with a `job_id`. Poll `GET /v1/domains/{id}/verification-status` (or the higher-level `GET /v1/domains/{id}`) for the result, or subscribe to the `domain.verified` webhook event when sc-5444 ships. Returns 409 if a verification is already in progress for this domain (within the last 2 minutes).
97
- # @param id
98
- # @param [Hash] opts the optional parameters
99
- # @return [VerifyDomainResponse]
100
- describe 'verify_domain test' do
101
- it 'should work' do
102
- # assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
103
- end
104
- end
105
-
106
58
  end
data/zyphr.gemspec CHANGED
@@ -17,7 +17,7 @@ require "zyphr/version"
17
17
 
18
18
  Gem::Specification.new do |s|
19
19
  s.name = "zyphr"
20
- s.version = '0.1.30'
20
+ s.version = '0.1.31'
21
21
  s.platform = Gem::Platform::RUBY
22
22
  s.authors = ["Zyphr"]
23
23
  s.email = ["support@zyphr.dev"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zyphr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.30
4
+ version: 0.1.31
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zyphr
@@ -169,8 +169,6 @@ files:
169
169
  - docs/CreateWaaSEventType201Response.md
170
170
  - docs/CreateWaaSEventTypeRequest.md
171
171
  - docs/CreateWebhookRequest.md
172
- - docs/DeleteDomainResponse.md
173
- - docs/DeleteDomainResponseData.md
174
172
  - docs/DeleteResult.md
175
173
  - docs/DeleteResultData.md
176
174
  - docs/Device.md
@@ -213,8 +211,6 @@ files:
213
211
  - docs/GenerateSubscriberToken200ResponseData.md
214
212
  - docs/GenerateSubscriberTokenRequest.md
215
213
  - docs/GenerateWaaSPortalToken201Response.md
216
- - docs/GetDomain200Response.md
217
- - docs/GetDomain200ResponseMeta.md
218
214
  - docs/GetWaaSEndpoint200Response.md
219
215
  - docs/GetWaaSUsage200Response.md
220
216
  - docs/InAppNotification.md
@@ -435,10 +431,6 @@ files:
435
431
  - docs/ValidateResetTokenRequest.md
436
432
  - docs/ValidateResetTokenResponse.md
437
433
  - docs/ValidateResetTokenResponseData.md
438
- - docs/VerificationStatusResponse.md
439
- - docs/VerificationStatusResponseData.md
440
- - docs/VerifyDomainResponse.md
441
- - docs/VerifyDomainResponseData.md
442
434
  - docs/VerifySmsConfigData.md
443
435
  - docs/VerifySmsConfigResponse.md
444
436
  - docs/WaaSApplication.md
@@ -621,8 +613,6 @@ files:
621
613
  - lib/zyphr/models/create_waa_s_event_type201_response.rb
622
614
  - lib/zyphr/models/create_waa_s_event_type_request.rb
623
615
  - lib/zyphr/models/create_webhook_request.rb
624
- - lib/zyphr/models/delete_domain_response.rb
625
- - lib/zyphr/models/delete_domain_response_data.rb
626
616
  - lib/zyphr/models/delete_result.rb
627
617
  - lib/zyphr/models/delete_result_data.rb
628
618
  - lib/zyphr/models/device.rb
@@ -661,8 +651,6 @@ files:
661
651
  - lib/zyphr/models/generate_subscriber_token200_response_data.rb
662
652
  - lib/zyphr/models/generate_subscriber_token_request.rb
663
653
  - lib/zyphr/models/generate_waa_s_portal_token201_response.rb
664
- - lib/zyphr/models/get_domain200_response.rb
665
- - lib/zyphr/models/get_domain200_response_meta.rb
666
654
  - lib/zyphr/models/get_waa_s_endpoint200_response.rb
667
655
  - lib/zyphr/models/get_waa_s_usage200_response.rb
668
656
  - lib/zyphr/models/in_app_notification.rb
@@ -875,10 +863,6 @@ files:
875
863
  - lib/zyphr/models/validate_reset_token_request.rb
876
864
  - lib/zyphr/models/validate_reset_token_response.rb
877
865
  - lib/zyphr/models/validate_reset_token_response_data.rb
878
- - lib/zyphr/models/verification_status_response.rb
879
- - lib/zyphr/models/verification_status_response_data.rb
880
- - lib/zyphr/models/verify_domain_response.rb
881
- - lib/zyphr/models/verify_domain_response_data.rb
882
866
  - lib/zyphr/models/verify_sms_config_data.rb
883
867
  - lib/zyphr/models/verify_sms_config_response.rb
884
868
  - lib/zyphr/models/waa_s_application.rb
@@ -1050,8 +1034,6 @@ files:
1050
1034
  - spec/models/create_waa_s_event_type201_response_spec.rb
1051
1035
  - spec/models/create_waa_s_event_type_request_spec.rb
1052
1036
  - spec/models/create_webhook_request_spec.rb
1053
- - spec/models/delete_domain_response_data_spec.rb
1054
- - spec/models/delete_domain_response_spec.rb
1055
1037
  - spec/models/delete_result_data_spec.rb
1056
1038
  - spec/models/delete_result_spec.rb
1057
1039
  - spec/models/device_list_response_spec.rb
@@ -1090,8 +1072,6 @@ files:
1090
1072
  - spec/models/generate_subscriber_token200_response_spec.rb
1091
1073
  - spec/models/generate_subscriber_token_request_spec.rb
1092
1074
  - spec/models/generate_waa_s_portal_token201_response_spec.rb
1093
- - spec/models/get_domain200_response_meta_spec.rb
1094
- - spec/models/get_domain200_response_spec.rb
1095
1075
  - spec/models/get_waa_s_endpoint200_response_spec.rb
1096
1076
  - spec/models/get_waa_s_usage200_response_spec.rb
1097
1077
  - spec/models/in_app_notification_spec.rb
@@ -1304,10 +1284,6 @@ files:
1304
1284
  - spec/models/validate_reset_token_request_spec.rb
1305
1285
  - spec/models/validate_reset_token_response_data_spec.rb
1306
1286
  - spec/models/validate_reset_token_response_spec.rb
1307
- - spec/models/verification_status_response_data_spec.rb
1308
- - spec/models/verification_status_response_spec.rb
1309
- - spec/models/verify_domain_response_data_spec.rb
1310
- - spec/models/verify_domain_response_spec.rb
1311
1287
  - spec/models/verify_sms_config_data_spec.rb
1312
1288
  - spec/models/verify_sms_config_response_spec.rb
1313
1289
  - spec/models/waa_s_application_spec.rb
@@ -1459,7 +1435,6 @@ test_files:
1459
1435
  - spec/models/webhook_versions_response_data_spec.rb
1460
1436
  - spec/models/consent_history_entry_spec.rb
1461
1437
  - spec/models/send_push_request_spec.rb
1462
- - spec/models/delete_domain_response_data_spec.rb
1463
1438
  - spec/models/payload_too_large_error_error_details_spec.rb
1464
1439
  - spec/models/o_auth_connection_spec.rb
1465
1440
  - spec/models/auth_result_spec.rb
@@ -1609,9 +1584,7 @@ test_files:
1609
1584
  - spec/models/auth_email_type_spec.rb
1610
1585
  - spec/models/web_authn_verify_registration_response_data_spec.rb
1611
1586
  - spec/models/o_auth_callback_response_spec.rb
1612
- - spec/models/verification_status_response_spec.rb
1613
1587
  - spec/models/webhook_delivery_detail_spec.rb
1614
- - spec/models/verification_status_response_data_spec.rb
1615
1588
  - spec/models/category_list_response_spec.rb
1616
1589
  - spec/models/device_spec.rb
1617
1590
  - spec/models/webhook_versions_response_spec.rb
@@ -1681,7 +1654,6 @@ test_files:
1681
1654
  - spec/models/send_test_sms_response_spec.rb
1682
1655
  - spec/models/send_batch_in_app_meta_spec.rb
1683
1656
  - spec/models/web_authn_credential_list_response_data_spec.rb
1684
- - spec/models/verify_domain_response_data_spec.rb
1685
1657
  - spec/models/password_requirements_spec.rb
1686
1658
  - spec/models/verify_sms_config_response_spec.rb
1687
1659
  - spec/models/bulk_upsert_auth_email_templates_response_spec.rb
@@ -1724,7 +1696,6 @@ test_files:
1724
1696
  - spec/models/execution_retry_response_spec.rb
1725
1697
  - spec/models/resubscribe_request_spec.rb
1726
1698
  - spec/models/o_auth_tokens_response_data_spec.rb
1727
- - spec/models/delete_domain_response_spec.rb
1728
1699
  - spec/models/workflow_step_execution_spec.rb
1729
1700
  - spec/models/send_in_app_response_spec.rb
1730
1701
  - spec/models/topic_subscribers_add_result_spec.rb
@@ -1738,7 +1709,6 @@ test_files:
1738
1709
  - spec/models/update_end_user_request_spec.rb
1739
1710
  - spec/models/send_sms_response_spec.rb
1740
1711
  - spec/models/reset_password_response_spec.rb
1741
- - spec/models/get_domain200_response_meta_spec.rb
1742
1712
  - spec/models/auth_email_template_default_response_spec.rb
1743
1713
  - spec/models/convert_anonymous_user_request_one_of1_apple_user_spec.rb
1744
1714
  - spec/models/category_spec.rb
@@ -1818,14 +1788,12 @@ test_files:
1818
1788
  - spec/models/web_authn_verify_registration_request_spec.rb
1819
1789
  - spec/models/send_batch_in_app_request_spec.rb
1820
1790
  - spec/models/webhook_ips_response_spec.rb
1821
- - spec/models/verify_domain_response_spec.rb
1822
1791
  - spec/models/auth_session_spec.rb
1823
1792
  - spec/models/delete_result_data_spec.rb
1824
1793
  - spec/models/convert_anonymous_user_request_spec.rb
1825
1794
  - spec/models/waa_s_portal_token_request_theme_spec.rb
1826
1795
  - spec/models/send_push_to_topic_data_spec.rb
1827
1796
  - spec/models/revoke_all_sessions_response_spec.rb
1828
- - spec/models/get_domain200_response_spec.rb
1829
1797
  - spec/models/email_response_spec.rb
1830
1798
  - spec/models/o_auth_authorization_url_response_spec.rb
1831
1799
  - spec/models/send_sms_data_spec.rb
@@ -1,20 +0,0 @@
1
- # Zyphr::DeleteDomainResponse
2
-
3
- ## Properties
4
-
5
- | Name | Type | Description | Notes |
6
- | ---- | ---- | ----------- | ----- |
7
- | **data** | [**DeleteDomainResponseData**](DeleteDomainResponseData.md) | | |
8
- | **meta** | [**GetDomain200ResponseMeta**](GetDomain200ResponseMeta.md) | | |
9
-
10
- ## Example
11
-
12
- ```ruby
13
- require 'zyphr'
14
-
15
- instance = Zyphr::DeleteDomainResponse.new(
16
- data: null,
17
- meta: null
18
- )
19
- ```
20
-
@@ -1,20 +0,0 @@
1
- # Zyphr::DeleteDomainResponseData
2
-
3
- ## Properties
4
-
5
- | Name | Type | Description | Notes |
6
- | ---- | ---- | ----------- | ----- |
7
- | **id** | **String** | | |
8
- | **deleted** | **Boolean** | | |
9
-
10
- ## Example
11
-
12
- ```ruby
13
- require 'zyphr'
14
-
15
- instance = Zyphr::DeleteDomainResponseData.new(
16
- id: null,
17
- deleted: true
18
- )
19
- ```
20
-
@@ -1,20 +0,0 @@
1
- # Zyphr::GetDomain200Response
2
-
3
- ## Properties
4
-
5
- | Name | Type | Description | Notes |
6
- | ---- | ---- | ----------- | ----- |
7
- | **data** | [**DomainResponse**](DomainResponse.md) | | [optional] |
8
- | **meta** | [**GetDomain200ResponseMeta**](GetDomain200ResponseMeta.md) | | [optional] |
9
-
10
- ## Example
11
-
12
- ```ruby
13
- require 'zyphr'
14
-
15
- instance = Zyphr::GetDomain200Response.new(
16
- data: null,
17
- meta: null
18
- )
19
- ```
20
-
@@ -1,18 +0,0 @@
1
- # Zyphr::GetDomain200ResponseMeta
2
-
3
- ## Properties
4
-
5
- | Name | Type | Description | Notes |
6
- | ---- | ---- | ----------- | ----- |
7
- | **request_id** | **String** | | [optional] |
8
-
9
- ## Example
10
-
11
- ```ruby
12
- require 'zyphr'
13
-
14
- instance = Zyphr::GetDomain200ResponseMeta.new(
15
- request_id: null
16
- )
17
- ```
18
-
@@ -1,20 +0,0 @@
1
- # Zyphr::VerificationStatusResponse
2
-
3
- ## Properties
4
-
5
- | Name | Type | Description | Notes |
6
- | ---- | ---- | ----------- | ----- |
7
- | **data** | [**VerificationStatusResponseData**](VerificationStatusResponseData.md) | | |
8
- | **meta** | [**GetDomain200ResponseMeta**](GetDomain200ResponseMeta.md) | | |
9
-
10
- ## Example
11
-
12
- ```ruby
13
- require 'zyphr'
14
-
15
- instance = Zyphr::VerificationStatusResponse.new(
16
- data: null,
17
- meta: null
18
- )
19
- ```
20
-
@@ -1,32 +0,0 @@
1
- # Zyphr::VerificationStatusResponseData
2
-
3
- ## Properties
4
-
5
- | Name | Type | Description | Notes |
6
- | ---- | ---- | ----------- | ----- |
7
- | **domain_id** | **String** | | |
8
- | **domain** | **String** | | |
9
- | **status** | **String** | | |
10
- | **records_verified** | **Integer** | | |
11
- | **records_total** | **Integer** | | |
12
- | **progress** | **Hash<String, Object>** | Internal verification progress detail | [optional] |
13
- | **dns_records** | [**Array<DnsRecord>**](DnsRecord.md) | | |
14
- | **last_checked_at** | **Time** | | [optional] |
15
-
16
- ## Example
17
-
18
- ```ruby
19
- require 'zyphr'
20
-
21
- instance = Zyphr::VerificationStatusResponseData.new(
22
- domain_id: null,
23
- domain: null,
24
- status: null,
25
- records_verified: null,
26
- records_total: null,
27
- progress: null,
28
- dns_records: null,
29
- last_checked_at: null
30
- )
31
- ```
32
-
@@ -1,20 +0,0 @@
1
- # Zyphr::VerifyDomainResponse
2
-
3
- ## Properties
4
-
5
- | Name | Type | Description | Notes |
6
- | ---- | ---- | ----------- | ----- |
7
- | **data** | [**VerifyDomainResponseData**](VerifyDomainResponseData.md) | | |
8
- | **meta** | [**AddDomain200ResponseMeta**](AddDomain200ResponseMeta.md) | | |
9
-
10
- ## Example
11
-
12
- ```ruby
13
- require 'zyphr'
14
-
15
- instance = Zyphr::VerifyDomainResponse.new(
16
- data: null,
17
- meta: null
18
- )
19
- ```
20
-
@@ -1,24 +0,0 @@
1
- # Zyphr::VerifyDomainResponseData
2
-
3
- ## Properties
4
-
5
- | Name | Type | Description | Notes |
6
- | ---- | ---- | ----------- | ----- |
7
- | **job_id** | **String** | | |
8
- | **domain_id** | **String** | | |
9
- | **domain** | **String** | | |
10
- | **status** | **String** | | |
11
-
12
- ## Example
13
-
14
- ```ruby
15
- require 'zyphr'
16
-
17
- instance = Zyphr::VerifyDomainResponseData.new(
18
- job_id: null,
19
- domain_id: null,
20
- domain: null,
21
- status: null
22
- )
23
- ```
24
-
@@ -1,263 +0,0 @@
1
- =begin
2
- #Zyphr API
3
-
4
- #Zyphr is a multi-channel notification platform that enables developers to send emails, push notifications, SMS, and in-app messages through a unified API. ## Authentication All API requests require authentication using an API key. Include your API key in the `X-API-Key` header: ``` X-API-Key: zy_live_xxxxxxxxxxxx ``` API keys can be created in the Zyphr Dashboard. Use `zy_test_*` keys for testing and `zy_live_*` keys for production. ## Rate Limiting The API implements rate limiting to ensure fair usage. Rate limit information is included in response headers: - `X-RateLimit-Limit`: Maximum requests per window - `X-RateLimit-Remaining`: Remaining requests in current window - `X-RateLimit-Reset`: Unix timestamp when the window resets ## Errors All errors follow a consistent format: ```json { \"error\": { \"code\": \"error_code\", \"message\": \"Human readable message\", \"details\": {} }, \"meta\": { \"request_id\": \"req_xxxx\" } } ```
5
-
6
- The version of the OpenAPI document: 1.0.0
7
- Contact: support@zyphr.dev
8
- Generated by: https://openapi-generator.tech
9
- Generator version: 7.12.0
10
-
11
- =end
12
-
13
- require 'date'
14
- require 'time'
15
-
16
- module Zyphr
17
- class DeleteDomainResponse
18
- attr_accessor :data
19
-
20
- attr_accessor :meta
21
-
22
- # Attribute mapping from ruby-style variable name to JSON key.
23
- def self.attribute_map
24
- {
25
- :'data' => :'data',
26
- :'meta' => :'meta'
27
- }
28
- end
29
-
30
- # Returns attribute mapping this model knows about
31
- def self.acceptable_attribute_map
32
- attribute_map
33
- end
34
-
35
- # Returns all the JSON keys this model knows about
36
- def self.acceptable_attributes
37
- acceptable_attribute_map.values
38
- end
39
-
40
- # Attribute type mapping.
41
- def self.openapi_types
42
- {
43
- :'data' => :'DeleteDomainResponseData',
44
- :'meta' => :'GetDomain200ResponseMeta'
45
- }
46
- end
47
-
48
- # List of attributes with nullable: true
49
- def self.openapi_nullable
50
- Set.new([
51
- ])
52
- end
53
-
54
- # Initializes the object
55
- # @param [Hash] attributes Model attributes in the form of hash
56
- def initialize(attributes = {})
57
- if (!attributes.is_a?(Hash))
58
- fail ArgumentError, "The input argument (attributes) must be a hash in `Zyphr::DeleteDomainResponse` initialize method"
59
- end
60
-
61
- # check to see if the attribute exists and convert string to symbol for hash key
62
- acceptable_attribute_map = self.class.acceptable_attribute_map
63
- attributes = attributes.each_with_object({}) { |(k, v), h|
64
- if (!acceptable_attribute_map.key?(k.to_sym))
65
- fail ArgumentError, "`#{k}` is not a valid attribute in `Zyphr::DeleteDomainResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
66
- end
67
- h[k.to_sym] = v
68
- }
69
-
70
- if attributes.key?(:'data')
71
- self.data = attributes[:'data']
72
- else
73
- self.data = nil
74
- end
75
-
76
- if attributes.key?(:'meta')
77
- self.meta = attributes[:'meta']
78
- else
79
- self.meta = nil
80
- end
81
- end
82
-
83
- # Show invalid properties with the reasons. Usually used together with valid?
84
- # @return Array for valid properties with the reasons
85
- def list_invalid_properties
86
- warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
87
- invalid_properties = Array.new
88
- if @data.nil?
89
- invalid_properties.push('invalid value for "data", data cannot be nil.')
90
- end
91
-
92
- if @meta.nil?
93
- invalid_properties.push('invalid value for "meta", meta cannot be nil.')
94
- end
95
-
96
- invalid_properties
97
- end
98
-
99
- # Check to see if the all the properties in the model are valid
100
- # @return true if the model is valid
101
- def valid?
102
- warn '[DEPRECATED] the `valid?` method is obsolete'
103
- return false if @data.nil?
104
- return false if @meta.nil?
105
- true
106
- end
107
-
108
- # Custom attribute writer method with validation
109
- # @param [Object] data Value to be assigned
110
- def data=(data)
111
- if data.nil?
112
- fail ArgumentError, 'data cannot be nil'
113
- end
114
-
115
- @data = data
116
- end
117
-
118
- # Custom attribute writer method with validation
119
- # @param [Object] meta Value to be assigned
120
- def meta=(meta)
121
- if meta.nil?
122
- fail ArgumentError, 'meta cannot be nil'
123
- end
124
-
125
- @meta = meta
126
- end
127
-
128
- # Checks equality by comparing each attribute.
129
- # @param [Object] Object to be compared
130
- def ==(o)
131
- return true if self.equal?(o)
132
- self.class == o.class &&
133
- data == o.data &&
134
- meta == o.meta
135
- end
136
-
137
- # @see the `==` method
138
- # @param [Object] Object to be compared
139
- def eql?(o)
140
- self == o
141
- end
142
-
143
- # Calculates hash code according to all attributes.
144
- # @return [Integer] Hash code
145
- def hash
146
- [data, meta].hash
147
- end
148
-
149
- # Builds the object from hash
150
- # @param [Hash] attributes Model attributes in the form of hash
151
- # @return [Object] Returns the model itself
152
- def self.build_from_hash(attributes)
153
- return nil unless attributes.is_a?(Hash)
154
- attributes = attributes.transform_keys(&:to_sym)
155
- transformed_hash = {}
156
- openapi_types.each_pair do |key, type|
157
- if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
158
- transformed_hash["#{key}"] = nil
159
- elsif type =~ /\AArray<(.*)>/i
160
- # check to ensure the input is an array given that the attribute
161
- # is documented as an array but the input is not
162
- if attributes[attribute_map[key]].is_a?(Array)
163
- transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
164
- end
165
- elsif !attributes[attribute_map[key]].nil?
166
- transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
167
- end
168
- end
169
- new(transformed_hash)
170
- end
171
-
172
- # Deserializes the data based on type
173
- # @param string type Data type
174
- # @param string value Value to be deserialized
175
- # @return [Object] Deserialized data
176
- def self._deserialize(type, value)
177
- case type.to_sym
178
- when :Time
179
- Time.parse(value)
180
- when :Date
181
- Date.parse(value)
182
- when :String
183
- value.to_s
184
- when :Integer
185
- value.to_i
186
- when :Float
187
- value.to_f
188
- when :Boolean
189
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
190
- true
191
- else
192
- false
193
- end
194
- when :Object
195
- # generic object (usually a Hash), return directly
196
- value
197
- when /\AArray<(?<inner_type>.+)>\z/
198
- inner_type = Regexp.last_match[:inner_type]
199
- value.map { |v| _deserialize(inner_type, v) }
200
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
201
- k_type = Regexp.last_match[:k_type]
202
- v_type = Regexp.last_match[:v_type]
203
- {}.tap do |hash|
204
- value.each do |k, v|
205
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
206
- end
207
- end
208
- else # model
209
- # models (e.g. Pet) or oneOf
210
- klass = Zyphr.const_get(type)
211
- klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
212
- end
213
- end
214
-
215
- # Returns the string representation of the object
216
- # @return [String] String presentation of the object
217
- def to_s
218
- to_hash.to_s
219
- end
220
-
221
- # to_body is an alias to to_hash (backward compatibility)
222
- # @return [Hash] Returns the object in the form of hash
223
- def to_body
224
- to_hash
225
- end
226
-
227
- # Returns the object in the form of hash
228
- # @return [Hash] Returns the object in the form of hash
229
- def to_hash
230
- hash = {}
231
- self.class.attribute_map.each_pair do |attr, param|
232
- value = self.send(attr)
233
- if value.nil?
234
- is_nullable = self.class.openapi_nullable.include?(attr)
235
- next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
236
- end
237
-
238
- hash[param] = _to_hash(value)
239
- end
240
- hash
241
- end
242
-
243
- # Outputs non-array value in the form of hash
244
- # For object, use to_hash. Otherwise, just return the value
245
- # @param [Object] value Any valid value
246
- # @return [Hash] Returns the value in the form of hash
247
- def _to_hash(value)
248
- if value.is_a?(Array)
249
- value.compact.map { |v| _to_hash(v) }
250
- elsif value.is_a?(Hash)
251
- {}.tap do |hash|
252
- value.each { |k, v| hash[k] = _to_hash(v) }
253
- end
254
- elsif value.respond_to? :to_hash
255
- value.to_hash
256
- else
257
- value
258
- end
259
- end
260
-
261
- end
262
-
263
- end