aylien_news_api 0.4.0 → 4.1.1

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 (160) hide show
  1. checksums.yaml +5 -5
  2. data/Gemfile +7 -1
  3. data/README.md +117 -4
  4. data/Rakefile +10 -0
  5. data/aylien_news_api.gemspec +20 -28
  6. data/docs/Author.md +12 -1
  7. data/docs/Autocomplete.md +10 -0
  8. data/docs/Autocompletes.md +9 -0
  9. data/docs/Category.md +19 -3
  10. data/docs/CategoryLinks.md +11 -1
  11. data/docs/CategoryTaxonomy.md +16 -0
  12. data/docs/Cluster.md +29 -0
  13. data/docs/Clusters.md +21 -0
  14. data/docs/Coverages.md +16 -4
  15. data/docs/DefaultApi.md +1299 -826
  16. data/docs/Entities.md +11 -1
  17. data/docs/Entity.md +16 -3
  18. data/docs/EntityLinks.md +9 -0
  19. data/docs/Error.md +16 -2
  20. data/docs/ErrorLinks.md +11 -0
  21. data/docs/Errors.md +9 -0
  22. data/docs/HistogramInterval.md +10 -0
  23. data/docs/Histograms.md +20 -3
  24. data/docs/Location.md +13 -2
  25. data/docs/Media.md +18 -4
  26. data/docs/MediaFormat.md +16 -0
  27. data/docs/MediaType.md +16 -0
  28. data/docs/Rank.md +12 -1
  29. data/docs/Rankings.md +9 -0
  30. data/docs/RelatedStories.md +18 -3
  31. data/docs/RepresentativeStory.md +23 -0
  32. data/docs/Scope.md +15 -3
  33. data/docs/ScopeLevel.md +16 -0
  34. data/docs/Sentiment.md +11 -1
  35. data/docs/SentimentPolarity.md +16 -0
  36. data/docs/Sentiments.md +12 -2
  37. data/docs/ShareCount.md +10 -0
  38. data/docs/ShareCounts.md +12 -0
  39. data/docs/Source.md +27 -8
  40. data/docs/Stories.md +17 -2
  41. data/docs/Story.md +48 -16
  42. data/docs/StoryCluster.md +14 -1
  43. data/docs/StoryLinks.md +14 -1
  44. data/docs/StoryTranslation.md +19 -0
  45. data/docs/StoryTranslations.md +17 -0
  46. data/docs/StoryTranslationsEn.md +21 -0
  47. data/docs/Summary.md +9 -0
  48. data/docs/TimeSeries.md +11 -1
  49. data/docs/TimeSeriesList.md +15 -3
  50. data/docs/Trend.md +11 -1
  51. data/docs/Trends.md +15 -1
  52. data/docs/Warning.md +21 -0
  53. data/git_push.sh +58 -0
  54. data/lib/aylien_news_api.rb +22 -14
  55. data/lib/aylien_news_api/api/default_api.rb +2407 -1520
  56. data/lib/aylien_news_api/api_client.rb +137 -111
  57. data/lib/aylien_news_api/api_error.rb +37 -18
  58. data/lib/aylien_news_api/configuration.rb +74 -36
  59. data/lib/aylien_news_api/models/author.rb +66 -50
  60. data/lib/aylien_news_api/models/autocomplete.rb +52 -36
  61. data/lib/aylien_news_api/models/autocompletes.rb +51 -35
  62. data/lib/aylien_news_api/models/category.rb +85 -94
  63. data/lib/aylien_news_api/models/category_links.rb +63 -47
  64. data/lib/aylien_news_api/models/category_taxonomy.rb +36 -0
  65. data/lib/aylien_news_api/models/cluster.rb +265 -0
  66. data/lib/aylien_news_api/models/clusters.rb +229 -0
  67. data/lib/aylien_news_api/models/coverages.rb +76 -72
  68. data/lib/aylien_news_api/models/entities.rb +64 -48
  69. data/lib/aylien_news_api/models/entity.rb +93 -79
  70. data/lib/aylien_news_api/models/entity_links.rb +51 -35
  71. data/lib/aylien_news_api/models/error.rb +76 -60
  72. data/lib/aylien_news_api/models/error_links.rb +62 -37
  73. data/lib/aylien_news_api/models/errors.rb +51 -35
  74. data/lib/aylien_news_api/models/histogram_interval.rb +52 -36
  75. data/lib/aylien_news_api/models/histograms.rb +96 -60
  76. data/lib/aylien_news_api/models/location.rb +67 -51
  77. data/lib/aylien_news_api/models/media.rb +83 -114
  78. data/lib/aylien_news_api/models/media_format.rb +44 -0
  79. data/lib/aylien_news_api/models/media_type.rb +36 -0
  80. data/lib/aylien_news_api/models/rank.rb +64 -48
  81. data/lib/aylien_news_api/models/rankings.rb +51 -35
  82. data/lib/aylien_news_api/models/related_stories.rb +84 -60
  83. data/lib/aylien_news_api/models/representative_story.rb +237 -0
  84. data/lib/aylien_news_api/models/scope.rb +73 -91
  85. data/lib/aylien_news_api/models/scope_level.rb +37 -0
  86. data/lib/aylien_news_api/models/sentiment.rb +63 -82
  87. data/lib/aylien_news_api/models/sentiment_polarity.rb +37 -0
  88. data/lib/aylien_news_api/models/sentiments.rb +62 -48
  89. data/lib/aylien_news_api/models/share_count.rb +52 -36
  90. data/lib/aylien_news_api/models/share_counts.rb +54 -38
  91. data/lib/aylien_news_api/models/source.rb +111 -96
  92. data/lib/aylien_news_api/models/stories.rb +86 -50
  93. data/lib/aylien_news_api/models/story.rb +188 -158
  94. data/lib/aylien_news_api/models/story_cluster.rb +68 -52
  95. data/lib/aylien_news_api/models/story_links.rb +70 -44
  96. data/lib/aylien_news_api/models/story_translation.rb +217 -0
  97. data/lib/aylien_news_api/models/story_translations.rb +207 -0
  98. data/lib/aylien_news_api/models/story_translations_en.rb +227 -0
  99. data/lib/aylien_news_api/models/summary.rb +51 -35
  100. data/lib/aylien_news_api/models/time_series.rb +63 -47
  101. data/lib/aylien_news_api/models/time_series_list.rb +72 -56
  102. data/lib/aylien_news_api/models/trend.rb +63 -47
  103. data/lib/aylien_news_api/models/trends.rb +77 -41
  104. data/lib/aylien_news_api/models/warning.rb +226 -0
  105. data/lib/aylien_news_api/version.rb +12 -14
  106. data/spec/api/default_api_spec.rb +620 -284
  107. data/spec/api_client_spec.rb +43 -161
  108. data/spec/configuration_spec.rb +22 -19
  109. data/spec/models/author_spec.rb +21 -34
  110. data/spec/models/autocomplete_spec.rb +17 -26
  111. data/spec/models/autocompletes_spec.rb +16 -21
  112. data/spec/models/category_links_spec.rb +19 -28
  113. data/spec/models/category_spec.rb +31 -50
  114. data/spec/models/category_taxonomy_spec.rb +35 -0
  115. data/spec/models/cluster_spec.rb +77 -0
  116. data/spec/models/clusters_spec.rb +53 -0
  117. data/spec/models/coverages_spec.rb +24 -45
  118. data/spec/models/entities_spec.rb +19 -28
  119. data/spec/models/entity_links_spec.rb +16 -21
  120. data/spec/models/entity_spec.rb +25 -46
  121. data/spec/models/error_links_spec.rb +22 -21
  122. data/spec/models/error_spec.rb +27 -52
  123. data/spec/models/errors_spec.rb +16 -21
  124. data/spec/models/histogram_interval_spec.rb +17 -26
  125. data/spec/models/histograms_spec.rb +36 -45
  126. data/spec/models/location_spec.rb +21 -34
  127. data/spec/models/media_format_spec.rb +35 -0
  128. data/spec/models/media_spec.rb +41 -26
  129. data/spec/models/media_type_spec.rb +35 -0
  130. data/spec/models/rank_spec.rb +20 -21
  131. data/spec/models/rankings_spec.rb +15 -16
  132. data/spec/models/related_stories_spec.rb +33 -38
  133. data/spec/models/representative_story_spec.rb +59 -0
  134. data/spec/models/scope_level_spec.rb +35 -0
  135. data/spec/models/scope_spec.rb +23 -40
  136. data/spec/models/sentiment_polarity_spec.rb +35 -0
  137. data/spec/models/sentiment_spec.rb +17 -26
  138. data/spec/models/sentiments_spec.rb +19 -28
  139. data/spec/models/share_count_spec.rb +17 -26
  140. data/spec/models/share_counts_spec.rb +19 -36
  141. data/spec/models/source_spec.rb +54 -49
  142. data/spec/models/stories_spec.rb +32 -33
  143. data/spec/models/story_cluster_spec.rb +23 -44
  144. data/spec/models/story_links_spec.rb +25 -32
  145. data/spec/models/story_spec.rb +65 -134
  146. data/spec/models/story_translation_spec.rb +47 -0
  147. data/spec/models/story_translations_en_spec.rb +53 -0
  148. data/spec/models/story_translations_spec.rb +41 -0
  149. data/spec/models/summary_spec.rb +16 -21
  150. data/spec/models/time_series_list_spec.rb +22 -39
  151. data/spec/models/time_series_spec.rb +19 -28
  152. data/spec/models/trend_spec.rb +19 -28
  153. data/spec/models/trends_spec.rb +30 -27
  154. data/spec/models/warning_spec.rb +53 -0
  155. data/spec/spec_helper.rb +11 -13
  156. metadata +91 -192
  157. data/Gemfile.lock +0 -65
  158. data/LICENSE +0 -13
  159. data/aylien_news_api-0.2.0.gem +0 -0
  160. data/aylien_news_api-0.3.0.gem +0 -0
