aylien_news_api 4.0.0 → 4.4.0

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 (55) hide show
  1. checksums.yaml +4 -4
  2. data/docs/AggregatedSentiment.md +21 -0
  3. data/docs/DefaultApi.md +353 -1
  4. data/docs/Entity.md +13 -5
  5. data/docs/EntityLinks.md +6 -2
  6. data/docs/EntitySentiment.md +19 -0
  7. data/docs/EntitySurfaceForm.md +21 -0
  8. data/docs/ErrorLinks.md +3 -1
  9. data/docs/Logicals.md +21 -0
  10. data/docs/NestedEntity.md +33 -0
  11. data/docs/Parameter.md +127 -0
  12. data/docs/Query.md +31 -0
  13. data/docs/RelatedStories.md +5 -1
  14. data/docs/Stories.md +3 -1
  15. data/docs/Story.md +3 -1
  16. data/docs/TimeSeries.md +3 -1
  17. data/docs/Trend.md +3 -1
  18. data/docs/Warning.md +21 -0
  19. data/lib/aylien_news_api.rb +8 -0
  20. data/lib/aylien_news_api/api/default_api.rb +521 -2
  21. data/lib/aylien_news_api/models/aggregated_sentiment.rb +228 -0
  22. data/lib/aylien_news_api/models/entity.rb +68 -28
  23. data/lib/aylien_news_api/models/entity_links.rb +25 -5
  24. data/lib/aylien_news_api/models/entity_sentiment.rb +240 -0
  25. data/lib/aylien_news_api/models/entity_surface_form.rb +244 -0
  26. data/lib/aylien_news_api/models/error_links.rb +13 -4
  27. data/lib/aylien_news_api/models/logicals.rb +230 -0
  28. data/lib/aylien_news_api/models/nested_entity.rb +278 -0
  29. data/lib/aylien_news_api/models/parameter.rb +701 -0
  30. data/lib/aylien_news_api/models/query.rb +271 -0
  31. data/lib/aylien_news_api/models/related_stories.rb +24 -4
  32. data/lib/aylien_news_api/models/stories.rb +16 -4
  33. data/lib/aylien_news_api/models/story.rb +14 -4
  34. data/lib/aylien_news_api/models/time_series.rb +13 -4
  35. data/lib/aylien_news_api/models/trend.rb +13 -4
  36. data/lib/aylien_news_api/models/warning.rb +226 -0
  37. data/lib/aylien_news_api/version.rb +1 -1
  38. data/spec/api/default_api_spec.rb +145 -0
  39. data/spec/models/aggregated_sentiment_spec.rb +53 -0
  40. data/spec/models/entity_links_spec.rb +12 -0
  41. data/spec/models/entity_sentiment_spec.rb +47 -0
  42. data/spec/models/entity_spec.rb +26 -2
  43. data/spec/models/entity_surface_form_spec.rb +53 -0
  44. data/spec/models/error_links_spec.rb +6 -0
  45. data/spec/models/logicals_spec.rb +53 -0
  46. data/spec/models/nested_entity_spec.rb +89 -0
  47. data/spec/models/parameter_spec.rb +371 -0
  48. data/spec/models/query_spec.rb +83 -0
  49. data/spec/models/related_stories_spec.rb +12 -0
  50. data/spec/models/stories_spec.rb +6 -0
  51. data/spec/models/story_spec.rb +6 -0
  52. data/spec/models/time_series_spec.rb +6 -0
  53. data/spec/models/trend_spec.rb +6 -0
  54. data/spec/models/warning_spec.rb +53 -0
  55. metadata +34 -2
