ultracart_api 4.1.219 → 4.1.221
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +14 -3
- data/docs/SfvbApi.md +181 -9
- data/docs/SfvbApprovalParams.md +8 -2
- data/docs/SfvbCodeLibraryEmail.md +28 -0
- data/docs/SfvbCodeLibraryEmailsResponse.md +20 -0
- data/docs/SfvbPostcardProofRequest.md +34 -0
- data/docs/SfvbPostcardProofResponse.md +38 -0
- data/docs/SfvbSequenceStepCreateRequest.md +11 -3
- data/docs/SfvbSequenceStepCreateResponse.md +14 -0
- data/docs/SfvbSequenceStepMoveRequest.md +24 -0
- data/docs/SfvbSequenceStepMoveResponse.md +20 -0
- data/docs/StorefrontApi.md +2 -0
- data/lib/ultracart_api/api/sfvb_api.rb +262 -8
- data/lib/ultracart_api/api/storefront_api.rb +2 -0
- data/lib/ultracart_api/models/sfvb_approval_params.rb +33 -3
- data/lib/ultracart_api/models/sfvb_code_library_email.rb +270 -0
- data/lib/ultracart_api/models/sfvb_code_library_emails_response.rb +232 -0
- data/lib/ultracart_api/models/sfvb_postcard_proof_request.rb +302 -0
- data/lib/ultracart_api/models/sfvb_postcard_proof_response.rb +356 -0
- data/lib/ultracart_api/models/sfvb_sequence_step_create_request.rb +44 -4
- data/lib/ultracart_api/models/sfvb_sequence_step_create_response.rb +77 -1
- data/lib/ultracart_api/models/sfvb_sequence_step_move_request.rb +250 -0
- data/lib/ultracart_api/models/sfvb_sequence_step_move_response.rb +231 -0
- data/lib/ultracart_api/version.rb +1 -1
- data/lib/ultracart_api.rb +6 -0
- metadata +14 -2
|
@@ -15,29 +15,45 @@ require 'time'
|
|
|
15
15
|
|
|
16
16
|
module UltracartClient
|
|
17
17
|
class SfvbSequenceStepCreateRequest
|
|
18
|
+
# With library_item_oid, true once the caller has seen that the item carries executable content (script, html, embed, css or velocity elements) and still wants it. An item with any is refused without it.
|
|
19
|
+
attr_accessor :acknowledge_executable
|
|
20
|
+
|
|
18
21
|
# The step the new step follows, in the same list. Not an end, continue or merge step.
|
|
19
22
|
attr_accessor :after_step_uuid
|
|
20
23
|
|
|
21
24
|
# A condition, split or inboxgeek step. With side, the new step goes first on that side.
|
|
22
25
|
attr_accessor :branch_step_uuid
|
|
23
26
|
|
|
24
|
-
#
|
|
27
|
+
# A wait step's settings, as the admin saves them and set-config changes them, namely delay_duration and delay_duration_unit (minutes, hours, days, weeks or months), and optionally the delay_until_* options. Not for an email step.
|
|
28
|
+
attr_accessor :config_json
|
|
29
|
+
|
|
30
|
+
# An email item from the code library (#1589) to start the new email from, taking its body, with new element ids, and its subject and preview text unless subject or preview_text is given. The item must be this account's own, shared with it, or published, approved by UltraCart and free. Only for an email step. The items are listed by the code library email read.
|
|
31
|
+
attr_accessor :library_item_oid
|
|
32
|
+
|
|
33
|
+
# A post_card step's name, shown in the admin, 1 to 100 characters on one line. Postcard by default. Only for a post_card step.
|
|
34
|
+
attr_accessor :name
|
|
35
|
+
|
|
36
|
+
# The new email's preview text, 5 to 150 characters. Optional with library_item_oid, whose preview text is used when this is left out.
|
|
25
37
|
attr_accessor :preview_text
|
|
26
38
|
|
|
27
39
|
# With branch_step_uuid, the side's label from the sequence read. yes or no for a condition, left or right for a split or inboxgeek step.
|
|
28
40
|
attr_accessor :side
|
|
29
41
|
|
|
30
|
-
# The new email's subject line, 5 to 150 characters.
|
|
42
|
+
# The new email's subject line, 5 to 150 characters. Optional with library_item_oid, whose subject is used when this is left out.
|
|
31
43
|
attr_accessor :subject
|
|
32
44
|
|
|
33
|
-
# The kind of step
|
|
45
|
+
# The kind of step, one of email (the default), wait or post_card.
|
|
34
46
|
attr_accessor :type
|
|
35
47
|
|
|
36
48
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
37
49
|
def self.attribute_map
|
|
38
50
|
{
|
|
51
|
+
:'acknowledge_executable' => :'acknowledge_executable',
|
|
39
52
|
:'after_step_uuid' => :'after_step_uuid',
|
|
40
53
|
:'branch_step_uuid' => :'branch_step_uuid',
|
|
54
|
+
:'config_json' => :'config_json',
|
|
55
|
+
:'library_item_oid' => :'library_item_oid',
|
|
56
|
+
:'name' => :'name',
|
|
41
57
|
:'preview_text' => :'preview_text',
|
|
42
58
|
:'side' => :'side',
|
|
43
59
|
:'subject' => :'subject',
|
|
@@ -53,8 +69,12 @@ module UltracartClient
|
|
|
53
69
|
# Attribute type mapping.
|
|
54
70
|
def self.openapi_types
|
|
55
71
|
{
|
|
72
|
+
:'acknowledge_executable' => :'Boolean',
|
|
56
73
|
:'after_step_uuid' => :'String',
|
|
57
74
|
:'branch_step_uuid' => :'String',
|
|
75
|
+
:'config_json' => :'String',
|
|
76
|
+
:'library_item_oid' => :'Integer',
|
|
77
|
+
:'name' => :'String',
|
|
58
78
|
:'preview_text' => :'String',
|
|
59
79
|
:'side' => :'String',
|
|
60
80
|
:'subject' => :'String',
|
|
@@ -83,6 +103,10 @@ module UltracartClient
|
|
|
83
103
|
h[k.to_sym] = v
|
|
84
104
|
}
|
|
85
105
|
|
|
106
|
+
if attributes.key?(:'acknowledge_executable')
|
|
107
|
+
self.acknowledge_executable = attributes[:'acknowledge_executable']
|
|
108
|
+
end
|
|
109
|
+
|
|
86
110
|
if attributes.key?(:'after_step_uuid')
|
|
87
111
|
self.after_step_uuid = attributes[:'after_step_uuid']
|
|
88
112
|
end
|
|
@@ -91,6 +115,18 @@ module UltracartClient
|
|
|
91
115
|
self.branch_step_uuid = attributes[:'branch_step_uuid']
|
|
92
116
|
end
|
|
93
117
|
|
|
118
|
+
if attributes.key?(:'config_json')
|
|
119
|
+
self.config_json = attributes[:'config_json']
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
if attributes.key?(:'library_item_oid')
|
|
123
|
+
self.library_item_oid = attributes[:'library_item_oid']
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
if attributes.key?(:'name')
|
|
127
|
+
self.name = attributes[:'name']
|
|
128
|
+
end
|
|
129
|
+
|
|
94
130
|
if attributes.key?(:'preview_text')
|
|
95
131
|
self.preview_text = attributes[:'preview_text']
|
|
96
132
|
end
|
|
@@ -126,8 +162,12 @@ module UltracartClient
|
|
|
126
162
|
def ==(o)
|
|
127
163
|
return true if self.equal?(o)
|
|
128
164
|
self.class == o.class &&
|
|
165
|
+
acknowledge_executable == o.acknowledge_executable &&
|
|
129
166
|
after_step_uuid == o.after_step_uuid &&
|
|
130
167
|
branch_step_uuid == o.branch_step_uuid &&
|
|
168
|
+
config_json == o.config_json &&
|
|
169
|
+
library_item_oid == o.library_item_oid &&
|
|
170
|
+
name == o.name &&
|
|
131
171
|
preview_text == o.preview_text &&
|
|
132
172
|
side == o.side &&
|
|
133
173
|
subject == o.subject &&
|
|
@@ -143,7 +183,7 @@ module UltracartClient
|
|
|
143
183
|
# Calculates hash code according to all attributes.
|
|
144
184
|
# @return [Integer] Hash code
|
|
145
185
|
def hash
|
|
146
|
-
[after_step_uuid, branch_step_uuid, preview_text, side, subject, type].hash
|
|
186
|
+
[acknowledge_executable, after_step_uuid, branch_step_uuid, config_json, library_item_oid, name, preview_text, side, subject, type].hash
|
|
147
187
|
end
|
|
148
188
|
|
|
149
189
|
# Builds the object from hash
|
|
@@ -15,12 +15,33 @@ require 'time'
|
|
|
15
15
|
|
|
16
16
|
module UltracartClient
|
|
17
17
|
class SfvbSequenceStepCreateResponse
|
|
18
|
+
# A post_card step's back, the container with owner type postcardback and this owner id.
|
|
19
|
+
attr_accessor :back_container_uuid
|
|
20
|
+
|
|
18
21
|
# The new email's uuid. Its body is the email container with this owner id.
|
|
19
22
|
attr_accessor :email_uuid
|
|
20
23
|
|
|
24
|
+
# A post_card step's front, the container with owner type postcardfront and this owner id.
|
|
25
|
+
attr_accessor :front_container_uuid
|
|
26
|
+
|
|
27
|
+
# The library item's files whose path already held a file, which was kept, not replaced.
|
|
28
|
+
attr_accessor :library_files_kept
|
|
29
|
+
|
|
30
|
+
# The library item's files that weren't written because they aren't a PNG, JPEG or GIF image whose bytes match its name. Only those images are copied from a library item.
|
|
31
|
+
attr_accessor :library_files_skipped
|
|
32
|
+
|
|
33
|
+
# Storefront file paths the library item's files were written to. A file already at its path is kept as it is and listed in library_files_kept instead.
|
|
34
|
+
attr_accessor :library_files_written
|
|
35
|
+
|
|
36
|
+
# The code library email item the new email started from (#1589), when one was given.
|
|
37
|
+
attr_accessor :library_item_oid
|
|
38
|
+
|
|
21
39
|
# What to do next, such as writing the body, and customers already waiting on the step before it.
|
|
22
40
|
attr_accessor :notes
|
|
23
41
|
|
|
42
|
+
# A post_card step's new postcard (#1644).
|
|
43
|
+
attr_accessor :postcard_uuid
|
|
44
|
+
|
|
24
45
|
# True when the new email must pass content review before it sends.
|
|
25
46
|
attr_accessor :requires_review
|
|
26
47
|
|
|
@@ -29,8 +50,15 @@ module UltracartClient
|
|
|
29
50
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
30
51
|
def self.attribute_map
|
|
31
52
|
{
|
|
53
|
+
:'back_container_uuid' => :'back_container_uuid',
|
|
32
54
|
:'email_uuid' => :'email_uuid',
|
|
55
|
+
:'front_container_uuid' => :'front_container_uuid',
|
|
56
|
+
:'library_files_kept' => :'library_files_kept',
|
|
57
|
+
:'library_files_skipped' => :'library_files_skipped',
|
|
58
|
+
:'library_files_written' => :'library_files_written',
|
|
59
|
+
:'library_item_oid' => :'library_item_oid',
|
|
33
60
|
:'notes' => :'notes',
|
|
61
|
+
:'postcard_uuid' => :'postcard_uuid',
|
|
34
62
|
:'requires_review' => :'requires_review',
|
|
35
63
|
:'step' => :'step'
|
|
36
64
|
}
|
|
@@ -44,8 +72,15 @@ module UltracartClient
|
|
|
44
72
|
# Attribute type mapping.
|
|
45
73
|
def self.openapi_types
|
|
46
74
|
{
|
|
75
|
+
:'back_container_uuid' => :'String',
|
|
47
76
|
:'email_uuid' => :'String',
|
|
77
|
+
:'front_container_uuid' => :'String',
|
|
78
|
+
:'library_files_kept' => :'Array<String>',
|
|
79
|
+
:'library_files_skipped' => :'Array<String>',
|
|
80
|
+
:'library_files_written' => :'Array<String>',
|
|
81
|
+
:'library_item_oid' => :'Integer',
|
|
48
82
|
:'notes' => :'Array<String>',
|
|
83
|
+
:'postcard_uuid' => :'String',
|
|
49
84
|
:'requires_review' => :'Boolean',
|
|
50
85
|
:'step' => :'SfvbSequenceStep'
|
|
51
86
|
}
|
|
@@ -72,16 +107,50 @@ module UltracartClient
|
|
|
72
107
|
h[k.to_sym] = v
|
|
73
108
|
}
|
|
74
109
|
|
|
110
|
+
if attributes.key?(:'back_container_uuid')
|
|
111
|
+
self.back_container_uuid = attributes[:'back_container_uuid']
|
|
112
|
+
end
|
|
113
|
+
|
|
75
114
|
if attributes.key?(:'email_uuid')
|
|
76
115
|
self.email_uuid = attributes[:'email_uuid']
|
|
77
116
|
end
|
|
78
117
|
|
|
118
|
+
if attributes.key?(:'front_container_uuid')
|
|
119
|
+
self.front_container_uuid = attributes[:'front_container_uuid']
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
if attributes.key?(:'library_files_kept')
|
|
123
|
+
if (value = attributes[:'library_files_kept']).is_a?(Array)
|
|
124
|
+
self.library_files_kept = value
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
if attributes.key?(:'library_files_skipped')
|
|
129
|
+
if (value = attributes[:'library_files_skipped']).is_a?(Array)
|
|
130
|
+
self.library_files_skipped = value
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
if attributes.key?(:'library_files_written')
|
|
135
|
+
if (value = attributes[:'library_files_written']).is_a?(Array)
|
|
136
|
+
self.library_files_written = value
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
if attributes.key?(:'library_item_oid')
|
|
141
|
+
self.library_item_oid = attributes[:'library_item_oid']
|
|
142
|
+
end
|
|
143
|
+
|
|
79
144
|
if attributes.key?(:'notes')
|
|
80
145
|
if (value = attributes[:'notes']).is_a?(Array)
|
|
81
146
|
self.notes = value
|
|
82
147
|
end
|
|
83
148
|
end
|
|
84
149
|
|
|
150
|
+
if attributes.key?(:'postcard_uuid')
|
|
151
|
+
self.postcard_uuid = attributes[:'postcard_uuid']
|
|
152
|
+
end
|
|
153
|
+
|
|
85
154
|
if attributes.key?(:'requires_review')
|
|
86
155
|
self.requires_review = attributes[:'requires_review']
|
|
87
156
|
end
|
|
@@ -109,8 +178,15 @@ module UltracartClient
|
|
|
109
178
|
def ==(o)
|
|
110
179
|
return true if self.equal?(o)
|
|
111
180
|
self.class == o.class &&
|
|
181
|
+
back_container_uuid == o.back_container_uuid &&
|
|
112
182
|
email_uuid == o.email_uuid &&
|
|
183
|
+
front_container_uuid == o.front_container_uuid &&
|
|
184
|
+
library_files_kept == o.library_files_kept &&
|
|
185
|
+
library_files_skipped == o.library_files_skipped &&
|
|
186
|
+
library_files_written == o.library_files_written &&
|
|
187
|
+
library_item_oid == o.library_item_oid &&
|
|
113
188
|
notes == o.notes &&
|
|
189
|
+
postcard_uuid == o.postcard_uuid &&
|
|
114
190
|
requires_review == o.requires_review &&
|
|
115
191
|
step == o.step
|
|
116
192
|
end
|
|
@@ -124,7 +200,7 @@ module UltracartClient
|
|
|
124
200
|
# Calculates hash code according to all attributes.
|
|
125
201
|
# @return [Integer] Hash code
|
|
126
202
|
def hash
|
|
127
|
-
[email_uuid, notes, requires_review, step].hash
|
|
203
|
+
[back_container_uuid, email_uuid, front_container_uuid, library_files_kept, library_files_skipped, library_files_written, library_item_oid, notes, postcard_uuid, requires_review, step].hash
|
|
128
204
|
end
|
|
129
205
|
|
|
130
206
|
# Builds the object from hash
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#UltraCart Rest API V2
|
|
3
|
+
|
|
4
|
+
#UltraCart REST API Version 2
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 2.0.0
|
|
7
|
+
Contact: support@ultracart.com
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
OpenAPI Generator version: 6.0.1-SNAPSHOT
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module UltracartClient
|
|
17
|
+
class SfvbSequenceStepMoveRequest
|
|
18
|
+
# The step it moves after, in that step's list. The begin step puts it first in the sequence. Not an end, continue or merge step.
|
|
19
|
+
attr_accessor :after_step_uuid
|
|
20
|
+
|
|
21
|
+
# The hash_sha256 of after_step_uuid, or of branch_step_uuid, from the last read. Required; 412 when stale.
|
|
22
|
+
attr_accessor :anchor_hash_sha256
|
|
23
|
+
|
|
24
|
+
# A condition, split or inboxgeek step. With side, the step moves to the start of that side.
|
|
25
|
+
attr_accessor :branch_step_uuid
|
|
26
|
+
|
|
27
|
+
# With branch_step_uuid, the side's label from the sequence read. yes or no for a condition, left or right for a split or inboxgeek step.
|
|
28
|
+
attr_accessor :side
|
|
29
|
+
|
|
30
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
31
|
+
def self.attribute_map
|
|
32
|
+
{
|
|
33
|
+
:'after_step_uuid' => :'after_step_uuid',
|
|
34
|
+
:'anchor_hash_sha256' => :'anchor_hash_sha256',
|
|
35
|
+
:'branch_step_uuid' => :'branch_step_uuid',
|
|
36
|
+
:'side' => :'side'
|
|
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.openapi_types
|
|
47
|
+
{
|
|
48
|
+
:'after_step_uuid' => :'String',
|
|
49
|
+
:'anchor_hash_sha256' => :'String',
|
|
50
|
+
:'branch_step_uuid' => :'String',
|
|
51
|
+
:'side' => :'String'
|
|
52
|
+
}
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# List of attributes with nullable: true
|
|
56
|
+
def self.openapi_nullable
|
|
57
|
+
Set.new([
|
|
58
|
+
])
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# Initializes the object
|
|
62
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
63
|
+
def initialize(attributes = {})
|
|
64
|
+
if (!attributes.is_a?(Hash))
|
|
65
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::SfvbSequenceStepMoveRequest` initialize method"
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
69
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
70
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
71
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::SfvbSequenceStepMoveRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
72
|
+
end
|
|
73
|
+
h[k.to_sym] = v
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if attributes.key?(:'after_step_uuid')
|
|
77
|
+
self.after_step_uuid = attributes[:'after_step_uuid']
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
if attributes.key?(:'anchor_hash_sha256')
|
|
81
|
+
self.anchor_hash_sha256 = attributes[:'anchor_hash_sha256']
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
if attributes.key?(:'branch_step_uuid')
|
|
85
|
+
self.branch_step_uuid = attributes[:'branch_step_uuid']
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
if attributes.key?(:'side')
|
|
89
|
+
self.side = attributes[:'side']
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
94
|
+
# @return Array for valid properties with the reasons
|
|
95
|
+
def list_invalid_properties
|
|
96
|
+
invalid_properties = Array.new
|
|
97
|
+
invalid_properties
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
# Check to see if the all the properties in the model are valid
|
|
101
|
+
# @return true if the model is valid
|
|
102
|
+
def valid?
|
|
103
|
+
true
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
# Checks equality by comparing each attribute.
|
|
107
|
+
# @param [Object] Object to be compared
|
|
108
|
+
def ==(o)
|
|
109
|
+
return true if self.equal?(o)
|
|
110
|
+
self.class == o.class &&
|
|
111
|
+
after_step_uuid == o.after_step_uuid &&
|
|
112
|
+
anchor_hash_sha256 == o.anchor_hash_sha256 &&
|
|
113
|
+
branch_step_uuid == o.branch_step_uuid &&
|
|
114
|
+
side == o.side
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
# @see the `==` method
|
|
118
|
+
# @param [Object] Object to be compared
|
|
119
|
+
def eql?(o)
|
|
120
|
+
self == o
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
# Calculates hash code according to all attributes.
|
|
124
|
+
# @return [Integer] Hash code
|
|
125
|
+
def hash
|
|
126
|
+
[after_step_uuid, anchor_hash_sha256, branch_step_uuid, side].hash
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
# Builds the object from hash
|
|
130
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
131
|
+
# @return [Object] Returns the model itself
|
|
132
|
+
def self.build_from_hash(attributes)
|
|
133
|
+
new.build_from_hash(attributes)
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
# Builds the object from hash
|
|
137
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
138
|
+
# @return [Object] Returns the model itself
|
|
139
|
+
def build_from_hash(attributes)
|
|
140
|
+
return nil unless attributes.is_a?(Hash)
|
|
141
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
142
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
143
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
144
|
+
self.send("#{key}=", nil)
|
|
145
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
146
|
+
# check to ensure the input is an array given that the attribute
|
|
147
|
+
# is documented as an array but the input is not
|
|
148
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
149
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
150
|
+
end
|
|
151
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
152
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
153
|
+
end
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
self
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
# Deserializes the data based on type
|
|
160
|
+
# @param string type Data type
|
|
161
|
+
# @param string value Value to be deserialized
|
|
162
|
+
# @return [Object] Deserialized data
|
|
163
|
+
def _deserialize(type, value)
|
|
164
|
+
case type.to_sym
|
|
165
|
+
when :Time
|
|
166
|
+
Time.parse(value)
|
|
167
|
+
when :Date
|
|
168
|
+
Date.parse(value)
|
|
169
|
+
when :String
|
|
170
|
+
value.to_s
|
|
171
|
+
when :Integer
|
|
172
|
+
value.to_i
|
|
173
|
+
when :Float
|
|
174
|
+
value.to_f
|
|
175
|
+
when :Boolean
|
|
176
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
177
|
+
true
|
|
178
|
+
else
|
|
179
|
+
false
|
|
180
|
+
end
|
|
181
|
+
when :Object
|
|
182
|
+
# generic object (usually a Hash), return directly
|
|
183
|
+
value
|
|
184
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
185
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
186
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
187
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
188
|
+
k_type = Regexp.last_match[:k_type]
|
|
189
|
+
v_type = Regexp.last_match[:v_type]
|
|
190
|
+
{}.tap do |hash|
|
|
191
|
+
value.each do |k, v|
|
|
192
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
193
|
+
end
|
|
194
|
+
end
|
|
195
|
+
else # model
|
|
196
|
+
# models (e.g. Pet) or oneOf
|
|
197
|
+
klass = UltracartClient.const_get(type)
|
|
198
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
199
|
+
end
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
# Returns the string representation of the object
|
|
203
|
+
# @return [String] String presentation of the object
|
|
204
|
+
def to_s
|
|
205
|
+
to_hash.to_s
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
209
|
+
# @return [Hash] Returns the object in the form of hash
|
|
210
|
+
def to_body
|
|
211
|
+
to_hash
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
# Returns the object in the form of hash
|
|
215
|
+
# @return [Hash] Returns the object in the form of hash
|
|
216
|
+
def to_hash
|
|
217
|
+
hash = {}
|
|
218
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
219
|
+
value = self.send(attr)
|
|
220
|
+
if value.nil?
|
|
221
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
222
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
hash[param] = _to_hash(value)
|
|
226
|
+
end
|
|
227
|
+
hash
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
# Outputs non-array value in the form of hash
|
|
231
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
232
|
+
# @param [Object] value Any valid value
|
|
233
|
+
# @return [Hash] Returns the value in the form of hash
|
|
234
|
+
def _to_hash(value)
|
|
235
|
+
if value.is_a?(Array)
|
|
236
|
+
value.compact.map { |v| _to_hash(v) }
|
|
237
|
+
elsif value.is_a?(Hash)
|
|
238
|
+
{}.tap do |hash|
|
|
239
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
240
|
+
end
|
|
241
|
+
elsif value.respond_to? :to_hash
|
|
242
|
+
value.to_hash
|
|
243
|
+
else
|
|
244
|
+
value
|
|
245
|
+
end
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
end
|