@@ -1,159 +1,166 @@
1
- # Copyright 2016 Aylien, Inc. All Rights Reserved.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
1
+ =begin
2
+ #AYLIEN News API
14
3
 
15
- require 'date'
4
+ #The AYLIEN News API is the most powerful way of sourcing, searching and syndicating analyzed and enriched news content. It is accessed by sending HTTP requests to our server, which returns information to your client.
16
5
 
17
- module AylienNewsApi
6
+ The version of the OpenAPI document: 3.0
7
+ Contact: support@aylien.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.0.0-SNAPSHOT
18
10
 
19
- class Source
20
- # The source id which is a unique value
21
- attr_accessor :id
11
+ =end
22
12
 
23
- # The source name
24
- attr_accessor :name
25
-
26
- # The title of the home page URL
27
- attr_accessor :title
13
+ require 'date'
28
14
 
15
+ module AylienNewsApi
16
+ class Source
29
17
  # A general explanation about the source
30
18
  attr_accessor :description
31
19
 
32
- # The number of websites that link to the source
33
- attr_accessor :links_in_count
20
+ # The domain name of the source which is extracted from the source URL
21
+ attr_accessor :domain
34
22
 
35
23
  # The home page URL of the source
36
24
  attr_accessor :home_page_url
37
25
 