@@ -0,0 +1,271 @@
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 Query
17
+ attr_accessor :eq
18
+
19
+ attr_accessor :text
20
+
21
+ attr_accessor :_in
22
+
23
+ attr_accessor :gt
24
+
25
+ attr_accessor :gte
26
+
27
+ attr_accessor :lt
28
+
29
+ attr_accessor :lte
30
+
31
+ attr_accessor :boost
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'eq' => :'$eq',
37
+ :'text' => :'$text',
38
+ :'_in' => :'$in',
39
+ :'gt' => :'$gt',
40
+ :'gte' => :'$gte',
41
+ :'lt' => :'$lt',
42
+ :'lte' => :'$lte',
43
+ :'boost' => :'$boost'
44
+ }
45
+ end
46
+
47
+ # Attribute type mapping.
48
+ def self.openapi_types
49
+ {
50
+ :'eq' => :'OneOfstringnumber',
51
+ :'text' => :'OneOfstringnumber',
52
+ :'_in' => :'Array<OneOfstringnumber>',
53
+ :'gt' => :'Float',
54
+ :'gte' => :'Float',
55
+ :'lt' => :'Float',
56
+ :'lte' => :'Float',
57
+ :'boost' => :'Float'
58
+ }
59
+ end
60
+
61
+ # List of attributes with nullable: true
62
+ def self.openapi_nullable
63
+ Set.new([
64
+ ])
65
+ end
66
+
67
+ # Initializes the object
68
+ # @param [Hash] attributes Model attributes in the form of hash
69
+ def initialize(attributes = {})
70
+ if (!attributes.is_a?(Hash))
71
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::Query` initialize method"
72
+ end
73
+
74
+ # check to see if the attribute exists and convert string to symbol for hash key
75
+ attributes = attributes.each_with_object({}) { |(k, v), h|
76
+ if (!self.class.attribute_map.key?(k.to_sym))
77
+ fail ArgumentError, "`#{k}` is not a valid attribute in `AylienNewsApi::Query`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
78
+ end
79
+ h[k.to_sym] = v
80
+ }
81
+
82
+ if attributes.key?(:'eq')
83
+ self.eq = attributes[:'eq']
84
+ end
85
+
86
+ if attributes.key?(:'text')
87
+ self.text = attributes[:'text']
88
+ end
89
+
90
+ if attributes.key?(:'_in')
91
+ if (value = attributes[:'_in']).is_a?(Array)
92
+ self._in = value
93
+ end
94
+ end
95
+
96
+ if attributes.key?(:'gt')
97
+ self.gt = attributes[:'gt']
98
+ end
99
+
100
+ if attributes.key?(:'gte')
101
+ self.gte = attributes[:'gte']
102
+ end
103
+
104
+ if attributes.key?(:'lt')
105
+ self.lt = attributes[:'lt']
106
+ end
107
+
108
+ if attributes.key?(:'lte')
109
+ self.lte = attributes[:'lte']
110
+ end
111
+
112
+ if attributes.key?(:'boost')
113
+ self.boost = attributes[:'boost']
114
+ end
115
+ end
116
+
117
+ # Show invalid properties with the reasons. Usually used together with valid?
118
+ # @return Array for valid properties with the reasons
119
+ def list_invalid_properties
120
+ invalid_properties = Array.new
121
+ invalid_properties
122
+ end
123
+
124
+ # Check to see if the all the properties in the model are valid
125
+ # @return true if the model is valid
126
+ def valid?
127
+ true
128
+ end
129
+
130
+ # Checks equality by comparing each attribute.
131
+ # @param [Object] Object to be compared
132
+ def ==(o)
133
+ return true if self.equal?(o)
134
+ self.class == o.class &&
135
+ eq == o.eq &&
136
+ text == o.text &&
137
+ _in == o._in &&
138
+ gt == o.gt &&
139
+ gte == o.gte &&
140
+ lt == o.lt &&
141
+ lte == o.lte &&
142
+ boost == o.boost
143
+ end
144
+
145
+ # @see the `==` method
146
+ # @param [Object] Object to be compared
147
+ def eql?(o)
148
+ self == o
149
+ end
150
+
151
+ # Calculates hash code according to all attributes.
152
+ # @return [Integer] Hash code
153
+ def hash
154
+ [eq, text, _in, gt, gte, lt, lte, boost].hash
155
+ end
156
+
157
+ # Builds the object from hash
158
+ # @param [Hash] attributes Model attributes in the form of hash
159
+ # @return [Object] Returns the model itself
160
+ def self.build_from_hash(attributes)
161
+ new.build_from_hash(attributes)
162
+ end
163
+
164
+ # Builds the object from hash
165
+ # @param [Hash] attributes Model attributes in the form of hash
166
+ # @return [Object] Returns the model itself
167
+ def build_from_hash(attributes)
168
+ return nil unless attributes.is_a?(Hash)
169
+ self.class.openapi_types.each_pair do |key, type|
170
+ if type =~ /\AArray<(.*)>/i
171
+ # check to ensure the input is an array given that the attribute
172
+ # is documented as an array but the input is not
173
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
174
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
175
+ end
176
+ elsif !attributes[self.class.attribute_map[key]].nil?
177
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
178
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
179
+ end
180
+
181
+ self
182
+ end
183
+
184
+ # Deserializes the data based on type
185
+ # @param string type Data type
186
+ # @param string value Value to be deserialized
187
+ # @return [Object] Deserialized data
188
+ def _deserialize(type, value)
189
+ case type.to_sym
190
+ when :DateTime
191
+ DateTime.parse(value)
192
+ when :Date
193
+ Date.parse(value)
194
+ when :String
195
+ value.to_s
196
+ when :Integer
197
+ value.to_i
198
+ when :Float
199
+ value.to_f
200
+ when :Boolean
201
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
202
+ true
203
+ else
204
+ false
205
+ end
206
+ when :Object
207
+ # generic object (usually a Hash), return directly
208
+ value
209
+ when /\AArray<(?<inner_type>.+)>\z/
210
+ inner_type = Regexp.last_match[:inner_type]
211
+ value.map { |v| _deserialize(inner_type, v) }
212
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
213
+ k_type = Regexp.last_match[:k_type]
214
+ v_type = Regexp.last_match[:v_type]
215
+ {}.tap do |hash|
216
+ value.each do |k, v|
217
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
218
+ end
219
+ end
220
+ else # model
221
+ AylienNewsApi.const_get(type).build_from_hash(value)
222
+ end
223
+ end
224
+
225
+ # Returns the string representation of the object
226
+ # @return [String] String presentation of the object
227
+ def to_s
228
+ to_hash.to_s
229
+ end
230
+
231
+ # to_body is an alias to to_hash (backward compatibility)
232
+ # @return [Hash] Returns the object in the form of hash
233
+ def to_body
234
+ to_hash
235
+ end
236
+
237
+ # Returns the object in the form of hash
238
+ # @return [Hash] Returns the object in the form of hash
239
+ def to_hash
240
+ hash = {}
241
+ self.class.attribute_map.each_pair do |attr, param|
242
+ value = self.send(attr)
243
+ if value.nil?
244
+ is_nullable = self.class.openapi_nullable.include?(attr)
245
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
246
+ end
247
+
248
+ hash[param] = _to_hash(value)
249
+ end
250
+ hash
251
+ end
252
+
253
+ # Outputs non-array value in the form of hash
254
+ # For object, use to_hash. Otherwise, just return the value
255
+ # @param [Object] value Any valid value
256
+ # @return [Hash] Returns the value in the form of hash
257
+ def _to_hash(value)
258
+ if value.is_a?(Array)
259
+ value.compact.map { |v| _to_hash(v) }
260
+ elsif value.is_a?(Hash)
261
+ {}.tap do |hash|
262
+ value.each { |k, v| hash[k] = _to_hash(v) }
263
+ end
264
+ elsif value.respond_to? :to_hash
265
+ value.to_hash
266
+ else
267
+ value
268
+ end
269
+ end
270
+ end
271
+ end
@@ -26,13 +26,21 @@ module AylienNewsApi
26
26
  # The input story title
