radiomanager_client 1.1.2 → 1.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -2
- data/docs/BlockApi.md +4 -4
- data/docs/InviteUserData.md +1 -1
- data/docs/ItemApi.md +2 -2
- data/docs/ItemDataInput.md +1 -0
- data/docs/ItemInputOnly.md +1 -0
- data/docs/ModelTypeOptions.md +1 -0
- data/docs/StationResultStation.md +0 -1
- data/docs/UserResult.md +1 -1
- data/docs/UserResultRoles.md +11 -0
- data/lib/radiomanager_client/api/block_api.rb +4 -4
- data/lib/radiomanager_client/api/item_api.rb +2 -2
- data/lib/radiomanager_client/models/invite_user_data.rb +12 -10
- data/lib/radiomanager_client/models/item_data_input.rb +10 -1
- data/lib/radiomanager_client/models/item_input_only.rb +10 -1
- data/lib/radiomanager_client/models/model_type_options.rb +13 -4
- data/lib/radiomanager_client/models/station_result_station.rb +4 -13
- data/lib/radiomanager_client/models/user_result.rb +9 -7
- data/lib/radiomanager_client/models/{broadcast_field_values.rb → user_result_roles.rb} +35 -8
- data/lib/radiomanager_client.rb +1 -0
- data/radiomanager_client.gemspec +1 -1
- data/spec/api/block_api_spec.rb +8 -5
- data/spec/api/broadcast_api_spec.rb +20 -12
- data/spec/api/campaign_api_spec.rb +4 -1
- data/spec/api/contact_api_spec.rb +5 -2
- data/spec/api/genre_api_spec.rb +3 -0
- data/spec/api/item_api_spec.rb +14 -13
- data/spec/api/model_type_api_spec.rb +4 -1
- data/spec/api/presenter_api_spec.rb +4 -1
- data/spec/api/program_api_spec.rb +8 -5
- data/spec/api/story_api_spec.rb +5 -2
- data/spec/api/tag_api_spec.rb +3 -0
- data/spec/api/user_api_spec.rb +3 -0
- data/spec/configuration_spec.rb +3 -3
- data/spec/models/invite_user_data_spec.rb +1 -1
- data/spec/models/item_data_input_spec.rb +7 -1
- data/spec/models/item_input_only_spec.rb +7 -1
- data/spec/models/model_type_options_spec.rb +6 -0
- data/spec/models/station_result_station_spec.rb +1 -1
- data/spec/models/{epg_broadcast_spec.rb → user_result_roles_spec.rb} +15 -9
- data/spec/models/user_result_spec.rb +1 -1
- metadata +7 -31
- data/docs/BroadcastFieldValues.md +0 -8
- data/docs/ContactFieldValues.md +0 -8
- data/docs/EPGBroadcast.md +0 -10
- data/docs/ExternalMessageApi.md +0 -63
- data/docs/ExternalMessageQueueData.md +0 -14
- data/docs/ImportItemFieldValues.md +0 -8
- data/docs/ProgramFieldValues.md +0 -8
- data/lib/radiomanager_client/api/external_message_api.rb +0 -78
- data/lib/radiomanager_client/models/contact_field_values.rb +0 -188
- data/lib/radiomanager_client/models/epg_broadcast.rb +0 -227
- data/lib/radiomanager_client/models/external_message_queue_data.rb +0 -333
- data/lib/radiomanager_client/models/import_item_field_values.rb +0 -188
- data/lib/radiomanager_client/models/program_field_values.rb +0 -188
- data/spec/api/external_message_api_spec.rb +0 -47
- data/spec/models/broadcast_field_values_spec.rb +0 -42
- data/spec/models/contact_field_values_spec.rb +0 -42
- data/spec/models/external_message_queue_data_spec.rb +0 -78
- data/spec/models/import_item_field_values_spec.rb +0 -42
- data/spec/models/program_field_values_spec.rb +0 -42
@@ -1,227 +0,0 @@
|
|
1
|
-
=begin
|
2
|
-
#RadioManager
|
3
|
-
|
4
|
-
#RadioManager
|
5
|
-
|
6
|
-
OpenAPI spec version: 2.0
|
7
|
-
Contact: support@pluxbox.com
|
8
|
-
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version: 2.2.3
|
10
|
-
|
11
|
-
=end
|
12
|
-
|
13
|
-
require 'date'
|
14
|
-
|
15
|
-
module RadioManagerClient
|
16
|
-
|
17
|
-
class EPGBroadcast
|
18
|
-
attr_accessor :_2016_01_11
|
19
|
-
|
20
|
-
attr_accessor :next_page_url
|
21
|
-
|
22
|
-
attr_accessor :prev_page_url
|
23
|
-
|
24
|
-
|
25
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
26
|
-
def self.attribute_map
|
27
|
-
{
|
28
|
-
:'_2016_01_11' => :'2016-01-11',
|
29
|
-
:'next_page_url' => :'next_page_url',
|
30
|
-
:'prev_page_url' => :'prev_page_url'
|
31
|
-
}
|
32
|
-
end
|
33
|
-
|
34
|
-
# Attribute type mapping.
|
35
|
-
def self.swagger_types
|
36
|
-
{
|
37
|
-
:'_2016_01_11' => :'Array<BroadcastResult>',
|
38
|
-
:'next_page_url' => :'String',
|
39
|
-
:'prev_page_url' => :'String'
|
40
|
-
}
|
41
|
-
end
|
42
|
-
|
43
|
-
# Initializes the object
|
44
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
45
|
-
def initialize(attributes = {})
|
46
|
-
return unless attributes.is_a?(Hash)
|
47
|
-
|
48
|
-
# convert string to symbol for hash key
|
49
|
-
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
50
|
-
|
51
|
-
if attributes.has_key?(:'2016-01-11')
|
52
|
-
if (value = attributes[:'2016-01-11']).is_a?(Array)
|
53
|
-
self._2016_01_11 = value
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
if attributes.has_key?(:'next_page_url')
|
58
|
-
self.next_page_url = attributes[:'next_page_url']
|
59
|
-
else
|
60
|
-
self.next_page_url = "https://raidiomanager.pluxbox.com/api/v1/broadcasts/epg/{identifier}/2016-01-12"
|
61
|
-
end
|
62
|
-
|
63
|
-
if attributes.has_key?(:'prev_page_url')
|
64
|
-
self.prev_page_url = attributes[:'prev_page_url']
|
65
|
-
else
|
66
|
-
self.prev_page_url = "https://raidiomanager.pluxbox.com/pb/api/v1/broadcasts/epg/{identifier}/2016-01-10"
|
67
|
-
end
|
68
|
-
|
69
|
-
end
|
70
|
-
|
71
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
72
|
-
# @return Array for valid properies with the reasons
|
73
|
-
def list_invalid_properties
|
74
|
-
invalid_properties = Array.new
|
75
|
-
if @_2016_01_11.nil?
|
76
|
-
invalid_properties.push("invalid value for '_2016_01_11', _2016_01_11 cannot be nil.")
|
77
|
-
end
|
78
|
-
|
79
|
-
if @next_page_url.nil?
|
80
|
-
invalid_properties.push("invalid value for 'next_page_url', next_page_url cannot be nil.")
|
81
|
-
end
|
82
|
-
|
83
|
-
if @prev_page_url.nil?
|
84
|
-
invalid_properties.push("invalid value for 'prev_page_url', prev_page_url cannot be nil.")
|
85
|
-
end
|
86
|
-
|
87
|
-
return invalid_properties
|
88
|
-
end
|
89
|
-
|
90
|
-
# Check to see if the all the properties in the model are valid
|
91
|
-
# @return true if the model is valid
|
92
|
-
def valid?
|
93
|
-
return false if @_2016_01_11.nil?
|
94
|
-
return false if @next_page_url.nil?
|
95
|
-
return false if @prev_page_url.nil?
|
96
|
-
return true
|
97
|
-
end
|
98
|
-
|
99
|
-
# Checks equality by comparing each attribute.
|
100
|
-
# @param [Object] Object to be compared
|
101
|
-
def ==(o)
|
102
|
-
return true if self.equal?(o)
|
103
|
-
self.class == o.class &&
|
104
|
-
_2016_01_11 == o._2016_01_11 &&
|
105
|
-
next_page_url == o.next_page_url &&
|
106
|
-
prev_page_url == o.prev_page_url
|
107
|
-
end
|
108
|
-
|
109
|
-
# @see the `==` method
|
110
|
-
# @param [Object] Object to be compared
|
111
|
-
def eql?(o)
|
112
|
-
self == o
|
113
|
-
end
|
114
|
-
|
115
|
-
# Calculates hash code according to all attributes.
|
116
|
-
# @return [Fixnum] Hash code
|
117
|
-
def hash
|
118
|
-
[_2016_01_11, next_page_url, prev_page_url].hash
|
119
|
-
end
|
120
|
-
|
121
|
-
# Builds the object from hash
|
122
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
123
|
-
# @return [Object] Returns the model itself
|
124
|
-
def build_from_hash(attributes)
|
125
|
-
return nil unless attributes.is_a?(Hash)
|
126
|
-
self.class.swagger_types.each_pair do |key, type|
|
127
|
-
if type =~ /\AArray<(.*)>/i
|
128
|
-
# check to ensure the input is an array given that the the attribute
|
129
|
-
# is documented as an array but the input is not
|
130
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
131
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
132
|
-
end
|
133
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
134
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
135
|
-
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
136
|
-
end
|
137
|
-
|
138
|
-
self
|
139
|
-
end
|
140
|
-
|
141
|
-
# Deserializes the data based on type
|
142
|
-
# @param string type Data type
|
143
|
-
# @param string value Value to be deserialized
|
144
|
-
# @return [Object] Deserialized data
|
145
|
-
def _deserialize(type, value)
|
146
|
-
case type.to_sym
|
147
|
-
when :DateTime
|
148
|
-
DateTime.parse(value)
|
149
|
-
when :Date
|
150
|
-
Date.parse(value)
|
151
|
-
when :String
|
152
|
-
value.to_s
|
153
|
-
when :Integer
|
154
|
-
value.to_i
|
155
|
-
when :Float
|
156
|
-
value.to_f
|
157
|
-
when :BOOLEAN
|
158
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
159
|
-
true
|
160
|
-
else
|
161
|
-
false
|
162
|
-
end
|
163
|
-
when :Object
|
164
|
-
# generic object (usually a Hash), return directly
|
165
|
-
value
|
166
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
167
|
-
inner_type = Regexp.last_match[:inner_type]
|
168
|
-
value.map { |v| _deserialize(inner_type, v) }
|
169
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
170
|
-
k_type = Regexp.last_match[:k_type]
|
171
|
-
v_type = Regexp.last_match[:v_type]
|
172
|
-
{}.tap do |hash|
|
173
|
-
value.each do |k, v|
|
174
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
175
|
-
end
|
176
|
-
end
|
177
|
-
else # model
|
178
|
-
temp_model = RadioManagerClient.const_get(type).new
|
179
|
-
temp_model.build_from_hash(value)
|
180
|
-
end
|
181
|
-
end
|
182
|
-
|
183
|
-
# Returns the string representation of the object
|
184
|
-
# @return [String] String presentation of the object
|
185
|
-
def to_s
|
186
|
-
to_hash.to_s
|
187
|
-
end
|
188
|
-
|
189
|
-
# to_body is an alias to to_hash (backward compatibility)
|
190
|
-
# @return [Hash] Returns the object in the form of hash
|
191
|
-
def to_body
|
192
|
-
to_hash
|
193
|
-
end
|
194
|
-
|
195
|
-
# Returns the object in the form of hash
|
196
|
-
# @return [Hash] Returns the object in the form of hash
|
197
|
-
def to_hash
|
198
|
-
hash = {}
|
199
|
-
self.class.attribute_map.each_pair do |attr, param|
|
200
|
-
value = self.send(attr)
|
201
|
-
next if value.nil?
|
202
|
-
hash[param] = _to_hash(value)
|
203
|
-
end
|
204
|
-
hash
|
205
|
-
end
|
206
|
-
|
207
|
-
# Outputs non-array value in the form of hash
|
208
|
-
# For object, use to_hash. Otherwise, just return the value
|
209
|
-
# @param [Object] value Any valid value
|
210
|
-
# @return [Hash] Returns the value in the form of hash
|
211
|
-
def _to_hash(value)
|
212
|
-
if value.is_a?(Array)
|
213
|
-
value.compact.map{ |v| _to_hash(v) }
|
214
|
-
elsif value.is_a?(Hash)
|
215
|
-
{}.tap do |hash|
|
216
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
217
|
-
end
|
218
|
-
elsif value.respond_to? :to_hash
|
219
|
-
value.to_hash
|
220
|
-
else
|
221
|
-
value
|
222
|
-
end
|
223
|
-
end
|
224
|
-
|
225
|
-
end
|
226
|
-
|
227
|
-
end
|
@@ -1,333 +0,0 @@
|
|
1
|
-
=begin
|
2
|
-
#RadioManager
|
3
|
-
|
4
|
-
#RadioManager
|
5
|
-
|
6
|
-
OpenAPI spec version: 2.0
|
7
|
-
Contact: support@pluxbox.com
|
8
|
-
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
-
Swagger Codegen version: 2.2.3
|
10
|
-
|
11
|
-
=end
|
12
|
-
|
13
|
-
require 'date'
|
14
|
-
|
15
|
-
module RadioManagerClient
|
16
|
-
|
17
|
-
class ExternalMessageQueueData
|
18
|
-
# Message **(Required)**
|
19
|
-
attr_accessor :message
|
20
|
-
|
21
|
-
# ID of Message **(Required)**
|
22
|
-
attr_accessor :message_id
|
23
|
-
|
24
|
-
# Message Date *(Optional)*
|
25
|
-
attr_accessor :message_date
|
26
|
-
|
27
|
-
# Sender **(Required)**
|
28
|
-
attr_accessor :sender_name
|
29
|
-
|
30
|
-
# ID of Sender *(Optional)*
|
31
|
-
attr_accessor :sender_id
|
32
|
-
|
33
|
-
# URL of Avatar *(Optional)*
|
34
|
-
attr_accessor :avatar_url
|
35
|
-
|
36
|
-
# Assigned Model Type ID **(Required)**
|
37
|
-
attr_accessor :model_type_id
|
38
|
-
|
39
|
-
|
40
|
-
# Attribute mapping from ruby-style variable name to JSON key.
|
41
|
-
def self.attribute_map
|
42
|
-
{
|
43
|
-
:'message' => :'message',
|
44
|
-
:'message_id' => :'message_id',
|
45
|
-
:'message_date' => :'message_date',
|
46
|
-
:'sender_name' => :'sender_name',
|
47
|
-
:'sender_id' => :'sender_id',
|
48
|
-
:'avatar_url' => :'avatar_url',
|
49
|
-
:'model_type_id' => :'model_type_id'
|
50
|
-
}
|
51
|
-
end
|
52
|
-
|
53
|
-
# Attribute type mapping.
|
54
|
-
def self.swagger_types
|
55
|
-
{
|
56
|
-
:'message' => :'String',
|
57
|
-
:'message_id' => :'Integer',
|
58
|
-
:'message_date' => :'DateTime',
|
59
|
-
:'sender_name' => :'String',
|
60
|
-
:'sender_id' => :'Integer',
|
61
|
-
:'avatar_url' => :'String',
|
62
|
-
:'model_type_id' => :'Integer'
|
63
|
-
}
|
64
|
-
end
|
65
|
-
|
66
|
-
# Initializes the object
|
67
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
68
|
-
def initialize(attributes = {})
|
69
|
-
return unless attributes.is_a?(Hash)
|
70
|
-
|
71
|
-
# convert string to symbol for hash key
|
72
|
-
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
73
|
-
|
74
|
-
if attributes.has_key?(:'message')
|
75
|
-
self.message = attributes[:'message']
|
76
|
-
else
|
77
|
-
self.message = ""
|
78
|
-
end
|
79
|
-
|
80
|
-
if attributes.has_key?(:'message_id')
|
81
|
-
self.message_id = attributes[:'message_id']
|
82
|
-
end
|
83
|
-
|
84
|
-
if attributes.has_key?(:'message_date')
|
85
|
-
self.message_date = attributes[:'message_date']
|
86
|
-
end
|
87
|
-
|
88
|
-
if attributes.has_key?(:'sender_name')
|
89
|
-
self.sender_name = attributes[:'sender_name']
|
90
|
-
else
|
91
|
-
self.sender_name = ""
|
92
|
-
end
|
93
|
-
|
94
|
-
if attributes.has_key?(:'sender_id')
|
95
|
-
self.sender_id = attributes[:'sender_id']
|
96
|
-
end
|
97
|
-
|
98
|
-
if attributes.has_key?(:'avatar_url')
|
99
|
-
self.avatar_url = attributes[:'avatar_url']
|
100
|
-
end
|
101
|
-
|
102
|
-
if attributes.has_key?(:'model_type_id')
|
103
|
-
self.model_type_id = attributes[:'model_type_id']
|
104
|
-
end
|
105
|
-
|
106
|
-
end
|
107
|
-
|
108
|
-
# Show invalid properties with the reasons. Usually used together with valid?
|
109
|
-
# @return Array for valid properies with the reasons
|
110
|
-
def list_invalid_properties
|
111
|
-
invalid_properties = Array.new
|
112
|
-
if !@message.nil? && @message.to_s.length > 600
|
113
|
-
invalid_properties.push("invalid value for 'message', the character length must be smaller than or equal to 600.")
|
114
|
-
end
|
115
|
-
|
116
|
-
if !@message_id.nil? && @message_id < 0
|
117
|
-
invalid_properties.push("invalid value for 'message_id', must be greater than or equal to 0.")
|
118
|
-
end
|
119
|
-
|
120
|
-
if !@sender_name.nil? && @sender_name.to_s.length > 60
|
121
|
-
invalid_properties.push("invalid value for 'sender_name', the character length must be smaller than or equal to 60.")
|
122
|
-
end
|
123
|
-
|
124
|
-
if !@sender_id.nil? && @sender_id < 0
|
125
|
-
invalid_properties.push("invalid value for 'sender_id', must be greater than or equal to 0.")
|
126
|
-
end
|
127
|
-
|
128
|
-
if !@model_type_id.nil? && @model_type_id < 0
|
129
|
-
invalid_properties.push("invalid value for 'model_type_id', must be greater than or equal to 0.")
|
130
|
-
end
|
131
|
-
|
132
|
-
return invalid_properties
|
133
|
-
end
|
134
|
-
|
135
|
-
# Check to see if the all the properties in the model are valid
|
136
|
-
# @return true if the model is valid
|
137
|
-
def valid?
|
138
|
-
return false if !@message.nil? && @message.to_s.length > 600
|
139
|
-
return false if !@message_id.nil? && @message_id < 0
|
140
|
-
return false if !@sender_name.nil? && @sender_name.to_s.length > 60
|
141
|
-
return false if !@sender_id.nil? && @sender_id < 0
|
142
|
-
return false if !@model_type_id.nil? && @model_type_id < 0
|
143
|
-
return true
|
144
|
-
end
|
145
|
-
|
146
|
-
# Custom attribute writer method with validation
|
147
|
-
# @param [Object] message Value to be assigned
|
148
|
-
def message=(message)
|
149
|
-
|
150
|
-
if !message.nil? && message.to_s.length > 600
|
151
|
-
fail ArgumentError, "invalid value for 'message', the character length must be smaller than or equal to 600."
|
152
|
-
end
|
153
|
-
|
154
|
-
@message = message
|
155
|
-
end
|
156
|
-
|
157
|
-
# Custom attribute writer method with validation
|
158
|
-
# @param [Object] message_id Value to be assigned
|
159
|
-
def message_id=(message_id)
|
160
|
-
|
161
|
-
if !message_id.nil? && message_id < 0
|
162
|
-
fail ArgumentError, "invalid value for 'message_id', must be greater than or equal to 0."
|
163
|
-
end
|
164
|
-
|
165
|
-
@message_id = message_id
|
166
|
-
end
|
167
|
-
|
168
|
-
# Custom attribute writer method with validation
|
169
|
-
# @param [Object] sender_name Value to be assigned
|
170
|
-
def sender_name=(sender_name)
|
171
|
-
|
172
|
-
if !sender_name.nil? && sender_name.to_s.length > 60
|
173
|
-
fail ArgumentError, "invalid value for 'sender_name', the character length must be smaller than or equal to 60."
|
174
|
-
end
|
175
|
-
|
176
|
-
@sender_name = sender_name
|
177
|
-
end
|
178
|
-
|
179
|
-
# Custom attribute writer method with validation
|
180
|
-
# @param [Object] sender_id Value to be assigned
|
181
|
-
def sender_id=(sender_id)
|
182
|
-
|
183
|
-
if !sender_id.nil? && sender_id < 0
|
184
|
-
fail ArgumentError, "invalid value for 'sender_id', must be greater than or equal to 0."
|
185
|
-
end
|
186
|
-
|
187
|
-
@sender_id = sender_id
|
188
|
-
end
|
189
|
-
|
190
|
-
# Custom attribute writer method with validation
|
191
|
-
# @param [Object] model_type_id Value to be assigned
|
192
|
-
def model_type_id=(model_type_id)
|
193
|
-
|
194
|
-
if !model_type_id.nil? && model_type_id < 0
|
195
|
-
fail ArgumentError, "invalid value for 'model_type_id', must be greater than or equal to 0."
|
196
|
-
end
|
197
|
-
|
198
|
-
@model_type_id = model_type_id
|
199
|
-
end
|
200
|
-
|
201
|
-
# Checks equality by comparing each attribute.
|
202
|
-
# @param [Object] Object to be compared
|
203
|
-
def ==(o)
|
204
|
-
return true if self.equal?(o)
|
205
|
-
self.class == o.class &&
|
206
|
-
message == o.message &&
|
207
|
-
message_id == o.message_id &&
|
208
|
-
message_date == o.message_date &&
|
209
|
-
sender_name == o.sender_name &&
|
210
|
-
sender_id == o.sender_id &&
|
211
|
-
avatar_url == o.avatar_url &&
|
212
|
-
model_type_id == o.model_type_id
|
213
|
-
end
|
214
|
-
|
215
|
-
# @see the `==` method
|
216
|
-
# @param [Object] Object to be compared
|
217
|
-
def eql?(o)
|
218
|
-
self == o
|
219
|
-
end
|
220
|
-
|
221
|
-
# Calculates hash code according to all attributes.
|
222
|
-
# @return [Fixnum] Hash code
|
223
|
-
def hash
|
224
|
-
[message, message_id, message_date, sender_name, sender_id, avatar_url, model_type_id].hash
|
225
|
-
end
|
226
|
-
|
227
|
-
# Builds the object from hash
|
228
|
-
# @param [Hash] attributes Model attributes in the form of hash
|
229
|
-
# @return [Object] Returns the model itself
|
230
|
-
def build_from_hash(attributes)
|
231
|
-
return nil unless attributes.is_a?(Hash)
|
232
|
-
self.class.swagger_types.each_pair do |key, type|
|
233
|
-
if type =~ /\AArray<(.*)>/i
|
234
|
-
# check to ensure the input is an array given that the the attribute
|
235
|
-
# is documented as an array but the input is not
|
236
|
-
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
237
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
238
|
-
end
|
239
|
-
elsif !attributes[self.class.attribute_map[key]].nil?
|
240
|
-
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
241
|
-
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
242
|
-
end
|
243
|
-
|
244
|
-
self
|
245
|
-
end
|
246
|
-
|
247
|
-
# Deserializes the data based on type
|
248
|
-
# @param string type Data type
|
249
|
-
# @param string value Value to be deserialized
|
250
|
-
# @return [Object] Deserialized data
|
251
|
-
def _deserialize(type, value)
|
252
|
-
case type.to_sym
|
253
|
-
when :DateTime
|
254
|
-
DateTime.parse(value)
|
255
|
-
when :Date
|
256
|
-
Date.parse(value)
|
257
|
-
when :String
|
258
|
-
value.to_s
|
259
|
-
when :Integer
|
260
|
-
value.to_i
|
261
|
-
when :Float
|
262
|
-
value.to_f
|
263
|
-
when :BOOLEAN
|
264
|
-
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
265
|
-
true
|
266
|
-
else
|
267
|
-
false
|
268
|
-
end
|
269
|
-
when :Object
|
270
|
-
# generic object (usually a Hash), return directly
|
271
|
-
value
|
272
|
-
when /\AArray<(?<inner_type>.+)>\z/
|
273
|
-
inner_type = Regexp.last_match[:inner_type]
|
274
|
-
value.map { |v| _deserialize(inner_type, v) }
|
275
|
-
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
276
|
-
k_type = Regexp.last_match[:k_type]
|
277
|
-
v_type = Regexp.last_match[:v_type]
|
278
|
-
{}.tap do |hash|
|
279
|
-
value.each do |k, v|
|
280
|
-
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
281
|
-
end
|
282
|
-
end
|
283
|
-
else # model
|
284
|
-
temp_model = RadioManagerClient.const_get(type).new
|
285
|
-
temp_model.build_from_hash(value)
|
286
|
-
end
|
287
|
-
end
|
288
|
-
|
289
|
-
# Returns the string representation of the object
|
290
|
-
# @return [String] String presentation of the object
|
291
|
-
def to_s
|
292
|
-
to_hash.to_s
|
293
|
-
end
|
294
|
-
|
295
|
-
# to_body is an alias to to_hash (backward compatibility)
|
296
|
-
# @return [Hash] Returns the object in the form of hash
|
297
|
-
def to_body
|
298
|
-
to_hash
|
299
|
-
end
|
300
|
-
|
301
|
-
# Returns the object in the form of hash
|
302
|
-
# @return [Hash] Returns the object in the form of hash
|
303
|
-
def to_hash
|
304
|
-
hash = {}
|
305
|
-
self.class.attribute_map.each_pair do |attr, param|
|
306
|
-
value = self.send(attr)
|
307
|
-
next if value.nil?
|
308
|
-
hash[param] = _to_hash(value)
|
309
|
-
end
|
310
|
-
hash
|
311
|
-
end
|
312
|
-
|
313
|
-
# Outputs non-array value in the form of hash
|
314
|
-
# For object, use to_hash. Otherwise, just return the value
|
315
|
-
# @param [Object] value Any valid value
|
316
|
-
# @return [Hash] Returns the value in the form of hash
|
317
|
-
def _to_hash(value)
|
318
|
-
if value.is_a?(Array)
|
319
|
-
value.compact.map{ |v| _to_hash(v) }
|
320
|
-
elsif value.is_a?(Hash)
|
321
|
-
{}.tap do |hash|
|
322
|
-
value.each { |k, v| hash[k] = _to_hash(v) }
|
323
|
-
end
|
324
|
-
elsif value.respond_to? :to_hash
|
325
|
-
value.to_hash
|
326
|
-
else
|
327
|
-
value
|
328
|
-
end
|
329
|
-
end
|
330
|
-
|
331
|
-
end
|
332
|
-
|
333
|
-
end
|