38
- # The domain name of the source which is extracted from the source URL
39
- attr_accessor :domain
26
+ # The source id which is a unique value
27
+ attr_accessor :id
40
28
 
41
- # A URL which points to the source logo
42
- attr_accessor :logo_url
29
+ # The number of websites that link to the source
30
+ attr_accessor :links_in_count
43
31
 
44
- # The source locations which are tend to be the physical locations of the source, e.g. BBC headquarter is located in London.
32
+ # The source locations which are tend to be the physical locations of the source, e.g. BBC headquarter is located in London.
45
33
  attr_accessor :locations
46
34
 
47
- # The source scopes which is tend to be scope locations of the source, e.g. BBC scopes is international.
48
- attr_accessor :scopes
35
+ # A URL which points to the source logo
36
+ attr_accessor :logo_url
37
+
38
+ # The source name
39
+ attr_accessor :name
49
40
 
50
- # The web rankings of the source
51
41
  attr_accessor :rankings
52
42
 
43
+ # The source scopes which is tend to be scope locations of the source, e.g. BBC scopes is international.
44
+ attr_accessor :scopes
45
+
46
+ # The title of the home page URL
47
+ attr_accessor :title
53
48
 
54
49
  # Attribute mapping from ruby-style variable name to JSON key.
55
50
  def self.attribute_map
