aylien_news_api 4.4.0 → 5.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. checksums.yaml +4 -4
  2. data/aylien_news_api.gemspec +1 -1
  3. data/docs/DefaultApi.md +180 -372
  4. data/docs/DeprecatedEntities.md +19 -0
  5. data/docs/DeprecatedEntity.md +33 -0
  6. data/docs/DeprecatedEntitySurfaceForm.md +21 -0
  7. data/docs/DeprecatedRelatedStories.md +27 -0
  8. data/docs/DeprecatedStories.md +25 -0
  9. data/docs/DeprecatedStory.md +61 -0
  10. data/docs/Entity.md +12 -12
  11. data/docs/EntityInText.md +19 -0
  12. data/docs/EntityMention.md +19 -0
  13. data/docs/EntityMentionIndex.md +19 -0
  14. data/docs/EntitySurfaceForm.md +3 -3
  15. data/docs/Parameter.md +12 -12
  16. data/docs/Story.md +1 -1
  17. data/lib/aylien_news_api.rb +4 -2
  18. data/lib/aylien_news_api/api/default_api.rb +254 -542
  19. data/lib/aylien_news_api/api_client.rb +1 -1
  20. data/lib/aylien_news_api/api_error.rb +1 -1
  21. data/lib/aylien_news_api/configuration.rb +1 -1
  22. data/lib/aylien_news_api/models/aggregated_sentiment.rb +1 -1
  23. data/lib/aylien_news_api/models/author.rb +1 -1
  24. data/lib/aylien_news_api/models/autocomplete.rb +1 -1
  25. data/lib/aylien_news_api/models/autocompletes.rb +1 -1
  26. data/lib/aylien_news_api/models/category.rb +1 -1
  27. data/lib/aylien_news_api/models/category_links.rb +1 -1
  28. data/lib/aylien_news_api/models/category_taxonomy.rb +1 -1
  29. data/lib/aylien_news_api/models/cluster.rb +1 -1
  30. data/lib/aylien_news_api/models/clusters.rb +1 -1
  31. data/lib/aylien_news_api/models/deprecated_entities.rb +221 -0
  32. data/lib/aylien_news_api/models/deprecated_entity.rb +314 -0
  33. data/lib/aylien_news_api/models/deprecated_entity_surface_form.rb +244 -0
  34. data/lib/aylien_news_api/models/deprecated_related_stories.rb +260 -0
  35. data/lib/aylien_news_api/models/deprecated_stories.rb +252 -0
  36. data/lib/aylien_news_api/models/deprecated_story.rb +429 -0
  37. data/lib/aylien_news_api/models/entity.rb +77 -65
  38. data/lib/aylien_news_api/models/entity_in_text.rb +217 -0
  39. data/lib/aylien_news_api/models/entity_links.rb +1 -1
  40. data/lib/aylien_news_api/models/entity_mention.rb +215 -0
  41. data/lib/aylien_news_api/models/entity_mention_index.rb +265 -0
  42. data/lib/aylien_news_api/models/entity_sentiment.rb +1 -1
  43. data/lib/aylien_news_api/models/entity_surface_form.rb +17 -17
  44. data/lib/aylien_news_api/models/error.rb +1 -1
  45. data/lib/aylien_news_api/models/error_links.rb +1 -1
  46. data/lib/aylien_news_api/models/errors.rb +1 -1
  47. data/lib/aylien_news_api/models/histogram_interval.rb +1 -1
  48. data/lib/aylien_news_api/models/histograms.rb +1 -1
  49. data/lib/aylien_news_api/models/location.rb +1 -1
  50. data/lib/aylien_news_api/models/logicals.rb +1 -1
  51. data/lib/aylien_news_api/models/media.rb +1 -1
  52. data/lib/aylien_news_api/models/media_format.rb +1 -1
  53. data/lib/aylien_news_api/models/media_type.rb +1 -1
  54. data/lib/aylien_news_api/models/nested_entity.rb +1 -1
  55. data/lib/aylien_news_api/models/parameter.rb +38 -38
  56. data/lib/aylien_news_api/models/query.rb +1 -1
  57. data/lib/aylien_news_api/models/rank.rb +1 -1
  58. data/lib/aylien_news_api/models/rankings.rb +1 -1
  59. data/lib/aylien_news_api/models/related_stories.rb +2 -1
  60. data/lib/aylien_news_api/models/representative_story.rb +1 -1
  61. data/lib/aylien_news_api/models/scope.rb +1 -1
  62. data/lib/aylien_news_api/models/scope_level.rb +1 -1
  63. data/lib/aylien_news_api/models/sentiment.rb +1 -1
  64. data/lib/aylien_news_api/models/sentiment_polarity.rb +1 -1
  65. data/lib/aylien_news_api/models/sentiments.rb +1 -1
  66. data/lib/aylien_news_api/models/share_count.rb +1 -1
  67. data/lib/aylien_news_api/models/share_counts.rb +1 -1
  68. data/lib/aylien_news_api/models/source.rb +1 -1
  69. data/lib/aylien_news_api/models/stories.rb +2 -1
  70. data/lib/aylien_news_api/models/story.rb +6 -3
  71. data/lib/aylien_news_api/models/story_cluster.rb +1 -1
  72. data/lib/aylien_news_api/models/story_links.rb +1 -1
  73. data/lib/aylien_news_api/models/story_translation.rb +1 -1
  74. data/lib/aylien_news_api/models/story_translations.rb +1 -1
  75. data/lib/aylien_news_api/models/summary.rb +1 -1
  76. data/lib/aylien_news_api/models/time_series.rb +1 -1
  77. data/lib/aylien_news_api/models/time_series_list.rb +1 -1
  78. data/lib/aylien_news_api/models/trend.rb +1 -1
  79. data/lib/aylien_news_api/models/trends.rb +1 -1
  80. data/lib/aylien_news_api/models/warning.rb +1 -1
  81. data/lib/aylien_news_api/version.rb +2 -2
  82. data/spec/api/default_api_spec.rb +103 -187
  83. data/spec/api_client_spec.rb +1 -1
  84. data/spec/configuration_spec.rb +1 -1
  85. data/spec/models/aggregated_sentiment_spec.rb +1 -1
  86. data/spec/models/author_spec.rb +1 -1
  87. data/spec/models/autocomplete_spec.rb +1 -1
  88. data/spec/models/autocompletes_spec.rb +1 -1
  89. data/spec/models/category_links_spec.rb +1 -1
  90. data/spec/models/category_spec.rb +1 -1
  91. data/spec/models/category_taxonomy_spec.rb +1 -1
  92. data/spec/models/cluster_spec.rb +1 -1
  93. data/spec/models/clusters_spec.rb +1 -1
  94. data/spec/models/deprecated_entities_spec.rb +47 -0
  95. data/spec/models/deprecated_entity_spec.rb +89 -0
  96. data/spec/models/deprecated_entity_surface_form_spec.rb +53 -0
  97. data/spec/models/deprecated_related_stories_spec.rb +71 -0
  98. data/spec/models/deprecated_stories_spec.rb +65 -0
  99. data/spec/models/deprecated_story_spec.rb +173 -0
  100. data/spec/models/entity_in_text_spec.rb +47 -0
  101. data/spec/models/entity_links_spec.rb +1 -1
  102. data/spec/models/entity_mention_index_spec.rb +47 -0
  103. data/spec/models/entity_mention_spec.rb +47 -0
  104. data/spec/models/entity_sentiment_spec.rb +1 -1
  105. data/spec/models/entity_spec.rb +9 -9
  106. data/spec/models/entity_surface_form_spec.rb +3 -3
  107. data/spec/models/error_links_spec.rb +1 -1
  108. data/spec/models/error_spec.rb +1 -1
  109. data/spec/models/errors_spec.rb +1 -1
  110. data/spec/models/histogram_interval_spec.rb +1 -1
  111. data/spec/models/histograms_spec.rb +1 -1
  112. data/spec/models/location_spec.rb +1 -1
  113. data/spec/models/logicals_spec.rb +1 -1
  114. data/spec/models/media_format_spec.rb +1 -1
  115. data/spec/models/media_spec.rb +1 -1
  116. data/spec/models/media_type_spec.rb +1 -1
  117. data/spec/models/nested_entity_spec.rb +1 -1
  118. data/spec/models/parameter_spec.rb +7 -7
  119. data/spec/models/query_spec.rb +1 -1
  120. data/spec/models/rank_spec.rb +1 -1
  121. data/spec/models/rankings_spec.rb +1 -1
  122. data/spec/models/related_stories_spec.rb +1 -1
  123. data/spec/models/representative_story_spec.rb +1 -1
  124. data/spec/models/scope_level_spec.rb +1 -1
  125. data/spec/models/scope_spec.rb +1 -1
  126. data/spec/models/sentiment_polarity_spec.rb +1 -1
  127. data/spec/models/sentiment_spec.rb +1 -1
  128. data/spec/models/sentiments_spec.rb +1 -1
  129. data/spec/models/share_count_spec.rb +1 -1
  130. data/spec/models/share_counts_spec.rb +1 -1
  131. data/spec/models/source_spec.rb +1 -1
  132. data/spec/models/stories_spec.rb +1 -1
  133. data/spec/models/story_cluster_spec.rb +1 -1
  134. data/spec/models/story_links_spec.rb +1 -1
  135. data/spec/models/story_spec.rb +1 -1
  136. data/spec/models/story_translation_spec.rb +1 -1
  137. data/spec/models/story_translations_spec.rb +1 -1
  138. data/spec/models/summary_spec.rb +1 -1
  139. data/spec/models/time_series_list_spec.rb +1 -1
  140. data/spec/models/time_series_spec.rb +1 -1
  141. data/spec/models/trend_spec.rb +1 -1
  142. data/spec/models/trends_spec.rb +1 -1
  143. data/spec/models/warning_spec.rb +1 -1
  144. data/spec/spec_helper.rb +1 -1
  145. metadata +38 -2
