radiomanager_client 1.0.99 → 1.0.100

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 (62) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +11 -5
  3. data/docs/BlockApi.md +13 -7
  4. data/docs/BroadcastApi.md +36 -24
  5. data/docs/BroadcastEPGDay.md +9 -0
  6. data/docs/BroadcastEPGRelations.md +13 -0
  7. data/docs/BroadcastEPGResult.md +40 -0
  8. data/docs/CampaignApi.md +9 -3
  9. data/docs/ContactApi.md +11 -5
  10. data/docs/EPGResults.md +10 -0
  11. data/docs/ExternalMessageApi.md +1 -1
  12. data/docs/GenreApi.md +7 -1
  13. data/docs/ItemApi.md +27 -25
  14. data/docs/ModelTypeApi.md +9 -3
  15. data/docs/PresenterApi.md +9 -3
  16. data/docs/PresenterEPGResult.md +18 -0
  17. data/docs/ProgramApi.md +17 -11
  18. data/docs/StationApi.md +57 -0
  19. data/docs/StationResult.md +8 -0
  20. data/docs/StationResultStation.md +33 -0
  21. data/docs/StoryApi.md +11 -5
  22. data/docs/StoryDataInput.md +1 -0
  23. data/docs/StringApi.md +1 -1
  24. data/docs/TagApi.md +7 -1
  25. data/docs/UserApi.md +8 -2
  26. data/docs/VisualSlideApi.md +1 -1
  27. data/lib/radiomanager_client/api/block_api.rb +29 -9
  28. data/lib/radiomanager_client/api/broadcast_api.rb +58 -29
  29. data/lib/radiomanager_client/api/campaign_api.rb +23 -3
  30. data/lib/radiomanager_client/api/contact_api.rb +25 -5
  31. data/lib/radiomanager_client/api/genre_api.rb +20 -0
  32. data/lib/radiomanager_client/api/item_api.rb +50 -39
  33. data/lib/radiomanager_client/api/model_type_api.rb +23 -3
  34. data/lib/radiomanager_client/api/presenter_api.rb +23 -3
  35. data/lib/radiomanager_client/api/program_api.rb +34 -14
  36. data/lib/radiomanager_client/api/station_api.rb +72 -0
  37. data/lib/radiomanager_client/api/story_api.rb +25 -5
  38. data/lib/radiomanager_client/api/tag_api.rb +20 -0
  39. data/lib/radiomanager_client/api/user_api.rb +20 -0
  40. data/lib/radiomanager_client/configuration.rb +1 -1
  41. data/lib/radiomanager_client/models/broadcast_epg_day.rb +204 -0
  42. data/lib/radiomanager_client/models/broadcast_epg_relations.rb +235 -0
  43. data/lib/radiomanager_client/models/broadcast_epg_result.rb +547 -0
  44. data/lib/radiomanager_client/models/epg_results.rb +223 -0
  45. data/lib/radiomanager_client/models/presenter_epg_result.rb +305 -0
  46. data/lib/radiomanager_client/models/station_result.rb +188 -0
  47. data/lib/radiomanager_client/models/station_result_station.rb +413 -0
  48. data/lib/radiomanager_client/models/story_data_input.rb +15 -4
  49. data/lib/radiomanager_client.rb +9 -3
  50. data/radiomanager_client.gemspec +1 -1
  51. data/spec/api/station_api_spec.rb +46 -0
  52. data/spec/configuration_spec.rb +3 -3
  53. data/spec/models/broadcast_epg_day_spec.rb +48 -0
  54. data/spec/models/broadcast_epg_relations_spec.rb +72 -0
  55. data/spec/models/broadcast_epg_result_spec.rb +238 -0
  56. data/spec/models/epg_results_spec.rb +54 -0
  57. data/spec/models/item_data_input_spec.rb +1 -1
  58. data/spec/models/item_input_only_spec.rb +1 -1
  59. data/spec/models/presenter_epg_result_spec.rb +102 -0
  60. data/spec/models/station_result_spec.rb +42 -0
  61. data/spec/models/station_result_station_spec.rb +186 -0
  62. metadata +34 -2
@@ -200,9 +200,12 @@ module RadioManagerClient
200
200
  # List all stories.
201
201
  # @param [Hash] opts the optional parameters
202
202
  # @option opts [Integer] :page Current page *(Optional)* (default to 1)
203
- # @option opts [Integer] :model_type_id Search on ModelType ID *(Optional)*
204
- # @option opts [Integer] :tag_id Search on Tag ID *(Optional)* `(Relation)`
205
203
  # @option opts [Integer] :item_id Search on Item ID *(Optional)* `(Relation)`