56
51
  {
57
- :'id' => :'id',
58
- :'name' => :'name',
59
- :'title' => :'title',
60
52
  :'description' => :'description',
61
- :'links_in_count' => :'links_in_count',
62
- :'home_page_url' => :'home_page_url',
63
53
  :'domain' => :'domain',
64
- :'logo_url' => :'logo_url',
54
+ :'home_page_url' => :'home_page_url',
55
+ :'id' => :'id',
56
+ :'links_in_count' => :'links_in_count',
65
57
  :'locations' => :'locations',
58
+ :'logo_url' => :'logo_url',
59
+ :'name' => :'name',
60
+ :'rankings' => :'rankings',
66
61
  :'scopes' => :'scopes',
67
- :'rankings' => :'rankings'
62
+ :'title' => :'title'
68
63
  }
69
64
  end
70
65
 
71
66
  # Attribute type mapping.
72
- def self.api_types
67
+ def self.openapi_types
73
68
  {
74
- :'id' => :'Integer',
75
- :'name' => :'String',
76
- :'title' => :'String',
77
69
  :'description' => :'String',
78
- :'links_in_count' => :'Integer',
79
- :'home_page_url' => :'String',
80
70
  :'domain' => :'String',
81
- :'logo_url' => :'String',
71
+ :'home_page_url' => :'String',
72
+ :'id' => :'Integer',
73
+ :'links_in_count' => :'Integer',
82
74
  :'locations' => :'Array<Location>',
75
+ :'logo_url' => :'String',
76
+ :'name' => :'String',
77
+ :'rankings' => :'Rankings',
83
78
  :'scopes' => :'Array<Scope>',
84
- :'rankings' => :'Rankings'
79
+ :'title' => :'String'
85
80
  }
86
81
  end
87
82
 
83
+ # List of attributes with nullable: true
84
+ def self.openapi_nullable
85
+ Set.new([
86
+ ])
87
+ end
88
+
88
89
  # Initializes the object
89
90
  # @param [Hash] attributes Model attributes in the form of hash
90
91
  def initialize(attributes = {})
91
- return unless attributes.is_a?(Hash)
92
+ if (!attributes.is_a?(Hash))
93
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::Source` initialize method"
94
+ end
92
95
 
93
- # convert string to symbol for hash key
94
- attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
96
+ # check to see if the attribute exists and convert string to symbol for hash key
97
+ attributes = attributes.each_with_object({}) { |(k, v), h|
98
+ if (!self.class.attribute_map.key?(k.to_sym))
99
+ fail ArgumentError, "`#{k}` is not a valid attribute in `AylienNewsApi::Source`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
100
+ end
101
+ h[k.to_sym] = v
102
+ }
95
103
 
96
- if attributes.has_key?(:'id')
97
- self.id = attributes[:'id']
104
+ if attributes.key?(:'description')
105
+ self.description = attributes[:'description']
98
106
  end
99
107
 
100
- if attributes.has_key?(:'name')
101
- self.name = attributes[:'name']
108
+ if attributes.key?(:'domain')
109
+ self.domain = attributes[:'domain']
102
110
  end
103
111
 