27
27
  attr_accessor :story_title
28
28
 
29
+ # The end of a period in which searched stories were published
30
+ attr_accessor :published_at_end
31
+
32
+ # The start of a period in which searched stories were published
33
+ attr_accessor :published_at_start
34
+
29
35
  # Attribute mapping from ruby-style variable name to JSON key.
30
36
  def self.attribute_map
31
37
  {
32
38
  :'related_stories' => :'related_stories',
33
39
  :'story_body' => :'story_body',
34
40
  :'story_language' => :'story_language',
35
- :'story_title' => :'story_title'
41
+ :'story_title' => :'story_title',
42
+ :'published_at_end' => :'published_at.end',
43
+ :'published_at_start' => :'published_at.start'
36
44
  }
37
45
  end
38
46
 
@@ -42,7 +50,9 @@ module AylienNewsApi
42
50
  :'related_stories' => :'Array<Story>',
43
51
  :'story_body' => :'String',
44
52
  :'story_language' => :'String',
45
- :'story_title' => :'String'
53
+ :'story_title' => :'String',
54
+ :'published_at_end' => :'DateTime',
55
+ :'published_at_start' => :'DateTime'
46
56
  }
47
57
  end
48
58
 
@@ -84,6 +94,14 @@ module AylienNewsApi
84
94
  if attributes.key?(:'story_title')
85
95
  self.story_title = attributes[:'story_title']
86
96
  end
97
+
98
+ if attributes.key?(:'published_at_end')
99
+ self.published_at_end = attributes[:'published_at_end']
100
+ end
101
+
102
+ if attributes.key?(:'published_at_start')
103
+ self.published_at_start = attributes[:'published_at_start']
104
+ end
87
105
  end
88
106
 
89
107
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -107,7 +125,9 @@ module AylienNewsApi
107
125
  related_stories == o.related_stories &&
108
126
  story_body == o.story_body &&
109
127
  story_language == o.story_language &&
110
- story_title == o.story_title
128
+ story_title == o.story_title &&
129
+ published_at_end == o.published_at_end &&
130
+ published_at_start == o.published_at_start
111
131
  end
112
132
 
113
133
  # @see the `==` method
@@ -119,7 +139,7 @@ module AylienNewsApi
119
139
  # Calculates hash code according to all attributes.
120
140
  # @return [Integer] Hash code
121
141
  def hash