204
+ # @option opts [Integer] :model_type_id Search on ModelType ID *(Optional)* `(Relation)`
205
+ # @option opts [Integer] :tag_id Search on Tag ID *(Optional)* `(Relation)`
206
+ # @option opts [Integer] :limit Results per page *(Optional)*
207
+ # @option opts [String] :order_by Field to order the results *(Optional)*
208
+ # @option opts [String] :order_direction Direction of ordering *(Optional)*
206
209
  # @option opts [Integer] :_external_station_id Query on a different (content providing) station *(Optional)*
207
210
  # @return [StoryResults]
208
211
  def list_stories(opts = {})
@@ -214,9 +217,12 @@ module RadioManagerClient
214
217
  # List all stories.
215
218
  # @param [Hash] opts the optional parameters
216
219
  # @option opts [Integer] :page Current page *(Optional)*
217
- # @option opts [Integer] :model_type_id Search on ModelType ID *(Optional)*
218
- # @option opts [Integer] :tag_id Search on Tag ID *(Optional)* `(Relation)`
219
220
  # @option opts [Integer] :item_id Search on Item ID *(Optional)* `(Relation)`
221
+ # @option opts [Integer] :model_type_id Search on ModelType ID *(Optional)* `(Relation)`
222
+ # @option opts [Integer] :tag_id Search on Tag ID *(Optional)* `(Relation)`
223
+ # @option opts [Integer] :limit Results per page *(Optional)*
224
+ # @option opts [String] :order_by Field to order the results *(Optional)*
225
+ # @option opts [String] :order_direction Direction of ordering *(Optional)*
220
226
  # @option opts [Integer] :_external_station_id Query on a different (content providing) station *(Optional)*
221
227
  # @return [Array<(StoryResults, Fixnum, Hash)>] StoryResults data, response status code and response headers
222
228
  def list_stories_with_http_info(opts = {})
@@ -227,15 +233,29 @@ module RadioManagerClient
227
233
  fail ArgumentError, 'invalid value for "opts[:"page"]" when calling StoryApi.list_stories, must be greater than or equal to 0.'
228
234
  end
229
235
 
236
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 50
237
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling StoryApi.list_stories, must be smaller than or equal to 50.'
238
+ end
239
+
240
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
241
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling StoryApi.list_stories, must be greater than or equal to 1.'
242
+ end
243
+
244
+ if @api_client.config.client_side_validation && opts[:'order_direction'] && !['asc', 'desc'].include?(opts[:'order_direction'])
245
+ fail ArgumentError, 'invalid value for "order_direction", must be one of asc, desc'
246
+ end
230
247
  # resource path
231
248
  local_var_path = "/stories"
232
249
 
233
250
  # query parameters
234
251
  query_params = {}
235
252
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
253
+ query_params[:'item_id'] = opts[:'item_id'] if !opts[:'item_id'].nil?
236
254
  query_params[:'model_type_id'] = opts[:'model_type_id'] if !opts[:'model_type_id'].nil?
237
255
  query_params[:'tag_id'] = opts[:'tag_id'] if !opts[:'tag_id'].nil?
238
- query_params[:'item_id'] = opts[:'item_id'] if !opts[:'item_id'].nil?
256
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
257
+ query_params[:'order-by'] = opts[:'order_by'] if !opts[:'order_by'].nil?
258
+ query_params[:'order-direction'] = opts[:'order_direction'] if !opts[:'order_direction'].nil?
239
259
  query_params[:'_external_station_id'] = opts[:'_external_station_id'] if !opts[:'_external_station_id'].nil?
240
260
 
241
261
  # header parameters
@@ -204,6 +204,9 @@ module RadioManagerClient
204
204
  # @option opts [Integer] :item_id Search on Item ID *(Optional)* &#x60;(Relation)&#x60;
205
205
  # @option opts [Integer] :broadcast_id Search on Broadcast ID *(Optional)* &#x60;(Relation)&#x60;
206
206
  # @option opts [Integer] :contact_id Search on Contact ID *(Optional)* &#x60;(Relation)&#x60;
207
+ # @option opts [Integer] :limit Results per page *(Optional)*
208
+ # @option opts [String] :order_by Field to order the results *(Optional)*
209
+ # @option opts [String] :order_direction Direction of ordering *(Optional)*
207
210
  # @option opts [Integer] :_external_station_id Query on a different (content providing) station *(Optional)*