104
- if attributes.has_key?(:'title')
105
- self.title = attributes[:'title']
112
+ if attributes.key?(:'home_page_url')
113
+ self.home_page_url = attributes[:'home_page_url']
106
114
  end
107
115
 
108
- if attributes.has_key?(:'description')
109
- self.description = attributes[:'description']
116
+ if attributes.key?(:'id')
117
+ self.id = attributes[:'id']
110
118
  end
111
119
 
112
- if attributes.has_key?(:'links_in_count')
120
+ if attributes.key?(:'links_in_count')
113
121
  self.links_in_count = attributes[:'links_in_count']
114
122
  end
115
123
 
116
- if attributes.has_key?(:'home_page_url')
117
- self.home_page_url = attributes[:'home_page_url']
124
+ if attributes.key?(:'locations')
125
+ if (value = attributes[:'locations']).is_a?(Array)
126
+ self.locations = value
127
+ end
118
128
  end
119
129
 
120
- if attributes.has_key?(:'domain')
121
- self.domain = attributes[:'domain']
130
+ if attributes.key?(:'logo_url')
131
+ self.logo_url = attributes[:'logo_url']
122
132
  end
123
133
 
124
- if attributes.has_key?(:'logo_url')
125
- self.logo_url = attributes[:'logo_url']
134
+ if attributes.key?(:'name')
135
+ self.name = attributes[:'name']
126
136
  end
127
137
 
128
- if attributes.has_key?(:'locations')
129
- if (value = attributes[:'locations']).is_a?(Array)
130
- self.locations = value
131
- end
138
+ if attributes.key?(:'rankings')
139
+ self.rankings = attributes[:'rankings']
132
140
  end
133
141
 
134
- if attributes.has_key?(:'scopes')
142
+ if attributes.key?(:'scopes')
135
143
  if (value = attributes[:'scopes']).is_a?(Array)
136
144
  self.scopes = value
137
145
  end
138
146
  end
139
147
 
140
- if attributes.has_key?(:'rankings')
141
- self.rankings = attributes[:'rankings']
148
+ if attributes.key?(:'title')
149
+ self.title = attributes[:'title']
142
150
  end
143
-
144
151
  end
145
152
 
146
153
  # Show invalid properties with the reasons. Usually used together with valid?
147
- # @return Array for valid properies with the reasons
154
+ # @return Array for valid properties with the reasons
148
155
  def list_invalid_properties
149
156
  invalid_properties = Array.new
150
- return invalid_properties
157
+ invalid_properties
151
158
  end
152
159
 
153
160
  # Check to see if the all the properties in the model are valid
154
161
  # @return true if the model is valid
155
162
  def valid?
156
- return true
163
+ true
157
164
  end
158
165
 
159
166
  # Checks equality by comparing each attribute.
@@ -161,17 +168,17 @@ module AylienNewsApi
161
168
  def ==(o)
162
169
  return true if self.equal?(o)
163
170
  self.class == o.class &&
164
- id == o.id &&
165
- name == o.name &&
166
- title == o.title &&
167
171
  description == o.description &&
168
- links_in_count == o.links_in_count &&
169
- home_page_url == o.home_page_url &&
170
172
  domain == o.domain &&
171
- logo_url == o.logo_url &&
173
+ home_page_url == o.home_page_url &&
174
+ id == o.id &&
175
+ links_in_count == o.links_in_count &&
172
176
  locations == o.locations &&
177
+ logo_url == o.logo_url &&
178
+ name == o.name &&
179
+ rankings == o.rankings &&
173
180
  scopes == o.scopes &&
174
- rankings == o.rankings
181
+ title == o.title
175
182
  end
176
183
 
177
184
  # @see the `==` method
@@ -181,9 +188,16 @@ module AylienNewsApi
181
188
  end
182
189
 
183
190
  # Calculates hash code according to all attributes.
184
- # @return [Fixnum] Hash code
191
+ # @return [Integer] Hash code
185
192
  def hash