122
- [related_stories, story_body, story_language, story_title].hash
142
+ [related_stories, story_body, story_language, story_title, published_at_end, published_at_start].hash
123
143
  end
124
144
 
125
145
  # Builds the object from hash
@@ -26,13 +26,17 @@ module AylienNewsApi
26
26
  # The start of a period in which searched stories were published
27
27
  attr_accessor :published_at_start
28
28
 
29
+ # Notifies about possible issues that occurred when searching for stories
30
+ attr_accessor :warnings
31
+
29
32
  # Attribute mapping from ruby-style variable name to JSON key.
30
33
  def self.attribute_map
31
34
  {
32
35
  :'next_page_cursor' => :'next_page_cursor',
33
36
  :'stories' => :'stories',
34
37
  :'published_at_end' => :'published_at.end',
35
- :'published_at_start' => :'published_at.start'
38
+ :'published_at_start' => :'published_at.start',
39
+ :'warnings' => :'warnings'
36
40
  }
37
41
  end
38
42
 
@@ -42,7 +46,8 @@ module AylienNewsApi
42
46
  :'next_page_cursor' => :'String',
43
47
  :'stories' => :'Array<Story>',
44
48
  :'published_at_end' => :'DateTime',
45
- :'published_at_start' => :'DateTime'
49
+ :'published_at_start' => :'DateTime',
50
+ :'warnings' => :'Array<Warning>'
46
51
  }
47
52
  end
48
53
 
@@ -84,6 +89,12 @@ module AylienNewsApi
84
89
  if attributes.key?(:'published_at_start')
85
90
  self.published_at_start = attributes[:'published_at_start']
86
91
  end
92
+
93
+ if attributes.key?(:'warnings')
94
+ if (value = attributes[:'warnings']).is_a?(Array)
95
+ self.warnings = value
96
+ end
97
+ end
87
98
  end
88
99
 
89
100
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -107,7 +118,8 @@ module AylienNewsApi
107
118
  next_page_cursor == o.next_page_cursor &&
108
119
  stories == o.stories &&
109
120
  published_at_end == o.published_at_end &&
110
- published_at_start == o.published_at_start
121
+ published_at_start == o.published_at_start &&
122
+ warnings == o.warnings
111
123
  end
112
124
 
113
125
  # @see the `==` method
@@ -119,7 +131,7 @@ module AylienNewsApi
119
131
  # Calculates hash code according to all attributes.
120
132
  # @return [Integer] Hash code
121
133
  def hash
122
- [next_page_cursor, stories, published_at_end, published_at_start].hash
134
+ [next_page_cursor, stories, published_at_end, published_at_start, warnings].hash
123
135
  end
124
136
 
125
137
  # Builds the object from hash
@@ -72,6 +72,9 @@ module AylienNewsApi
72
72
  # Word count of the story body
73
73
  attr_accessor :words_count
74
74
 
75
+ # License type of the story
76
+ attr_accessor :license_type
77
+
75
78
  # Attribute mapping from ruby-style variable name to JSON key.
76
79
  def self.attribute_map
77
80
  {
@@ -96,7 +99,8 @@ module AylienNewsApi
96
99
  :'summary' => :'summary',
97
100
  :'title' => :'title',
98
101
  :'translations' => :'translations',
99
- :'words_count' => :'words_count'
102
+ :'words_count' => :'words_count',
103
+ :'license_type' => :'license_type'
100
104
  }
101
105
  end
102
106
 
@@ -124,7 +128,8 @@ module AylienNewsApi
124
128
  :'summary' => :'Summary',
125
129
  :'title' => :'String',
126
130
  :'translations' => :'StoryTranslations',
127
- :'words_count' => :'Integer'
131
+ :'words_count' => :'Integer',
132
+ :'license_type' => :'Integer'
128
133
  }
129
134
  end
130
135
 
@@ -246,6 +251,10 @@ module AylienNewsApi
246
251
  if attributes.key?(:'words_count')
247
252
  self.words_count = attributes[:'words_count']
248
253
  end
254
+
255
+ if attributes.key?(:'license_type')
256
+ self.license_type = attributes[:'license_type']
257
+ end
249
258
  end
250
259
 
251
260
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -287,7 +296,8 @@ module AylienNewsApi
287
296
  summary == o.summary &&
288
297
  title == o.title &&
289
298
  translations == o.translations &&
290
- words_count == o.words_count
299
+ words_count == o.words_count &&
300
+ license_type == o.license_type
291
301
  end
292
302
 
293
303
  # @see the `==` method
@@ -299,7 +309,7 @@ module AylienNewsApi
299
309
  # Calculates hash code according to all attributes.
300
310
  # @return [Integer] Hash code
301
311
  def hash
302
- [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].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
303
313
  end
304
314
 
305
315
  # Builds the object from hash