208
211
  # @return [TagResults]
209
212
  def list_tags(opts = {})
@@ -219,6 +222,9 @@ module RadioManagerClient
219
222
  # @option opts [Integer] :item_id Search on Item ID *(Optional)* &#x60;(Relation)&#x60;
220
223
  # @option opts [Integer] :broadcast_id Search on Broadcast ID *(Optional)* &#x60;(Relation)&#x60;
221
224
  # @option opts [Integer] :contact_id Search on Contact ID *(Optional)* &#x60;(Relation)&#x60;
225
+ # @option opts [Integer] :limit Results per page *(Optional)*
226
+ # @option opts [String] :order_by Field to order the results *(Optional)*
227
+ # @option opts [String] :order_direction Direction of ordering *(Optional)*
222
228
  # @option opts [Integer] :_external_station_id Query on a different (content providing) station *(Optional)*
223
229
  # @return [Array<(TagResults, Fixnum, Hash)>] TagResults data, response status code and response headers
224
230
  def list_tags_with_http_info(opts = {})
@@ -229,6 +235,17 @@ module RadioManagerClient
229
235
  fail ArgumentError, 'invalid value for "opts[:"page"]" when calling TagApi.list_tags, must be greater than or equal to 1.'
230
236
  end
231
237
 
238
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 50
239
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling TagApi.list_tags, must be smaller than or equal to 50.'
240
+ end
241
+
242
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
243
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling TagApi.list_tags, must be greater than or equal to 1.'
244
+ end
245
+
246
+ if @api_client.config.client_side_validation && opts[:'order_direction'] && !['asc', 'desc'].include?(opts[:'order_direction'])
247
+ fail ArgumentError, 'invalid value for "order_direction", must be one of asc, desc'
248
+ end
232
249
  # resource path
233
250
  local_var_path = "/tags"
234
251
 
@@ -239,6 +256,9 @@ module RadioManagerClient
239
256
  query_params[:'item_id'] = opts[:'item_id'] if !opts[:'item_id'].nil?
240
257
  query_params[:'broadcast_id'] = opts[:'broadcast_id'] if !opts[:'broadcast_id'].nil?
241
258
  query_params[:'contact_id'] = opts[:'contact_id'] if !opts[:'contact_id'].nil?
259
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
260
+ query_params[:'order-by'] = opts[:'order_by'] if !opts[:'order_by'].nil?
261
+ query_params[:'order-direction'] = opts[:'order_direction'] if !opts[:'order_direction'].nil?
242
262
  query_params[:'_external_station_id'] = opts[:'_external_station_id'] if !opts[:'_external_station_id'].nil?
243
263
 
244
264
  # header parameters
@@ -198,6 +198,9 @@ module RadioManagerClient
198
198
  # @param [Hash] opts the optional parameters
199
199
  # @option opts [Integer] :page Current page *(Optional)* (default to 1)
200
200
  # @option opts [Integer] :role_id Search on Role ID *(Optional)*
201
+ # @option opts [Integer] :limit Results per page *(Optional)*
202
+ # @option opts [String] :order_by Field to order the results *(Optional)*
203
+ # @option opts [String] :order_direction Direction of ordering *(Optional)*
201
204
  # @return [UserResults]
202
205
  def list_users(opts = {})
203
206
  data, _status_code, _headers = list_users_with_http_info(opts)
@@ -209,6 +212,9 @@ module RadioManagerClient
209
212
  # @param [Hash] opts the optional parameters
210
213
  # @option opts [Integer] :page Current page *(Optional)*
211
214
  # @option opts [Integer] :role_id Search on Role ID *(Optional)*
215
+ # @option opts [Integer] :limit Results per page *(Optional)*
216
+ # @option opts [String] :order_by Field to order the results *(Optional)*
217
+ # @option opts [String] :order_direction Direction of ordering *(Optional)*
212
218
  # @return [Array<(UserResults, Fixnum, Hash)>] UserResults data, response status code and response headers
213
219
  def list_users_with_http_info(opts = {})
214
220
  if @api_client.config.debugging
@@ -218,6 +224,17 @@ module RadioManagerClient
218
224
  fail ArgumentError, 'invalid value for "opts[:"page"]" when calling UserApi.list_users, must be greater than or equal to 0.'
219
225
  end
220
226
 