186
- [id, name, title, description, links_in_count, home_page_url, domain, logo_url, locations, scopes, rankings].hash
193
+ [description, domain, home_page_url, id, links_in_count, locations, logo_url, name, rankings, scopes, title].hash
194
+ end
195
+
196
+ # Builds the object from hash
197
+ # @param [Hash] attributes Model attributes in the form of hash
198
+ # @return [Object] Returns the model itself
199
+ def self.build_from_hash(attributes)
200
+ new.build_from_hash(attributes)
187
201
  end
188
202
 
189
203
  # Builds the object from hash
@@ -191,12 +205,12 @@ module AylienNewsApi
191
205
  # @return [Object] Returns the model itself
192
206
  def build_from_hash(attributes)
193
207
  return nil unless attributes.is_a?(Hash)
194
- self.class.api_types.each_pair do |key, type|
208
+ self.class.openapi_types.each_pair do |key, type|
195
209
  if type =~ /\AArray<(.*)>/i
196
- # check to ensure the input is an array given that the the attribute
210
+ # check to ensure the input is an array given that the attribute
197
211
  # is documented as an array but the input is not
198
212
  if attributes[self.class.attribute_map[key]].is_a?(Array)
199
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
213
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
200
214
  end
201
215
  elsif !attributes[self.class.attribute_map[key]].nil?
202
216
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
@@ -222,7 +236,7 @@ module AylienNewsApi
222
236
  value.to_i
223
237
  when :Float
224
238
  value.to_f
225
- when :BOOLEAN
239
+ when :Boolean
226
240
  if value.to_s =~ /\A(true|t|yes|y|1)\z/i
227
241
  true
228
242
  else
@@ -243,8 +257,7 @@ module AylienNewsApi
243
257
  end
244
258
  end
245
259
  else # model
246
- temp_model = AylienNewsApi.const_get(type).new
247
- temp_model.build_from_hash(value)
260
+ AylienNewsApi.const_get(type).build_from_hash(value)
248
261
  end
249
262
  end
250
263
 
@@ -266,7 +279,11 @@ module AylienNewsApi
266
279
  hash = {}
267
280
  self.class.attribute_map.each_pair do |attr, param|
268
281
  value = self.send(attr)
269
- next if value.nil?
282
+ if value.nil?
283
+ is_nullable = self.class.openapi_nullable.include?(attr)
284
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
285
+ end
286
+
270
287
  hash[param] = _to_hash(value)
271
288
  end
272
289
  hash
@@ -278,7 +295,7 @@ module AylienNewsApi
278
295
  # @return [Hash] Returns the value in the form of hash
279
296
  def _to_hash(value)
280
297
  if value.is_a?(Array)
281
- value.compact.map{ |v| _to_hash(v) }
298
+ value.compact.map { |v| _to_hash(v) }
282
299
  elsif value.is_a?(Hash)
283
300
  {}.tap do |hash|
284
301
  value.each { |k, v| hash[k] = _to_hash(v) }
@@ -289,7 +306,5 @@ module AylienNewsApi
289
306
  value
290
307
  end
291
308
  end
292
-
293
309
  end
294
-
295
310
  end
@@ -1,87 +1,113 @@
1
- # Copyright 2016 Aylien, Inc. All Rights Reserved.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
1
+ =begin
2
+ #AYLIEN News API
3
+
4
+ #The AYLIEN News API is the most powerful way of sourcing, searching and syndicating analyzed and enriched news content. It is accessed by sending HTTP requests to our server, which returns information to your client.
5
+
6
+ The version of the OpenAPI document: 3.0
7
+ Contact: support@aylien.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.0.0-SNAPSHOT
10
+
11
+ =end
14
12
 
15
13
  require 'date'
16
14
 
17
15
  module AylienNewsApi
18
-
19
16
  class Stories
17
+ # The next page cursor
18
+ attr_accessor :next_page_cursor
19
+
20
20
  # An array of stories
21
21
  attr_accessor :stories
22
22
 
23
- # An array of clusters
24
- attr_accessor :clusters
23
+ # The end of a period in which searched stories were published
24
+ attr_accessor :published_at_end
25
25
 