@@ -0,0 +1,252 @@
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
12
+
13
+ require 'date'
14
+
15
+ module AylienNewsApi
16
+ # Stories containing deprecated entities
17
+ class DeprecatedStories
18
+ # The next page cursor
19
+ attr_accessor :next_page_cursor
20
+
21
+ # An array of stories
22
+ attr_accessor :stories
23
+
24
+ # The end of a period in which searched stories were published
25
+ attr_accessor :published_at_end
26
+
27
+ # The start of a period in which searched stories were published
28
+ attr_accessor :published_at_start
29
+
30
+ # Notifies about possible issues that occurred when searching for stories
31
+ attr_accessor :warnings
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'next_page_cursor' => :'next_page_cursor',
37
+ :'stories' => :'stories',
38
+ :'published_at_end' => :'published_at.end',
39
+ :'published_at_start' => :'published_at.start',
40
+ :'warnings' => :'warnings'
41
+ }
42
+ end
43
+
44
+ # Attribute type mapping.
45
+ def self.openapi_types
46
+ {
47
+ :'next_page_cursor' => :'String',
48
+ :'stories' => :'Array<DeprecatedStory>',
49
+ :'published_at_end' => :'DateTime',
50
+ :'published_at_start' => :'DateTime',
51
+ :'warnings' => :'Array<Warning>'
52
+ }
53
+ end
54
+
55
+ # List of attributes with nullable: true
56
+ def self.openapi_nullable
57
+ Set.new([
58
+ ])
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ if (!attributes.is_a?(Hash))
65
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::DeprecatedStories` initialize method"
66
+ end
67
+
68
+ # check to see if the attribute exists and convert string to symbol for hash key
69
+ attributes = attributes.each_with_object({}) { |(k, v), h|
70
+ if (!self.class.attribute_map.key?(k.to_sym))
71
+ fail ArgumentError, "`#{k}` is not a valid attribute in `AylienNewsApi::DeprecatedStories`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
72
+ end
73
+ h[k.to_sym] = v
74
+ }
75
+
76
+ if attributes.key?(:'next_page_cursor')
77
+ self.next_page_cursor = attributes[:'next_page_cursor']
78
+ end
79
+
80
+ if attributes.key?(:'stories')
81
+ if (value = attributes[:'stories']).is_a?(Array)
82
+ self.stories = value
83
+ end
84
+ end
85
+
86
+ if attributes.key?(:'published_at_end')
87
+ self.published_at_end = attributes[:'published_at_end']
88
+ end
89
+
90
+ if attributes.key?(:'published_at_start')
91
+ self.published_at_start = attributes[:'published_at_start']
92
+ end
93
+
94
+ if attributes.key?(:'warnings')
95
+ if (value = attributes[:'warnings']).is_a?(Array)
96
+ self.warnings = value
97
+ end
98
+ end
99
+ end
100
+
101
+ # Show invalid properties with the reasons. Usually used together with valid?
102
+ # @return Array for valid properties with the reasons
103
+ def list_invalid_properties
104
+ invalid_properties = Array.new
105
+ invalid_properties
106
+ end
107
+
108
+ # Check to see if the all the properties in the model are valid
109
+ # @return true if the model is valid
110
+ def valid?
111
+ true
112
+ end
113
+
114
+ # Checks equality by comparing each attribute.
115
+ # @param [Object] Object to be compared
116
+ def ==(o)
117
+ return true if self.equal?(o)
118
+ self.class == o.class &&
119
+ next_page_cursor == o.next_page_cursor &&
120
+ stories == o.stories &&
121
+ published_at_end == o.published_at_end &&
122
+ published_at_start == o.published_at_start &&
123
+ warnings == o.warnings
124
+ end
125
+
126
+ # @see the `==` method
127
+ # @param [Object] Object to be compared
128
+ def eql?(o)
129
+ self == o
130
+ end
131
+
132
+ # Calculates hash code according to all attributes.
133
+ # @return [Integer] Hash code
134
+ def hash
135
+ [next_page_cursor, stories, published_at_end, published_at_start, warnings].hash
136
+ end
137
+
138
+ # Builds the object from hash
139
+ # @param [Hash] attributes Model attributes in the form of hash
140
+ # @return [Object] Returns the model itself
141
+ def self.build_from_hash(attributes)
142
+ new.build_from_hash(attributes)
143
+ end
144
+
145
+ # Builds the object from hash
146
+ # @param [Hash] attributes Model attributes in the form of hash
147
+ # @return [Object] Returns the model itself
148
+ def build_from_hash(attributes)
149
+ return nil unless attributes.is_a?(Hash)
150
+ self.class.openapi_types.each_pair do |key, type|
151
+ if type =~ /\AArray<(.*)>/i
152
+ # check to ensure the input is an array given that the attribute
153
+ # is documented as an array but the input is not
154
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
155
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
156
+ end
157
+ elsif !attributes[self.class.attribute_map[key]].nil?
158
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
159
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
160
+ end
161
+
162
+ self
163
+ end
164
+
165
+ # Deserializes the data based on type
166
+ # @param string type Data type
167
+ # @param string value Value to be deserialized
168
+ # @return [Object] Deserialized data
169
+ def _deserialize(type, value)
170
+ case type.to_sym
171
+ when :DateTime
172
+ DateTime.parse(value)
173
+ when :Date
174
+ Date.parse(value)
175
+ when :String
176
+ value.to_s
177
+ when :Integer
178
+ value.to_i
179
+ when :Float
180
+ value.to_f
181
+ when :Boolean
182
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
183
+ true
184
+ else
185
+ false
186
+ end
187
+ when :Object
188
+ # generic object (usually a Hash), return directly
189
+ value
190
+ when /\AArray<(?<inner_type>.+)>\z/
191
+ inner_type = Regexp.last_match[:inner_type]
192
+ value.map { |v| _deserialize(inner_type, v) }
193
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
194
+ k_type = Regexp.last_match[:k_type]
195
+ v_type = Regexp.last_match[:v_type]
196
+ {}.tap do |hash|
197
+ value.each do |k, v|
198
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
199
+ end
200
+ end
201
+ else # model
202
+ AylienNewsApi.const_get(type).build_from_hash(value)
203
+ end
204
+ end
205
+
206
+ # Returns the string representation of the object
207
+ # @return [String] String presentation of the object
208
+ def to_s
209
+ to_hash.to_s
210
+ end
211
+
212
+ # to_body is an alias to to_hash (backward compatibility)
213
+ # @return [Hash] Returns the object in the form of hash
214
+ def to_body
215
+ to_hash
216
+ end
217
+
218
+ # Returns the object in the form of hash
219
+ # @return [Hash] Returns the object in the form of hash
220
+ def to_hash
221
+ hash = {}
222
+ self.class.attribute_map.each_pair do |attr, param|
223
+ value = self.send(attr)
224
+ if value.nil?
225
+ is_nullable = self.class.openapi_nullable.include?(attr)
226
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
227
+ end
228
+
229
+ hash[param] = _to_hash(value)
230
+ end
231
+ hash
232
+ end
233
+
234
+ # Outputs non-array value in the form of hash
235
+ # For object, use to_hash. Otherwise, just return the value
236
+ # @param [Object] value Any valid value
237
+ # @return [Hash] Returns the value in the form of hash
238
+ def _to_hash(value)
239
+ if value.is_a?(Array)
240
+ value.compact.map { |v| _to_hash(v) }
241
+ elsif value.is_a?(Hash)
242
+ {}.tap do |hash|
243
+ value.each { |k, v| hash[k] = _to_hash(v) }
244
+ end
245
+ elsif value.respond_to? :to_hash
246
+ value.to_hash
247
+ else
248
+ value
249
+ end
250
+ end
251
+ end
252
+ end
@@ -0,0 +1,429 @@
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
12
+
13
+ require 'date'
14
+
15
+ module AylienNewsApi
16
+ class DeprecatedStory
17
+ attr_accessor :author
18
+
19
+ # Body of the story
20
+ attr_accessor :body
21
+
22
+ # Suggested categories for the story
23
+ attr_accessor :categories
24
+
25
+ # Character count of the story body
26
+ attr_accessor :characters_count
27
+
28
+ # An array of clusters the story is associated with
29
+ attr_accessor :clusters
30
+
31
+ attr_accessor :entities
32
+
33
+ # An array of suggested Story hashtags
34
+ attr_accessor :hashtags
35
+
36
+ # ID of the story which is a unique identification
37
+ attr_accessor :id
38
+
39
+ # Extracted keywords mentioned in the story title or body
40
+ attr_accessor :keywords
41
+
42
+ # Language of the story
43
+ attr_accessor :language
44
+
45
+ attr_accessor :links
46
+
47
+ # An array of extracted media such as images and videos
48
+ attr_accessor :media
49
+
50
+ # Paragraph count of the story body
51
+ attr_accessor :paragraphs_count
52
+
53
+ # Published date of the story
54
+ attr_accessor :published_at
55
+
56
+ # Sentence count of the story body
57
+ attr_accessor :sentences_count
58
+
59
+ attr_accessor :sentiment
60
+
61
+ attr_accessor :social_shares_count
62
+
63
+ attr_accessor :source
64
+
65
+ attr_accessor :summary
66
+
67
+ # Title of the story
68
+ attr_accessor :title
69
+
70
+ attr_accessor :translations
71
+
72
+ # Word count of the story body
73
+ attr_accessor :words_count
74
+
75
+ # License type of the story
76
+ attr_accessor :license_type
77
+
78
+ # Attribute mapping from ruby-style variable name to JSON key.
79
+ def self.attribute_map
80
+ {
81
+ :'author' => :'author',
82
+ :'body' => :'body',
83
+ :'categories' => :'categories',
84
+ :'characters_count' => :'characters_count',
85
+ :'clusters' => :'clusters',
86
+ :'entities' => :'entities',
87
+ :'hashtags' => :'hashtags',
88
+ :'id' => :'id',
89
+ :'keywords' => :'keywords',
90
+ :'language' => :'language',
91
+ :'links' => :'links',
92
+ :'media' => :'media',
93
+ :'paragraphs_count' => :'paragraphs_count',
94
+ :'published_at' => :'published_at',
95
+ :'sentences_count' => :'sentences_count',
96
+ :'sentiment' => :'sentiment',
97
+ :'social_shares_count' => :'social_shares_count',
98
+ :'source' => :'source',
99
+ :'summary' => :'summary',
100
+ :'title' => :'title',
101
+ :'translations' => :'translations',
102
+ :'words_count' => :'words_count',
103
+ :'license_type' => :'license_type'
104
+ }
105
+ end
106
+
107
+ # Attribute type mapping.
108
+ def self.openapi_types
109
+ {
110
+ :'author' => :'Author',
111
+ :'body' => :'String',
112
+ :'categories' => :'Array<Category>',
113
+ :'characters_count' => :'Integer',
114
+ :'clusters' => :'Array<Integer>',
115
+ :'entities' => :'DeprecatedEntities',
116
+ :'hashtags' => :'Array<String>',
117
+ :'id' => :'Integer',
118
+ :'keywords' => :'Array<String>',
119
+ :'language' => :'String',
120
+ :'links' => :'StoryLinks',
121
+ :'media' => :'Array<Media>',
122
+ :'paragraphs_count' => :'Integer',
123
+ :'published_at' => :'DateTime',
124
+ :'sentences_count' => :'Integer',
125
+ :'sentiment' => :'Sentiments',
126
+ :'social_shares_count' => :'ShareCounts',
127
+ :'source' => :'Source',
128
+ :'summary' => :'Summary',
129
+ :'title' => :'String',
130
+ :'translations' => :'StoryTranslations',
131
+ :'words_count' => :'Integer',
132
+ :'license_type' => :'Integer'
133
+ }
134
+ end
135
+
136
+ # List of attributes with nullable: true
137
+ def self.openapi_nullable
138
+ Set.new([
139
+ ])
140
+ end
141
+
142
+ # Initializes the object
143
+ # @param [Hash] attributes Model attributes in the form of hash
144
+ def initialize(attributes = {})
145
+ if (!attributes.is_a?(Hash))
146
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::DeprecatedStory` initialize method"
147
+ end
148
+
149
+ # check to see if the attribute exists and convert string to symbol for hash key
150
+ attributes = attributes.each_with_object({}) { |(k, v), h|
151
+ if (!self.class.attribute_map.key?(k.to_sym))
152
+ fail ArgumentError, "`#{k}` is not a valid attribute in `AylienNewsApi::DeprecatedStory`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
153
+ end
154
+ h[k.to_sym] = v
155
+ }
156
+
157
+ if attributes.key?(:'author')
158
+ self.author = attributes[:'author']
159
+ end
160
+
161
+ if attributes.key?(:'body')
162
+ self.body = attributes[:'body']
163
+ end
164
+
165
+ if attributes.key?(:'categories')
166
+ if (value = attributes[:'categories']).is_a?(Array)
167
+ self.categories = value
168
+ end
169
+ end
170
+
171
+ if attributes.key?(:'characters_count')
172
+ self.characters_count = attributes[:'characters_count']
173
+ end
174
+
175
+ if attributes.key?(:'clusters')
176
+ if (value = attributes[:'clusters']).is_a?(Array)
177
+ self.clusters = value
178
+ end
179
+ end
180
+
181
+ if attributes.key?(:'entities')
182
+ self.entities = attributes[:'entities']
183
+ end
184
+
185
+ if attributes.key?(:'hashtags')
186
+ if (value = attributes[:'hashtags']).is_a?(Array)
187
+ self.hashtags = value
188
+ end
189
+ end
190
+
191
+ if attributes.key?(:'id')
192
+ self.id = attributes[:'id']
193
+ end
194
+
195
+ if attributes.key?(:'keywords')
196
+ if (value = attributes[:'keywords']).is_a?(Array)
197
+ self.keywords = value
198
+ end
199
+ end
200
+
201
+ if attributes.key?(:'language')
202
+ self.language = attributes[:'language']
203
+ end
204
+
205
+ if attributes.key?(:'links')
206
+ self.links = attributes[:'links']
207
+ end
208
+
209
+ if attributes.key?(:'media')
210
+ if (value = attributes[:'media']).is_a?(Array)
211
+ self.media = value
212
+ end
213
+ end
214
+
215
+ if attributes.key?(:'paragraphs_count')
216
+ self.paragraphs_count = attributes[:'paragraphs_count']
217
+ end
218
+
219
+ if attributes.key?(:'published_at')
220
+ self.published_at = attributes[:'published_at']
221
+ end
222
+
223
+ if attributes.key?(:'sentences_count')
224
+ self.sentences_count = attributes[:'sentences_count']
225
+ end
226
+
227
+ if attributes.key?(:'sentiment')
228
+ self.sentiment = attributes[:'sentiment']
229
+ end
230
+
231
+ if attributes.key?(:'social_shares_count')
232
+ self.social_shares_count = attributes[:'social_shares_count']
233
+ end
234
+
235
+ if attributes.key?(:'source')
236
+ self.source = attributes[:'source']
237
+ end
238
+
239
+ if attributes.key?(:'summary')
240
+ self.summary = attributes[:'summary']
241
+ end
242
+
243
+ if attributes.key?(:'title')
244
+ self.title = attributes[:'title']
245
+ end
246
+
247
+ if attributes.key?(:'translations')
248
+ self.translations = attributes[:'translations']
249
+ end
250
+
251
+ if attributes.key?(:'words_count')
252
+ self.words_count = attributes[:'words_count']
253
+ end
254
+
255
+ if attributes.key?(:'license_type')
256
+ self.license_type = attributes[:'license_type']
257
+ end
258
+ end
259
+
260
+ # Show invalid properties with the reasons. Usually used together with valid?
261
+ # @return Array for valid properties with the reasons
262
+ def list_invalid_properties
263
+ invalid_properties = Array.new
264
+ invalid_properties
265
+ end
266
+
267
+ # Check to see if the all the properties in the model are valid
268
+ # @return true if the model is valid
269
+ def valid?
270
+ true
271
+ end
272
+
273
+ # Checks equality by comparing each attribute.
274
+ # @param [Object] Object to be compared
275
+ def ==(o)
276
+ return true if self.equal?(o)
277
+ self.class == o.class &&
278
+ author == o.author &&
279
+ body == o.body &&
280
+ categories == o.categories &&
281
+ characters_count == o.characters_count &&
282
+ clusters == o.clusters &&
283
+ entities == o.entities &&
284
+ hashtags == o.hashtags &&
285
+ id == o.id &&
286
+ keywords == o.keywords &&
287
+ language == o.language &&
288
+ links == o.links &&
289
+ media == o.media &&
290
+ paragraphs_count == o.paragraphs_count &&
291
+ published_at == o.published_at &&
292
+ sentences_count == o.sentences_count &&
293
+ sentiment == o.sentiment &&
294
+ social_shares_count == o.social_shares_count &&
295
+ source == o.source &&
296
+ summary == o.summary &&
297
+ title == o.title &&
298
+ translations == o.translations &&
299
+ words_count == o.words_count &&
300
+ license_type == o.license_type
301
+ end
302
+
303
+ # @see the `==` method
304
+ # @param [Object] Object to be compared
305
+ def eql?(o)
306
+ self == o
307
+ end
308
+
309
+ # Calculates hash code according to all attributes.
310
+ # @return [Integer] Hash code
311
+ def hash
312
+ [author, body, categories, characters_count, clusters, entities, hashtags, id, keywords, language, links, media, paragraphs_count, published_at, sentences_count, sentiment, social_shares_count, source, summary, title, translations, words_count, license_type].hash
313
+ end
314
+
315
+ # Builds the object from hash
316
+ # @param [Hash] attributes Model attributes in the form of hash
317
+ # @return [Object] Returns the model itself
318
+ def self.build_from_hash(attributes)
319
+ new.build_from_hash(attributes)
320
+ end
321
+
322
+ # Builds the object from hash
323
+ # @param [Hash] attributes Model attributes in the form of hash
324
+ # @return [Object] Returns the model itself
325
+ def build_from_hash(attributes)
326
+ return nil unless attributes.is_a?(Hash)
327
+ self.class.openapi_types.each_pair do |key, type|
328
+ if type =~ /\AArray<(.*)>/i
329
+ # check to ensure the input is an array given that the attribute
330
+ # is documented as an array but the input is not
331
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
332
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
333
+ end
334
+ elsif !attributes[self.class.attribute_map[key]].nil?
335
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
336
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
337
+ end
338
+
339
+ self
340
+ end
341
+
342
+ # Deserializes the data based on type
343
+ # @param string type Data type
344
+ # @param string value Value to be deserialized
345
+ # @return [Object] Deserialized data
346
+ def _deserialize(type, value)
347
+ case type.to_sym
348
+ when :DateTime
349
+ DateTime.parse(value)
350
+ when :Date
351
+ Date.parse(value)
352
+ when :String
353
+ value.to_s
354
+ when :Integer
355
+ value.to_i
356
+ when :Float
357
+ value.to_f
358
+ when :Boolean
359
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
360
+ true
361
+ else
362
+ false
363
+ end
364
+ when :Object
365
+ # generic object (usually a Hash), return directly
366
+ value
367
+ when /\AArray<(?<inner_type>.+)>\z/
368
+ inner_type = Regexp.last_match[:inner_type]
369
+ value.map { |v| _deserialize(inner_type, v) }
370
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
371
+ k_type = Regexp.last_match[:k_type]
372
+ v_type = Regexp.last_match[:v_type]
373
+ {}.tap do |hash|
374
+ value.each do |k, v|
375
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
376
+ end
377
+ end
378
+ else # model
379
+ AylienNewsApi.const_get(type).build_from_hash(value)
380
+ end
381
+ end
382
+
383
+ # Returns the string representation of the object
384
+ # @return [String] String presentation of the object
385
+ def to_s
386
+ to_hash.to_s
387
+ end
388
+
389
+ # to_body is an alias to to_hash (backward compatibility)
390
+ # @return [Hash] Returns the object in the form of hash
391
+ def to_body
392
+ to_hash
393
+ end
394
+
395
+ # Returns the object in the form of hash
396
+ # @return [Hash] Returns the object in the form of hash
397
+ def to_hash
398
+ hash = {}
399
+ self.class.attribute_map.each_pair do |attr, param|
400
+ value = self.send(attr)
401
+ if value.nil?
402
+ is_nullable = self.class.openapi_nullable.include?(attr)
403
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
404
+ end
405
+
406
+ hash[param] = _to_hash(value)
407
+ end
408
+ hash
409
+ end
410
+
411
+ # Outputs non-array value in the form of hash
412
+ # For object, use to_hash. Otherwise, just return the value
413
+ # @param [Object] value Any valid value
414
+ # @return [Hash] Returns the value in the form of hash
415
+ def _to_hash(value)
416
+ if value.is_a?(Array)
417
+ value.compact.map { |v| _to_hash(v) }
418
+ elsif value.is_a?(Hash)
419
+ {}.tap do |hash|
420
+ value.each { |k, v| hash[k] = _to_hash(v) }
421
+ end
422
+ elsif value.respond_to? :to_hash
423
+ value.to_hash
424
+ else
425
+ value
426
+ end
427
+ end
428
+ end
429
+ end