227
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 50
228
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling UserApi.list_users, must be smaller than or equal to 50.'
229
+ end
230
+
231
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
232
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling UserApi.list_users, must be greater than or equal to 1.'
233
+ end
234
+
235
+ if @api_client.config.client_side_validation && opts[:'order_direction'] && !['asc', 'desc'].include?(opts[:'order_direction'])
236
+ fail ArgumentError, 'invalid value for "order_direction", must be one of asc, desc'
237
+ end
221
238
  # resource path
222
239
  local_var_path = "/users"
223
240
 
@@ -225,6 +242,9 @@ module RadioManagerClient
225
242
  query_params = {}
226
243
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
227
244
  query_params[:'role_id'] = opts[:'role_id'] if !opts[:'role_id'].nil?
245
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
246
+ query_params[:'order-by'] = opts[:'order_by'] if !opts[:'order_by'].nil?
247
+ query_params[:'order-direction'] = opts[:'order_direction'] if !opts[:'order_direction'].nil?
228
248
 
229
249
  # header parameters
230
250
  header_params = {}
@@ -129,7 +129,7 @@ module RadioManagerClient
129
129
 
130
130
  def initialize
131
131
  @scheme = 'https'
132
- @host = 'staging.radiomanager.pluxbox.com'
132
+ @host = 'staging.radiomanager.io'
133
133
  @base_path = '/api/v2'
134
134
  @api_key = {}
135
135
  @api_key_prefix = {}