26
- # The next page cursor
27
- attr_accessor :next_page_cursor
26
+ # The start of a period in which searched stories were published
27
+ attr_accessor :published_at_start
28
28
 
29
+ # Notifies about possible issues that occurred when searching for stories
30
+ attr_accessor :warnings
29
31
 
30
32
  # Attribute mapping from ruby-style variable name to JSON key.
31
33
  def self.attribute_map
32
34
  {
35
+ :'next_page_cursor' => :'next_page_cursor',
33
36
  :'stories' => :'stories',
34
- :'clusters' => :'clusters',
35
- :'next_page_cursor' => :'next_page_cursor'
37
+ :'published_at_end' => :'published_at.end',
38
+ :'published_at_start' => :'published_at.start',
39
+ :'warnings' => :'warnings'
36
40
  }
37
41
  end
38
42
 
39
43
  # Attribute type mapping.
40
- def self.api_types
44
+ def self.openapi_types
41
45
  {
46
+ :'next_page_cursor' => :'String',
42
47
  :'stories' => :'Array<Story>',
43
- :'clusters' => :'Array<StoryCluster>',
44
- :'next_page_cursor' => :'String'
48
+ :'published_at_end' => :'DateTime',
49
+ :'published_at_start' => :'DateTime',
50
+ :'warnings' => :'Array<Warning>'
45
51
  }
46
52
  end
47
53
 
54
+ # List of attributes with nullable: true
55
+ def self.openapi_nullable
56
+ Set.new([
57
+ ])
58
+ end
59
+
48
60
  # Initializes the object
49
61
  # @param [Hash] attributes Model attributes in the form of hash
50
62
  def initialize(attributes = {})
51
- return unless attributes.is_a?(Hash)
63
+ if (!attributes.is_a?(Hash))
64
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::Stories` initialize method"
65
+ end
52
66
 
53
- # convert string to symbol for hash key
54
- attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
67
+ # check to see if the attribute exists and convert string to symbol for hash key
68
+ attributes = attributes.each_with_object({}) { |(k, v), h|
69
+ if (!self.class.attribute_map.key?(k.to_sym))
70
+ fail ArgumentError, "`#{k}` is not a valid attribute in `AylienNewsApi::Stories`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
71
+ end
72
+ h[k.to_sym] = v
73
+ }
55
74
 
56
- if attributes.has_key?(:'stories')
75
+ if attributes.key?(:'next_page_cursor')
76
+ self.next_page_cursor = attributes[:'next_page_cursor']
77
+ end
78
+
79
+ if attributes.key?(:'stories')
57
80
  if (value = attributes[:'stories']).is_a?(Array)
58
81
  self.stories = value
59
82
  end
60
83
  end
61
84
 
62
- if attributes.has_key?(:'clusters')
63
- if (value = attributes[:'clusters']).is_a?(Array)
64
- self.clusters = value
65
- end
85
+ if attributes.key?(:'published_at_end')
86
+ self.published_at_end = attributes[:'published_at_end']
66
87
  end
67
88
 
68
- if attributes.has_key?(:'next_page_cursor')
69
- self.next_page_cursor = attributes[:'next_page_cursor']
89
+ if attributes.key?(:'published_at_start')
90
+ self.published_at_start = attributes[:'published_at_start']
70
91
  end
71
92
 
93
+ if attributes.key?(:'warnings')
94
+ if (value = attributes[:'warnings']).is_a?(Array)
95
+ self.warnings = value
96
+ end
97
+ end
72
98
  end
73
99
 
74
100
  # Show invalid properties with the reasons. Usually used together with valid?
75
- # @return Array for valid properies with the reasons
101
+ # @return Array for valid properties with the reasons
76
102
  def list_invalid_properties
77
103
  invalid_properties = Array.new
78
- return invalid_properties
104
+ invalid_properties
79
105
  end
80
106
 
81
107
  # Check to see if the all the properties in the model are valid
82
108
  # @return true if the model is valid
83
109
  def valid?
