korona-entry-client 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +9 -0
- data/README.md +128 -0
- data/Rakefile +10 -0
- data/docs/BadRequestError.md +19 -0
- data/docs/EntryResponse.md +21 -0
- data/docs/ExternalTicketConfiguration.md +29 -0
- data/docs/ExternalTicketConfigurationList.md +17 -0
- data/docs/ExternalTicketConfigurationsApi.md +247 -0
- data/docs/ModelReference.md +23 -0
- data/docs/NotAcceptableError.md +19 -0
- data/docs/OrganizationalUnit.md +27 -0
- data/docs/OrganizationalUnitList.md +17 -0
- data/docs/OrganizationalUnitsApi.md +247 -0
- data/docs/Ticket.md +35 -0
- data/docs/TicketEntry.md +49 -0
- data/docs/TicketEntryLog.md +39 -0
- data/docs/TicketEntryLogList.md +17 -0
- data/docs/TicketImage.md +17 -0
- data/docs/TicketInformation.md +27 -0
- data/docs/TicketList.md +17 -0
- data/docs/TicketPersonalization.md +21 -0
- data/docs/TicketsApi.md +654 -0
- data/git_push.sh +58 -0
- data/korona-entry-client.gemspec +39 -0
- data/lib/korona-entry-client.rb +58 -0
- data/lib/korona-entry-client/api/external_ticket_configurations_api.rb +356 -0
- data/lib/korona-entry-client/api/organizational_units_api.rb +356 -0
- data/lib/korona-entry-client/api/tickets_api.rb +854 -0
- data/lib/korona-entry-client/api_client.rb +386 -0
- data/lib/korona-entry-client/api_error.rb +57 -0
- data/lib/korona-entry-client/configuration.rb +248 -0
- data/lib/korona-entry-client/models/bad_request_error.rb +217 -0
- data/lib/korona-entry-client/models/entry_response.rb +226 -0
- data/lib/korona-entry-client/models/external_ticket_configuration.rb +304 -0
- data/lib/korona-entry-client/models/external_ticket_configuration_list.rb +214 -0
- data/lib/korona-entry-client/models/model_reference.rb +238 -0
- data/lib/korona-entry-client/models/not_acceptable_error.rb +250 -0
- data/lib/korona-entry-client/models/organizational_unit.rb +257 -0
- data/lib/korona-entry-client/models/organizational_unit_list.rb +214 -0
- data/lib/korona-entry-client/models/ticket.rb +299 -0
- data/lib/korona-entry-client/models/ticket_entry.rb +403 -0
- data/lib/korona-entry-client/models/ticket_entry_log.rb +374 -0
- data/lib/korona-entry-client/models/ticket_entry_log_list.rb +214 -0
- data/lib/korona-entry-client/models/ticket_image.rb +215 -0
- data/lib/korona-entry-client/models/ticket_information.rb +258 -0
- data/lib/korona-entry-client/models/ticket_list.rb +214 -0
- data/lib/korona-entry-client/models/ticket_personalization.rb +228 -0
- data/lib/korona-entry-client/version.rb +15 -0
- data/spec/api/external_ticket_configurations_api_spec.rb +95 -0
- data/spec/api/organizational_units_api_spec.rb +95 -0
- data/spec/api/tickets_api_spec.rb +191 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/bad_request_error_spec.rb +47 -0
- data/spec/models/entry_response_spec.rb +53 -0
- data/spec/models/external_ticket_configuration_list_spec.rb +41 -0
- data/spec/models/external_ticket_configuration_spec.rb +77 -0
- data/spec/models/model_reference_spec.rb +59 -0
- data/spec/models/not_acceptable_error_spec.rb +51 -0
- data/spec/models/organizational_unit_list_spec.rb +41 -0
- data/spec/models/organizational_unit_spec.rb +71 -0
- data/spec/models/ticket_entry_log_list_spec.rb +41 -0
- data/spec/models/ticket_entry_log_spec.rb +119 -0
- data/spec/models/ticket_entry_spec.rb +137 -0
- data/spec/models/ticket_image_spec.rb +41 -0
- data/spec/models/ticket_information_spec.rb +71 -0
- data/spec/models/ticket_list_spec.rb +41 -0
- data/spec/models/ticket_personalization_spec.rb +53 -0
- data/spec/models/ticket_spec.rb +95 -0
- data/spec/spec_helper.rb +111 -0
- metadata +196 -0
@@ -0,0 +1,217 @@
|
|
1
|
+
=begin
|
2
|
+
#KORONA.entry API v1
|
3
|
+
|
4
|
+
#Our api provides access to our entry services
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.3.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module KoronaEntryClient
|
16
|
+
class BadRequestError
|
17
|
+
# A short description of the error in english.
|
18
|
+
attr_accessor :message
|
19
|
+
|
20
|
+
# The code for client-side evaluation of the error.
|
21
|
+
attr_accessor :code
|
22
|
+
|
23
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
24
|
+
def self.attribute_map
|
25
|
+
{
|
26
|
+
:'message' => :'message',
|
27
|
+
:'code' => :'code'
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
# Attribute type mapping.
|
32
|
+
def self.openapi_types
|
33
|
+
{
|
34
|
+
:'message' => :'String',
|
35
|
+
:'code' => :'String'
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
# List of attributes with nullable: true
|
40
|
+
def self.openapi_nullable
|
41
|
+
Set.new([
|
42
|
+
])
|
43
|
+
end
|
44
|
+
|
45
|
+
# Initializes the object
|
46
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
47
|
+
def initialize(attributes = {})
|
48
|
+
if (!attributes.is_a?(Hash))
|
49
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `KoronaEntryClient::BadRequestError` initialize method"
|
50
|
+
end
|
51
|
+
|
52
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
53
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
54
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
55
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `KoronaEntryClient::BadRequestError`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
56
|
+
end
|
57
|
+
h[k.to_sym] = v
|
58
|
+
}
|
59
|
+
|
60
|
+
if attributes.key?(:'message')
|
61
|
+
self.message = attributes[:'message']
|
62
|
+
end
|
63
|
+
|
64
|
+
if attributes.key?(:'code')
|
65
|
+
self.code = attributes[:'code']
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
70
|
+
# @return Array for valid properties with the reasons
|
71
|
+
def list_invalid_properties
|
72
|
+
invalid_properties = Array.new
|
73
|
+
invalid_properties
|
74
|
+
end
|
75
|
+
|
76
|
+
# Check to see if the all the properties in the model are valid
|
77
|
+
# @return true if the model is valid
|
78
|
+
def valid?
|
79
|
+
true
|
80
|
+
end
|
81
|
+
|
82
|
+
# Checks equality by comparing each attribute.
|
83
|
+
# @param [Object] Object to be compared
|
84
|
+
def ==(o)
|
85
|
+
return true if self.equal?(o)
|
86
|
+
self.class == o.class &&
|
87
|
+
message == o.message &&
|
88
|
+
code == o.code
|
89
|
+
end
|
90
|
+
|
91
|
+
# @see the `==` method
|
92
|
+
# @param [Object] Object to be compared
|
93
|
+
def eql?(o)
|
94
|
+
self == o
|
95
|
+
end
|
96
|
+
|
97
|
+
# Calculates hash code according to all attributes.
|
98
|
+
# @return [Integer] Hash code
|
99
|
+
def hash
|
100
|
+
[message, code].hash
|
101
|
+
end
|
102
|
+
|
103
|
+
# Builds the object from hash
|
104
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
105
|
+
# @return [Object] Returns the model itself
|
106
|
+
def self.build_from_hash(attributes)
|
107
|
+
new.build_from_hash(attributes)
|
108
|
+
end
|
109
|
+
|
110
|
+
# Builds the object from hash
|
111
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
112
|
+
# @return [Object] Returns the model itself
|
113
|
+
def build_from_hash(attributes)
|
114
|
+
return nil unless attributes.is_a?(Hash)
|
115
|
+
self.class.openapi_types.each_pair do |key, type|
|
116
|
+
if type =~ /\AArray<(.*)>/i
|
117
|
+
# check to ensure the input is an array given that the attribute
|
118
|
+
# is documented as an array but the input is not
|
119
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
120
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
121
|
+
end
|
122
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
123
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
124
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
125
|
+
end
|
126
|
+
|
127
|
+
self
|
128
|
+
end
|
129
|
+
|
130
|
+
# Deserializes the data based on type
|
131
|
+
# @param string type Data type
|
132
|
+
# @param string value Value to be deserialized
|
133
|
+
# @return [Object] Deserialized data
|
134
|
+
def _deserialize(type, value)
|
135
|
+
case type.to_sym
|
136
|
+
when :DateTime
|
137
|
+
DateTime.parse(value)
|
138
|
+
when :Date
|
139
|
+
Date.parse(value)
|
140
|
+
when :String
|
141
|
+
value.to_s
|
142
|
+
when :Integer
|
143
|
+
value.to_i
|
144
|
+
when :Float
|
145
|
+
value.to_f
|
146
|
+
when :Boolean
|
147
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
148
|
+
true
|
149
|
+
else
|
150
|
+
false
|
151
|
+
end
|
152
|
+
when :Object
|
153
|
+
# generic object (usually a Hash), return directly
|
154
|
+
value
|
155
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
156
|
+
inner_type = Regexp.last_match[:inner_type]
|
157
|
+
value.map { |v| _deserialize(inner_type, v) }
|
158
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
159
|
+
k_type = Regexp.last_match[:k_type]
|
160
|
+
v_type = Regexp.last_match[:v_type]
|
161
|
+
{}.tap do |hash|
|
162
|
+
value.each do |k, v|
|
163
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
164
|
+
end
|
165
|
+
end
|
166
|
+
else # model
|
167
|
+
KoronaEntryClient.const_get(type).build_from_hash(value)
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
# Returns the string representation of the object
|
172
|
+
# @return [String] String presentation of the object
|
173
|
+
def to_s
|
174
|
+
to_hash.to_s
|
175
|
+
end
|
176
|
+
|
177
|
+
# to_body is an alias to to_hash (backward compatibility)
|
178
|
+
# @return [Hash] Returns the object in the form of hash
|
179
|
+
def to_body
|
180
|
+
to_hash
|
181
|
+
end
|
182
|
+
|
183
|
+
# Returns the object in the form of hash
|
184
|
+
# @return [Hash] Returns the object in the form of hash
|
185
|
+
def to_hash
|
186
|
+
hash = {}
|
187
|
+
self.class.attribute_map.each_pair do |attr, param|
|
188
|
+
value = self.send(attr)
|
189
|
+
if value.nil?
|
190
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
191
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
192
|
+
end
|
193
|
+
|
194
|
+
hash[param] = _to_hash(value)
|
195
|
+
end
|
196
|
+
hash
|
197
|
+
end
|
198
|
+
|
199
|
+
# Outputs non-array value in the form of hash
|
200
|
+
# For object, use to_hash. Otherwise, just return the value
|
201
|
+
# @param [Object] value Any valid value
|
202
|
+
# @return [Hash] Returns the value in the form of hash
|
203
|
+
def _to_hash(value)
|
204
|
+
if value.is_a?(Array)
|
205
|
+
value.compact.map { |v| _to_hash(v) }
|
206
|
+
elsif value.is_a?(Hash)
|
207
|
+
{}.tap do |hash|
|
208
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
209
|
+
end
|
210
|
+
elsif value.respond_to? :to_hash
|
211
|
+
value.to_hash
|
212
|
+
else
|
213
|
+
value
|
214
|
+
end
|
215
|
+
end
|
216
|
+
end
|
217
|
+
end
|
@@ -0,0 +1,226 @@
|
|
1
|
+
=begin
|
2
|
+
#KORONA.entry API v1
|
3
|
+
|
4
|
+
#Our api provides access to our entry services
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.3.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module KoronaEntryClient
|
16
|
+
# Defines a successful response object. Contains the ticket, the used validity (ticketEntry) and the calculated maximum validity end date.
|
17
|
+
class EntryResponse
|
18
|
+
attr_accessor :ticket
|
19
|
+
|
20
|
+
attr_accessor :ticket_entry
|
21
|
+
|
22
|
+
# maximum validity end date calculated.
|
23
|
+
attr_accessor :valid_to_max
|
24
|
+
|
25
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
26
|
+
def self.attribute_map
|
27
|
+
{
|
28
|
+
:'ticket' => :'ticket',
|
29
|
+
:'ticket_entry' => :'ticketEntry',
|
30
|
+
:'valid_to_max' => :'validToMax'
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
# Attribute type mapping.
|
35
|
+
def self.openapi_types
|
36
|
+
{
|
37
|
+
:'ticket' => :'ModelReference',
|
38
|
+
:'ticket_entry' => :'ModelReference',
|
39
|
+
:'valid_to_max' => :'DateTime'
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
# List of attributes with nullable: true
|
44
|
+
def self.openapi_nullable
|
45
|
+
Set.new([
|
46
|
+
])
|
47
|
+
end
|
48
|
+
|
49
|
+
# Initializes the object
|
50
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
51
|
+
def initialize(attributes = {})
|
52
|
+
if (!attributes.is_a?(Hash))
|
53
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `KoronaEntryClient::EntryResponse` initialize method"
|
54
|
+
end
|
55
|
+
|
56
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
57
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
58
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
59
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `KoronaEntryClient::EntryResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
60
|
+
end
|
61
|
+
h[k.to_sym] = v
|
62
|
+
}
|
63
|
+
|
64
|
+
if attributes.key?(:'ticket')
|
65
|
+
self.ticket = attributes[:'ticket']
|
66
|
+
end
|
67
|
+
|
68
|
+
if attributes.key?(:'ticket_entry')
|
69
|
+
self.ticket_entry = attributes[:'ticket_entry']
|
70
|
+
end
|
71
|
+
|
72
|
+
if attributes.key?(:'valid_to_max')
|
73
|
+
self.valid_to_max = attributes[:'valid_to_max']
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
78
|
+
# @return Array for valid properties with the reasons
|
79
|
+
def list_invalid_properties
|
80
|
+
invalid_properties = Array.new
|
81
|
+
invalid_properties
|
82
|
+
end
|
83
|
+
|
84
|
+
# Check to see if the all the properties in the model are valid
|
85
|
+
# @return true if the model is valid
|
86
|
+
def valid?
|
87
|
+
true
|
88
|
+
end
|
89
|
+
|
90
|
+
# Checks equality by comparing each attribute.
|
91
|
+
# @param [Object] Object to be compared
|
92
|
+
def ==(o)
|
93
|
+
return true if self.equal?(o)
|
94
|
+
self.class == o.class &&
|
95
|
+
ticket == o.ticket &&
|
96
|
+
ticket_entry == o.ticket_entry &&
|
97
|
+
valid_to_max == o.valid_to_max
|
98
|
+
end
|
99
|
+
|
100
|
+
# @see the `==` method
|
101
|
+
# @param [Object] Object to be compared
|
102
|
+
def eql?(o)
|
103
|
+
self == o
|
104
|
+
end
|
105
|
+
|
106
|
+
# Calculates hash code according to all attributes.
|
107
|
+
# @return [Integer] Hash code
|
108
|
+
def hash
|
109
|
+
[ticket, ticket_entry, valid_to_max].hash
|
110
|
+
end
|
111
|
+
|
112
|
+
# Builds the object from hash
|
113
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
114
|
+
# @return [Object] Returns the model itself
|
115
|
+
def self.build_from_hash(attributes)
|
116
|
+
new.build_from_hash(attributes)
|
117
|
+
end
|
118
|
+
|
119
|
+
# Builds the object from hash
|
120
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
121
|
+
# @return [Object] Returns the model itself
|
122
|
+
def build_from_hash(attributes)
|
123
|
+
return nil unless attributes.is_a?(Hash)
|
124
|
+
self.class.openapi_types.each_pair do |key, type|
|
125
|
+
if type =~ /\AArray<(.*)>/i
|
126
|
+
# check to ensure the input is an array given that the attribute
|
127
|
+
# is documented as an array but the input is not
|
128
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
129
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
130
|
+
end
|
131
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
132
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
133
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
134
|
+
end
|
135
|
+
|
136
|
+
self
|
137
|
+
end
|
138
|
+
|
139
|
+
# Deserializes the data based on type
|
140
|
+
# @param string type Data type
|
141
|
+
# @param string value Value to be deserialized
|
142
|
+
# @return [Object] Deserialized data
|
143
|
+
def _deserialize(type, value)
|
144
|
+
case type.to_sym
|
145
|
+
when :DateTime
|
146
|
+
DateTime.parse(value)
|
147
|
+
when :Date
|
148
|
+
Date.parse(value)
|
149
|
+
when :String
|
150
|
+
value.to_s
|
151
|
+
when :Integer
|
152
|
+
value.to_i
|
153
|
+
when :Float
|
154
|
+
value.to_f
|
155
|
+
when :Boolean
|
156
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
157
|
+
true
|
158
|
+
else
|
159
|
+
false
|
160
|
+
end
|
161
|
+
when :Object
|
162
|
+
# generic object (usually a Hash), return directly
|
163
|
+
value
|
164
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
165
|
+
inner_type = Regexp.last_match[:inner_type]
|
166
|
+
value.map { |v| _deserialize(inner_type, v) }
|
167
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
168
|
+
k_type = Regexp.last_match[:k_type]
|
169
|
+
v_type = Regexp.last_match[:v_type]
|
170
|
+
{}.tap do |hash|
|
171
|
+
value.each do |k, v|
|
172
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
173
|
+
end
|
174
|
+
end
|
175
|
+
else # model
|
176
|
+
KoronaEntryClient.const_get(type).build_from_hash(value)
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
# Returns the string representation of the object
|
181
|
+
# @return [String] String presentation of the object
|
182
|
+
def to_s
|
183
|
+
to_hash.to_s
|
184
|
+
end
|
185
|
+
|
186
|
+
# to_body is an alias to to_hash (backward compatibility)
|
187
|
+
# @return [Hash] Returns the object in the form of hash
|
188
|
+
def to_body
|
189
|
+
to_hash
|
190
|
+
end
|
191
|
+
|
192
|
+
# Returns the object in the form of hash
|
193
|
+
# @return [Hash] Returns the object in the form of hash
|
194
|
+
def to_hash
|
195
|
+
hash = {}
|
196
|
+
self.class.attribute_map.each_pair do |attr, param|
|
197
|
+
value = self.send(attr)
|
198
|
+
if value.nil?
|
199
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
200
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
201
|
+
end
|
202
|
+
|
203
|
+
hash[param] = _to_hash(value)
|
204
|
+
end
|
205
|
+
hash
|
206
|
+
end
|
207
|
+
|
208
|
+
# Outputs non-array value in the form of hash
|
209
|
+
# For object, use to_hash. Otherwise, just return the value
|
210
|
+
# @param [Object] value Any valid value
|
211
|
+
# @return [Hash] Returns the value in the form of hash
|
212
|
+
def _to_hash(value)
|
213
|
+
if value.is_a?(Array)
|
214
|
+
value.compact.map { |v| _to_hash(v) }
|
215
|
+
elsif value.is_a?(Hash)
|
216
|
+
{}.tap do |hash|
|
217
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
218
|
+
end
|
219
|
+
elsif value.respond_to? :to_hash
|
220
|
+
value.to_hash
|
221
|
+
else
|
222
|
+
value
|
223
|
+
end
|
224
|
+
end
|
225
|
+
end
|
226
|
+
end
|
@@ -0,0 +1,304 @@
|
|
1
|
+
=begin
|
2
|
+
#KORONA.entry API v1
|
3
|
+
|
4
|
+
#Our api provides access to our entry services
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 4.3.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module KoronaEntryClient
|
16
|
+
# The external ticket configuration.
|
17
|
+
class ExternalTicketConfiguration
|
18
|
+
# Objects ID.
|
19
|
+
attr_accessor :id
|
20
|
+
|
21
|
+
# Number of external ticket configuration.
|
22
|
+
attr_accessor :number
|
23
|
+
|
24
|
+
# Name of external ticket configuration.
|
25
|
+
attr_accessor :name
|
26
|
+
|
27
|
+
# Matching pattern for unkown external tickets.
|
28
|
+
attr_accessor :pattern
|
29
|
+
|
30
|
+
# Adjusts the validFrom value of TicketEntry while ticket creation dynamically to the ticket creation time plus the period.
|
31
|
+
attr_accessor :valid_from_period
|
32
|
+
|
33
|
+
# Adjusts the validTo value of TicketEntry while ticket creation dynamically to the ticket creation time plus the period.
|
34
|
+
attr_accessor :valid_to_period
|
35
|
+
|
36
|
+
# Validities for this configuration of external tickets.
|
37
|
+
attr_accessor :ticket_entries
|
38
|
+
|
39
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
40
|
+
def self.attribute_map
|
41
|
+
{
|
42
|
+
:'id' => :'id',
|
43
|
+
:'number' => :'number',
|
44
|
+
:'name' => :'name',
|
45
|
+
:'pattern' => :'pattern',
|
46
|
+
:'valid_from_period' => :'validFromPeriod',
|
47
|
+
:'valid_to_period' => :'validToPeriod',
|
48
|
+
:'ticket_entries' => :'ticketEntries'
|
49
|
+
}
|
50
|
+
end
|
51
|
+
|
52
|
+
# Attribute type mapping.
|
53
|
+
def self.openapi_types
|
54
|
+
{
|
55
|
+
:'id' => :'Integer',
|
56
|
+
:'number' => :'String',
|
57
|
+
:'name' => :'String',
|
58
|
+
:'pattern' => :'String',
|
59
|
+
:'valid_from_period' => :'String',
|
60
|
+
:'valid_to_period' => :'String',
|
61
|
+
:'ticket_entries' => :'Array<TicketEntry>'
|
62
|
+
}
|
63
|
+
end
|
64
|
+
|
65
|
+
# List of attributes with nullable: true
|
66
|
+
def self.openapi_nullable
|
67
|
+
Set.new([
|
68
|
+
])
|
69
|
+
end
|
70
|
+
|
71
|
+
# Initializes the object
|
72
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
73
|
+
def initialize(attributes = {})
|
74
|
+
if (!attributes.is_a?(Hash))
|
75
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `KoronaEntryClient::ExternalTicketConfiguration` initialize method"
|
76
|
+
end
|
77
|
+
|
78
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
79
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
80
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
81
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `KoronaEntryClient::ExternalTicketConfiguration`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
82
|
+
end
|
83
|
+
h[k.to_sym] = v
|
84
|
+
}
|
85
|
+
|
86
|
+
if attributes.key?(:'id')
|
87
|
+
self.id = attributes[:'id']
|
88
|
+
end
|
89
|
+
|
90
|
+
if attributes.key?(:'number')
|
91
|
+
self.number = attributes[:'number']
|
92
|
+
end
|
93
|
+
|
94
|
+
if attributes.key?(:'name')
|
95
|
+
self.name = attributes[:'name']
|
96
|
+
end
|
97
|
+
|
98
|
+
if attributes.key?(:'pattern')
|
99
|
+
self.pattern = attributes[:'pattern']
|
100
|
+
end
|
101
|
+
|
102
|
+
if attributes.key?(:'valid_from_period')
|
103
|
+
self.valid_from_period = attributes[:'valid_from_period']
|
104
|
+
end
|
105
|
+
|
106
|
+
if attributes.key?(:'valid_to_period')
|
107
|
+
self.valid_to_period = attributes[:'valid_to_period']
|
108
|
+
end
|
109
|
+
|
110
|
+
if attributes.key?(:'ticket_entries')
|
111
|
+
if (value = attributes[:'ticket_entries']).is_a?(Array)
|
112
|
+
self.ticket_entries = value
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
118
|
+
# @return Array for valid properties with the reasons
|
119
|
+
def list_invalid_properties
|
120
|
+
invalid_properties = Array.new
|
121
|
+
pattern = Regexp.new(/^(-?)P(?=.)((\d+)Y)?((\d+)M)?((\d+)D)?(T(?=.)((\d+)H)?((\d+)M)?(\d*(\.\d+)?S)?)?$/)
|
122
|
+
if !@valid_from_period.nil? && @valid_from_period !~ pattern
|
123
|
+
invalid_properties.push("invalid value for \"valid_from_period\", must conform to the pattern #{pattern}.")
|
124
|
+
end
|
125
|
+
|
126
|
+
pattern = Regexp.new(/^(-?)P(?=.)((\d+)Y)?((\d+)M)?((\d+)D)?(T(?=.)((\d+)H)?((\d+)M)?(\d*(\.\d+)?S)?)?$/)
|
127
|
+
if !@valid_to_period.nil? && @valid_to_period !~ pattern
|
128
|
+
invalid_properties.push("invalid value for \"valid_to_period\", must conform to the pattern #{pattern}.")
|
129
|
+
end
|
130
|
+
|
131
|
+
invalid_properties
|
132
|
+
end
|
133
|
+
|
134
|
+
# Check to see if the all the properties in the model are valid
|
135
|
+
# @return true if the model is valid
|
136
|
+
def valid?
|
137
|
+
return false if !@valid_from_period.nil? && @valid_from_period !~ Regexp.new(/^(-?)P(?=.)((\d+)Y)?((\d+)M)?((\d+)D)?(T(?=.)((\d+)H)?((\d+)M)?(\d*(\.\d+)?S)?)?$/)
|
138
|
+
return false if !@valid_to_period.nil? && @valid_to_period !~ Regexp.new(/^(-?)P(?=.)((\d+)Y)?((\d+)M)?((\d+)D)?(T(?=.)((\d+)H)?((\d+)M)?(\d*(\.\d+)?S)?)?$/)
|
139
|
+
true
|
140
|
+
end
|
141
|
+
|
142
|
+
# Custom attribute writer method with validation
|
143
|
+
# @param [Object] valid_from_period Value to be assigned
|
144
|
+
def valid_from_period=(valid_from_period)
|
145
|
+
pattern = Regexp.new(/^(-?)P(?=.)((\d+)Y)?((\d+)M)?((\d+)D)?(T(?=.)((\d+)H)?((\d+)M)?(\d*(\.\d+)?S)?)?$/)
|
146
|
+
if !valid_from_period.nil? && valid_from_period !~ pattern
|
147
|
+
fail ArgumentError, "invalid value for \"valid_from_period\", must conform to the pattern #{pattern}."
|
148
|
+
end
|
149
|
+
|
150
|
+
@valid_from_period = valid_from_period
|
151
|
+
end
|
152
|
+
|
153
|
+
# Custom attribute writer method with validation
|
154
|
+
# @param [Object] valid_to_period Value to be assigned
|
155
|
+
def valid_to_period=(valid_to_period)
|
156
|
+
pattern = Regexp.new(/^(-?)P(?=.)((\d+)Y)?((\d+)M)?((\d+)D)?(T(?=.)((\d+)H)?((\d+)M)?(\d*(\.\d+)?S)?)?$/)
|
157
|
+
if !valid_to_period.nil? && valid_to_period !~ pattern
|
158
|
+
fail ArgumentError, "invalid value for \"valid_to_period\", must conform to the pattern #{pattern}."
|
159
|
+
end
|
160
|
+
|
161
|
+
@valid_to_period = valid_to_period
|
162
|
+
end
|
163
|
+
|
164
|
+
# Checks equality by comparing each attribute.
|
165
|
+
# @param [Object] Object to be compared
|
166
|
+
def ==(o)
|
167
|
+
return true if self.equal?(o)
|
168
|
+
self.class == o.class &&
|
169
|
+
id == o.id &&
|
170
|
+
number == o.number &&
|
171
|
+
name == o.name &&
|
172
|
+
pattern == o.pattern &&
|
173
|
+
valid_from_period == o.valid_from_period &&
|
174
|
+
valid_to_period == o.valid_to_period &&
|
175
|
+
ticket_entries == o.ticket_entries
|
176
|
+
end
|
177
|
+
|
178
|
+
# @see the `==` method
|
179
|
+
# @param [Object] Object to be compared
|
180
|
+
def eql?(o)
|
181
|
+
self == o
|
182
|
+
end
|
183
|
+
|
184
|
+
# Calculates hash code according to all attributes.
|
185
|
+
# @return [Integer] Hash code
|
186
|
+
def hash
|
187
|
+
[id, number, name, pattern, valid_from_period, valid_to_period, ticket_entries].hash
|
188
|
+
end
|
189
|
+
|
190
|
+
# Builds the object from hash
|
191
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
192
|
+
# @return [Object] Returns the model itself
|
193
|
+
def self.build_from_hash(attributes)
|
194
|
+
new.build_from_hash(attributes)
|
195
|
+
end
|
196
|
+
|
197
|
+
# Builds the object from hash
|
198
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
199
|
+
# @return [Object] Returns the model itself
|
200
|
+
def build_from_hash(attributes)
|
201
|
+
return nil unless attributes.is_a?(Hash)
|
202
|
+
self.class.openapi_types.each_pair do |key, type|
|
203
|
+
if type =~ /\AArray<(.*)>/i
|
204
|
+
# check to ensure the input is an array given that the attribute
|
205
|
+
# is documented as an array but the input is not
|
206
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
207
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
208
|
+
end
|
209
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
210
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
211
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
212
|
+
end
|
213
|
+
|
214
|
+
self
|
215
|
+
end
|
216
|
+
|
217
|
+
# Deserializes the data based on type
|
218
|
+
# @param string type Data type
|
219
|
+
# @param string value Value to be deserialized
|
220
|
+
# @return [Object] Deserialized data
|
221
|
+
def _deserialize(type, value)
|
222
|
+
case type.to_sym
|
223
|
+
when :DateTime
|
224
|
+
DateTime.parse(value)
|
225
|
+
when :Date
|
226
|
+
Date.parse(value)
|
227
|
+
when :String
|
228
|
+
value.to_s
|
229
|
+
when :Integer
|
230
|
+
value.to_i
|
231
|
+
when :Float
|
232
|
+
value.to_f
|
233
|
+
when :Boolean
|
234
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
235
|
+
true
|
236
|
+
else
|
237
|
+
false
|
238
|
+
end
|
239
|
+
when :Object
|
240
|
+
# generic object (usually a Hash), return directly
|
241
|
+
value
|
242
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
243
|
+
inner_type = Regexp.last_match[:inner_type]
|
244
|
+
value.map { |v| _deserialize(inner_type, v) }
|
245
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
246
|
+
k_type = Regexp.last_match[:k_type]
|
247
|
+
v_type = Regexp.last_match[:v_type]
|
248
|
+
{}.tap do |hash|
|
249
|
+
value.each do |k, v|
|
250
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
251
|
+
end
|
252
|
+
end
|
253
|
+
else # model
|
254
|
+
KoronaEntryClient.const_get(type).build_from_hash(value)
|
255
|
+
end
|
256
|
+
end
|
257
|
+
|
258
|
+
# Returns the string representation of the object
|
259
|
+
# @return [String] String presentation of the object
|
260
|
+
def to_s
|
261
|
+
to_hash.to_s
|
262
|
+
end
|
263
|
+
|
264
|
+
# to_body is an alias to to_hash (backward compatibility)
|
265
|
+
# @return [Hash] Returns the object in the form of hash
|
266
|
+
def to_body
|
267
|
+
to_hash
|
268
|
+
end
|
269
|
+
|
270
|
+
# Returns the object in the form of hash
|
271
|
+
# @return [Hash] Returns the object in the form of hash
|
272
|
+
def to_hash
|
273
|
+
hash = {}
|
274
|
+
self.class.attribute_map.each_pair do |attr, param|
|
275
|
+
value = self.send(attr)
|
276
|
+
if value.nil?
|
277
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
278
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
279
|
+
end
|
280
|
+
|
281
|
+
hash[param] = _to_hash(value)
|
282
|
+
end
|
283
|
+
hash
|
284
|
+
end
|
285
|
+
|
286
|
+
# Outputs non-array value in the form of hash
|
287
|
+
# For object, use to_hash. Otherwise, just return the value
|
288
|
+
# @param [Object] value Any valid value
|
289
|
+
# @return [Hash] Returns the value in the form of hash
|
290
|
+
def _to_hash(value)
|
291
|
+
if value.is_a?(Array)
|
292
|
+
value.compact.map { |v| _to_hash(v) }
|
293
|
+
elsif value.is_a?(Hash)
|
294
|
+
{}.tap do |hash|
|
295
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
296
|
+
end
|
297
|
+
elsif value.respond_to? :to_hash
|
298
|
+
value.to_hash
|
299
|
+
else
|
300
|
+
value
|
301
|
+
end
|
302
|
+
end
|
303
|
+
end
|
304
|
+
end
|