@@ -0,0 +1,204 @@
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 BroadcastEPGDay
18
+ attr_accessor :day
19
+
20
+ attr_accessor :results
21
+
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'day' => :'day',
27
+ :'results' => :'results'
28
+ }
29
+ end
30
+
31
+ # Attribute type mapping.
32
+ def self.swagger_types
33
+ {
34
+ :'day' => :'Date',
35
+ :'results' => :'Array<BroadcastEPGResult>'
36
+ }
37
+ end
38
+
39
+ # Initializes the object
40
+ # @param [Hash] attributes Model attributes in the form of hash
41
+ def initialize(attributes = {})
42
+ return unless attributes.is_a?(Hash)
43
+
44
+ # convert string to symbol for hash key
45
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
46
+
47
+ if attributes.has_key?(:'day')
48
+ self.day = attributes[:'day']
49
+ end
50
+
51
+ if attributes.has_key?(:'results')
52
+ if (value = attributes[:'results']).is_a?(Array)
53
+ self.results = value
54
+ end
55
+ end
56
+
57
+ end
58
+
59
+ # Show invalid properties with the reasons. Usually used together with valid?
60
+ # @return Array for valid properies with the reasons
61
+ def list_invalid_properties
62
+ invalid_properties = Array.new
63
+ if @results.nil?
64
+ invalid_properties.push("invalid value for 'results', results cannot be nil.")
65
+ end
66
+
67
+ return invalid_properties
68
+ end
69
+
70
+ # Check to see if the all the properties in the model are valid
71
+ # @return true if the model is valid
72
+ def valid?
73
+ return false if @results.nil?
74
+ return true
75
+ end
76
+
77
+ # Checks equality by comparing each attribute.
78
+ # @param [Object] Object to be compared
79
+ def ==(o)
80
+ return true if self.equal?(o)
81
+ self.class == o.class &&
82
+ day == o.day &&
83
+ results == o.results
84
+ end
85
+
86
+ # @see the `==` method
87
+ # @param [Object] Object to be compared
88
+ def eql?(o)
89
+ self == o
90
+ end
91
+
92
+ # Calculates hash code according to all attributes.
93
+ # @return [Fixnum] Hash code
94
+ def hash
95
+ [day, results].hash
96
+ end
97
+
98
+ # Builds the object from hash
99
+ # @param [Hash] attributes Model attributes in the form of hash
100
+ # @return [Object] Returns the model itself
101
+ def build_from_hash(attributes)
102
+ return nil unless attributes.is_a?(Hash)
103
+ self.class.swagger_types.each_pair do |key, type|
104
+ if type =~ /\AArray<(.*)>/i
105
+ # check to ensure the input is an array given that the the attribute
106
+ # is documented as an array but the input is not
107
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
108
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
109
+ end
110
+ elsif !attributes[self.class.attribute_map[key]].nil?
111
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
112
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
113
+ end
114
+
115
+ self
116
+ end
117
+
118
+ # Deserializes the data based on type
119
+ # @param string type Data type
120
+ # @param string value Value to be deserialized
121
+ # @return [Object] Deserialized data
122
+ def _deserialize(type, value)
123
+ case type.to_sym
124
+ when :DateTime
125
+ DateTime.parse(value)
126
+ when :Date
127
+ Date.parse(value)
128
+ when :String
129
+ value.to_s
130
+ when :Integer
131
+ value.to_i
132
+ when :Float
133
+ value.to_f
134
+ when :BOOLEAN
135
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
136
+ true
137
+ else
138
+ false
139
+ end
140
+ when :Object
141
+ # generic object (usually a Hash), return directly
142
+ value
143
+ when /\AArray<(?<inner_type>.+)>\z/
144
+ inner_type = Regexp.last_match[:inner_type]
145
+ value.map { |v| _deserialize(inner_type, v) }
146
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
147
+ k_type = Regexp.last_match[:k_type]
148
+ v_type = Regexp.last_match[:v_type]
149
+ {}.tap do |hash|
150
+ value.each do |k, v|
151
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
152
+ end
153
+ end
154
+ else # model
155
+ temp_model = RadioManagerClient.const_get(type).new
156
+ temp_model.build_from_hash(value)
157
+ end
158
+ end
159
+
160
+ # Returns the string representation of the object
161
+ # @return [String] String presentation of the object
162
+ def to_s
163
+ to_hash.to_s
164
+ end
165
+
166
+ # to_body is an alias to to_hash (backward compatibility)
167
+ # @return [Hash] Returns the object in the form of hash
168
+ def to_body
169
+ to_hash
170
+ end
171
+
172
+ # Returns the object in the form of hash
173
+ # @return [Hash] Returns the object in the form of hash
174
+ def to_hash
175
+ hash = {}
176
+ self.class.attribute_map.each_pair do |attr, param|
177
+ value = self.send(attr)
178
+ next if value.nil?
179
+ hash[param] = _to_hash(value)
180
+ end
181
+ hash
182
+ end
183
+
184
+ # Outputs non-array value in the form of hash
185
+ # For object, use to_hash. Otherwise, just return the value
186
+ # @param [Object] value Any valid value
187
+ # @return [Hash] Returns the value in the form of hash
188
+ def _to_hash(value)
189
+ if value.is_a?(Array)
190
+ value.compact.map{ |v| _to_hash(v) }
191
+ elsif value.is_a?(Hash)
192
+ {}.tap do |hash|
193
+ value.each { |k, v| hash[k] = _to_hash(v) }
194
+ end
195
+ elsif value.respond_to? :to_hash
196
+ value.to_hash
197
+ else
198
+ value
199
+ end
200
+ end
201
+
202
+ end
203
+
204
+ end
@@ -0,0 +1,235 @@
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 BroadcastEPGRelations
18
+ attr_accessor :items
19
+
20
+ attr_accessor :blocks
21
+
22
+ attr_accessor :program
23
+
24
+ attr_accessor :tags
25
+
26
+ attr_accessor :presenters
27
+
28
+ attr_accessor :model_type
29
+
30
+
31
+ # Attribute mapping from ruby-style variable name to JSON key.
32
+ def self.attribute_map
33
+ {
34
+ :'items' => :'items',
35
+ :'blocks' => :'blocks',
36
+ :'program' => :'program',
37
+ :'tags' => :'tags',
38
+ :'presenters' => :'presenters',
39
+ :'model_type' => :'model_type'
40
+ }
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.swagger_types
45
+ {
46
+ :'items' => :'BroadcastRelationsItems',
47
+ :'blocks' => :'BroadcastRelationsBlocks',
48
+ :'program' => :'BlockRelationsProgram',
49
+ :'tags' => :'BroadcastRelationsTags',
50
+ :'presenters' => :'Array<PresenterEPGResult>',
51
+ :'model_type' => :'BroadcastRelationsModelType'
52
+ }
53
+ end
54
+
55
+ # Initializes the object
56
+ # @param [Hash] attributes Model attributes in the form of hash
57
+ def initialize(attributes = {})
58
+ return unless attributes.is_a?(Hash)
59
+
60
+ # convert string to symbol for hash key
61
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
62
+
63
+ if attributes.has_key?(:'items')
64
+ self.items = attributes[:'items']
65
+ end
66
+
67
+ if attributes.has_key?(:'blocks')
68
+ self.blocks = attributes[:'blocks']
69
+ end
70
+
71
+ if attributes.has_key?(:'program')
72
+ self.program = attributes[:'program']
73
+ end
74
+
75
+ if attributes.has_key?(:'tags')
76
+ self.tags = attributes[:'tags']
77
+ end
78
+
79
+ if attributes.has_key?(:'presenters')
80
+ if (value = attributes[:'presenters']).is_a?(Array)
81
+ self.presenters = value
82
+ end
83
+ end
84
+
85
+ if attributes.has_key?(:'model_type')
86
+ self.model_type = attributes[:'model_type']
87
+ end
88
+
89
+ end
90
+
91
+ # Show invalid properties with the reasons. Usually used together with valid?
92
+ # @return Array for valid properies with the reasons
93
+ def list_invalid_properties
94
+ invalid_properties = Array.new
95
+ return invalid_properties
96
+ end
97
+
98
+ # Check to see if the all the properties in the model are valid
99
+ # @return true if the model is valid
100
+ def valid?
101
+ return true
102
+ end
103
+
104
+ # Checks equality by comparing each attribute.
105
+ # @param [Object] Object to be compared
106
+ def ==(o)
107
+ return true if self.equal?(o)
108
+ self.class == o.class &&
109
+ items == o.items &&
110
+ blocks == o.blocks &&
111
+ program == o.program &&
112
+ tags == o.tags &&
113
+ presenters == o.presenters &&
114
+ model_type == o.model_type
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 [Fixnum] Hash code
125
+ def hash
126
+ [items, blocks, program, tags, presenters, model_type].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 build_from_hash(attributes)
133
+ return nil unless attributes.is_a?(Hash)
134
+ self.class.swagger_types.each_pair do |key, type|
135
+ if type =~ /\AArray<(.*)>/i
136
+ # check to ensure the input is an array given that the the attribute
137
+ # is documented as an array but the input is not
138
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
139
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
140
+ end
141
+ elsif !attributes[self.class.attribute_map[key]].nil?
142
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
143
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
144
+ end
145
+
146
+ self
147
+ end
148
+
149
+ # Deserializes the data based on type
150
+ # @param string type Data type
151
+ # @param string value Value to be deserialized
152
+ # @return [Object] Deserialized data
153
+ def _deserialize(type, value)
154
+ case type.to_sym
155
+ when :DateTime
156
+ DateTime.parse(value)
157
+ when :Date
158
+ Date.parse(value)
159
+ when :String
160
+ value.to_s
161
+ when :Integer
162
+ value.to_i
163
+ when :Float
164
+ value.to_f
165
+ when :BOOLEAN
166
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
167
+ true
168
+ else
169
+ false
170
+ end
171
+ when :Object
172
+ # generic object (usually a Hash), return directly
173
+ value
174
+ when /\AArray<(?<inner_type>.+)>\z/
175
+ inner_type = Regexp.last_match[:inner_type]
176
+ value.map { |v| _deserialize(inner_type, v) }
177
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
178
+ k_type = Regexp.last_match[:k_type]
179
+ v_type = Regexp.last_match[:v_type]
180
+ {}.tap do |hash|
181
+ value.each do |k, v|
182
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
183
+ end
184
+ end
185
+ else # model
186
+ temp_model = RadioManagerClient.const_get(type).new
187
+ temp_model.build_from_hash(value)
188
+ end
189
+ end
190
+
191
+ # Returns the string representation of the object
192
+ # @return [String] String presentation of the object
193
+ def to_s
194
+ to_hash.to_s
195
+ end
196
+
197
+ # to_body is an alias to to_hash (backward compatibility)
198
+ # @return [Hash] Returns the object in the form of hash
199
+ def to_body
200
+ to_hash
201
+ end
202
+
203
+ # Returns the object in the form of hash
204
+ # @return [Hash] Returns the object in the form of hash
205
+ def to_hash
206
+ hash = {}
207
+ self.class.attribute_map.each_pair do |attr, param|
208
+ value = self.send(attr)
209
+ next if value.nil?
210
+ hash[param] = _to_hash(value)
211
+ end
212
+ hash
213
+ end
214
+
215
+ # Outputs non-array value in the form of hash
216
+ # For object, use to_hash. Otherwise, just return the value
217
+ # @param [Object] value Any valid value
218
+ # @return [Hash] Returns the value in the form of hash
219
+ def _to_hash(value)
220
+ if value.is_a?(Array)
221
+ value.compact.map{ |v| _to_hash(v) }
222
+ elsif value.is_a?(Hash)
223
+ {}.tap do |hash|
224
+ value.each { |k, v| hash[k] = _to_hash(v) }
225
+ end
226
+ elsif value.respond_to? :to_hash
227
+ value.to_hash
228
+ else
229
+ value
230
+ end
231
+ end
232
+
233
+ end
234
+
235
+ end