84
- return true
110
+ true
85
111
  end
86
112
 
87
113
  # Checks equality by comparing each attribute.
@@ -89,9 +115,11 @@ module AylienNewsApi
89
115
  def ==(o)
90
116
  return true if self.equal?(o)
91
117
  self.class == o.class &&
118
+ next_page_cursor == o.next_page_cursor &&
92
119
  stories == o.stories &&
93
- clusters == o.clusters &&
94
- next_page_cursor == o.next_page_cursor
120
+ published_at_end == o.published_at_end &&
121
+ published_at_start == o.published_at_start &&
122
+ warnings == o.warnings
95
123
  end
96
124
 
97
125
  # @see the `==` method
@@ -101,9 +129,16 @@ module AylienNewsApi
101
129
  end
102
130
 
103
131
  # Calculates hash code according to all attributes.
104
- # @return [Fixnum] Hash code
132
+ # @return [Integer] Hash code
105
133
  def hash
106
- [stories, clusters, next_page_cursor].hash
134
+ [next_page_cursor, stories, published_at_end, published_at_start, warnings].hash
135
+ end
136
+
137
+ # Builds the object from hash
138
+ # @param [Hash] attributes Model attributes in the form of hash
139
+ # @return [Object] Returns the model itself
140
+ def self.build_from_hash(attributes)
141
+ new.build_from_hash(attributes)
107
142
  end
108
143
 
109
144
  # Builds the object from hash
@@ -111,12 +146,12 @@ module AylienNewsApi
111
146
  # @return [Object] Returns the model itself
112
147
  def build_from_hash(attributes)
113
148
  return nil unless attributes.is_a?(Hash)
114
- self.class.api_types.each_pair do |key, type|
149
+ self.class.openapi_types.each_pair do |key, type|
115
150
  if type =~ /\AArray<(.*)>/i
116
- # check to ensure the input is an array given that the the attribute
151
+ # check to ensure the input is an array given that the attribute
117
152
  # is documented as an array but the input is not
118
153
  if attributes[self.class.attribute_map[key]].is_a?(Array)
119
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
154
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
120
155
  end
121
156
  elsif !attributes[self.class.attribute_map[key]].nil?
122
157
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
@@ -142,7 +177,7 @@ module AylienNewsApi
142
177
  value.to_i
143
178
  when :Float
144
179
  value.to_f
145
- when :BOOLEAN
180
+ when :Boolean
146
181
  if value.to_s =~ /\A(true|t|yes|y|1)\z/i
147
182
  true
148
183
  else
@@ -163,8 +198,7 @@ module AylienNewsApi
163
198
  end
164
199
  end
165
200
  else # model
166
- temp_model = AylienNewsApi.const_get(type).new
167
- temp_model.build_from_hash(value)
201
+ AylienNewsApi.const_get(type).build_from_hash(value)
168
202
  end
169
203
  end
170
204
 
@@ -186,7 +220,11 @@ module AylienNewsApi
186
220
  hash = {}
187
221
  self.class.attribute_map.each_pair do |attr, param|
188
222
  value = self.send(attr)
189
- next if value.nil?
223
+ if value.nil?
224
+ is_nullable = self.class.openapi_nullable.include?(attr)
225
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
226
+ end
227
+
190
228
  hash[param] = _to_hash(value)
191
229
  end
192
230
  hash
@@ -198,7 +236,7 @@ module AylienNewsApi
198
236
  # @return [Hash] Returns the value in the form of hash
199
237
  def _to_hash(value)
200
238
  if value.is_a?(Array)
201
- value.compact.map{ |v| _to_hash(v) }
239
+ value.compact.map { |v| _to_hash(v) }
202
240
  elsif value.is_a?(Hash)
203
241
  {}.tap do |hash|
204
242
  value.each { |k, v| hash[k] = _to_hash(v) }
@@ -209,7 +247,5 @@ module AylienNewsApi
209
247
  value
210
248
  end
211
249
  end
212
-
213
250
  end
214
-
215
251
  end