aylien_news_api 4.1.1 → 4.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +100 -31
  3. data/docs/AggregatedSentiment.md +21 -0
  4. data/docs/DefaultApi.md +491 -7
  5. data/docs/DeprecatedEntities.md +19 -0
  6. data/docs/DeprecatedEntity.md +33 -0
  7. data/docs/DeprecatedEntitySurfaceForm.md +21 -0
  8. data/docs/DeprecatedRelatedStories.md +27 -0
  9. data/docs/DeprecatedStories.md +25 -0
  10. data/docs/DeprecatedStory.md +61 -0
  11. data/docs/Entity.md +16 -8
  12. data/docs/EntityInText.md +19 -0
  13. data/docs/EntityLinks.md +6 -2
  14. data/docs/EntityMention.md +19 -0
  15. data/docs/EntityMentionIndex.md +19 -0
  16. data/docs/EntitySentiment.md +19 -0
  17. data/docs/EntitySurfaceForm.md +21 -0
  18. data/docs/Logicals.md +21 -0
  19. data/docs/NestedEntity.md +33 -0
  20. data/docs/Parameter.md +127 -0
  21. data/docs/Query.md +31 -0
  22. data/docs/Story.md +4 -2
  23. data/docs/TimeSeries.md +3 -1
  24. data/docs/Trend.md +3 -1
  25. data/lib/aylien_news_api.rb +16 -1
  26. data/lib/aylien_news_api/api/default_api.rb +728 -11
  27. data/lib/aylien_news_api/models/aggregated_sentiment.rb +228 -0
  28. data/lib/aylien_news_api/models/deprecated_entities.rb +221 -0
  29. data/lib/aylien_news_api/models/deprecated_entity.rb +314 -0
  30. data/lib/aylien_news_api/models/deprecated_entity_surface_form.rb +244 -0
  31. data/lib/aylien_news_api/models/deprecated_related_stories.rb +260 -0
  32. data/lib/aylien_news_api/models/deprecated_stories.rb +252 -0
  33. data/lib/aylien_news_api/models/deprecated_story.rb +429 -0
  34. data/lib/aylien_news_api/models/entity.rb +96 -44
  35. data/lib/aylien_news_api/models/entity_in_text.rb +217 -0
  36. data/lib/aylien_news_api/models/entity_links.rb +25 -5
  37. data/lib/aylien_news_api/models/entity_mention.rb +215 -0
  38. data/lib/aylien_news_api/models/entity_mention_index.rb +265 -0
  39. data/lib/aylien_news_api/models/entity_sentiment.rb +240 -0
  40. data/lib/aylien_news_api/models/entity_surface_form.rb +244 -0
  41. data/lib/aylien_news_api/models/logicals.rb +230 -0
  42. data/lib/aylien_news_api/models/nested_entity.rb +278 -0
  43. data/lib/aylien_news_api/models/parameter.rb +701 -0
  44. data/lib/aylien_news_api/models/query.rb +271 -0
  45. data/lib/aylien_news_api/models/related_stories.rb +1 -0
  46. data/lib/aylien_news_api/models/stories.rb +1 -0
  47. data/lib/aylien_news_api/models/story.rb +19 -6
  48. data/lib/aylien_news_api/models/time_series.rb +13 -4
  49. data/lib/aylien_news_api/models/trend.rb +13 -4
  50. data/lib/aylien_news_api/version.rb +1 -1
  51. data/spec/api/default_api_spec.rb +226 -3
  52. data/spec/models/aggregated_sentiment_spec.rb +53 -0
  53. data/spec/models/deprecated_entities_spec.rb +47 -0
  54. data/spec/models/deprecated_entity_spec.rb +89 -0
  55. data/spec/models/deprecated_entity_surface_form_spec.rb +53 -0
  56. data/spec/models/deprecated_related_stories_spec.rb +71 -0
  57. data/spec/models/deprecated_stories_spec.rb +65 -0
  58. data/spec/models/deprecated_story_spec.rb +173 -0
  59. data/spec/models/entity_in_text_spec.rb +47 -0
  60. data/spec/models/entity_links_spec.rb +12 -0
  61. data/spec/models/entity_mention_index_spec.rb +47 -0
  62. data/spec/models/entity_mention_spec.rb +47 -0
  63. data/spec/models/entity_sentiment_spec.rb +47 -0
  64. data/spec/models/entity_spec.rb +28 -4
  65. data/spec/models/entity_surface_form_spec.rb +53 -0
  66. data/spec/models/logicals_spec.rb +53 -0
  67. data/spec/models/nested_entity_spec.rb +89 -0
  68. data/spec/models/parameter_spec.rb +371 -0
  69. data/spec/models/query_spec.rb +83 -0
  70. data/spec/models/story_spec.rb +6 -0
  71. data/spec/models/time_series_spec.rb +6 -0
  72. data/spec/models/trend_spec.rb +6 -0
  73. metadata +66 -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
@@ -13,6 +13,7 @@ OpenAPI Generator version: 5.0.0-SNAPSHOT
13
13
  require 'date'
14
14
 
15
15
  module AylienNewsApi
16
+ # Story containing new V3 entities - available for new_v3_entities feature flag
16
17
  class RelatedStories
17
18
  # An array of related stories for the input story
18
19
  attr_accessor :related_stories
@@ -13,6 +13,7 @@ OpenAPI Generator version: 5.0.0-SNAPSHOT
13
13
  require 'date'
14
14
 
15
15
  module AylienNewsApi
16
+ # Stories containing new V3 entities - available for new_v3_entities feature flag
16
17
  class Stories
17
18
  # The next page cursor
18
19
  attr_accessor :next_page_cursor
@@ -28,6 +28,7 @@ module AylienNewsApi
28
28
  # An array of clusters the story is associated with
29
29
  attr_accessor :clusters
30
30
 
31
+ # An array of entities
31
32
  attr_accessor :entities
32
33
 
33
34
  # An array of suggested Story hashtags
@@ -72,6 +73,9 @@ module AylienNewsApi
72
73
  # Word count of the story body
73
74
  attr_accessor :words_count
74
75
 
76
+ # License type of the story
77
+ attr_accessor :license_type
78
+
75
79
  # Attribute mapping from ruby-style variable name to JSON key.
76
80
  def self.attribute_map
77
81
  {
@@ -96,7 +100,8 @@ module AylienNewsApi
96
100
  :'summary' => :'summary',
97
101
  :'title' => :'title',
98
102
  :'translations' => :'translations',
99
- :'words_count' => :'words_count'
103
+ :'words_count' => :'words_count',
104
+ :'license_type' => :'license_type'
100
105
  }
101
106
  end
102
107
 
@@ -108,7 +113,7 @@ module AylienNewsApi
108
113
  :'categories' => :'Array<Category>',
109
114
  :'characters_count' => :'Integer',
110
115
  :'clusters' => :'Array<Integer>',
111
- :'entities' => :'Entities',
116
+ :'entities' => :'Array<Entity>',
112
117
  :'hashtags' => :'Array<String>',
113
118
  :'id' => :'Integer',
114
119
  :'keywords' => :'Array<String>',
@@ -124,7 +129,8 @@ module AylienNewsApi
124
129
  :'summary' => :'Summary',
125
130
  :'title' => :'String',
126
131
  :'translations' => :'StoryTranslations',
127
- :'words_count' => :'Integer'
132
+ :'words_count' => :'Integer',
133
+ :'license_type' => :'Integer'
128
134
  }
129
135
  end
130
136
 
@@ -174,7 +180,9 @@ module AylienNewsApi
174
180
  end
175
181
 
176
182
  if attributes.key?(:'entities')
177
- self.entities = attributes[:'entities']
183
+ if (value = attributes[:'entities']).is_a?(Array)
184
+ self.entities = value
185
+ end
178
186
  end
179
187
 
180
188
  if attributes.key?(:'hashtags')
@@ -246,6 +254,10 @@ module AylienNewsApi
246
254
  if attributes.key?(:'words_count')
247
255
  self.words_count = attributes[:'words_count']
248
256
  end
257
+
258
+ if attributes.key?(:'license_type')
259
+ self.license_type = attributes[:'license_type']
260
+ end
249
261
  end
250
262
 
251
263
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -287,7 +299,8 @@ module AylienNewsApi
287
299
  summary == o.summary &&
288
300
  title == o.title &&
289
301
  translations == o.translations &&
290
- words_count == o.words_count
302
+ words_count == o.words_count &&
303
+ license_type == o.license_type
291
304
  end
292
305
 
293
306
  # @see the `==` method
@@ -299,7 +312,7 @@ module AylienNewsApi
299
312
  # Calculates hash code according to all attributes.
300
313
  # @return [Integer] Hash code
301
314
  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
315
+ [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
316
  end
304
317
 
305
318
  # Builds the object from hash
@@ -20,11 +20,14 @@ module AylienNewsApi
20
20
  # The published date of the time series bin
21
21
  attr_accessor :published_at
22
22
 
23
+ attr_accessor :sentiment
24
+
23
25
  # Attribute mapping from ruby-style variable name to JSON key.
24
26
  def self.attribute_map
25
27
  {
26
28
  :'count' => :'count',
27
- :'published_at' => :'published_at'
29
+ :'published_at' => :'published_at',
30
+ :'sentiment' => :'sentiment'
28
31
  }
29
32
  end
30
33
 
@@ -32,7 +35,8 @@ module AylienNewsApi
32
35
  def self.openapi_types
33
36
  {
34
37
  :'count' => :'Integer',
35
- :'published_at' => :'DateTime'
38
+ :'published_at' => :'DateTime',
39
+ :'sentiment' => :'AggregatedSentiment'
36
40
  }
37
41
  end
38
42
 
@@ -64,6 +68,10 @@ module AylienNewsApi
64
68
  if attributes.key?(:'published_at')
65
69
  self.published_at = attributes[:'published_at']
66
70
  end
71
+
72
+ if attributes.key?(:'sentiment')
73
+ self.sentiment = attributes[:'sentiment']
74
+ end
67
75
  end
68
76
 
69
77
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -85,7 +93,8 @@ module AylienNewsApi
85
93
  return true if self.equal?(o)
86
94
  self.class == o.class &&
87
95
  count == o.count &&
88
- published_at == o.published_at
96
+ published_at == o.published_at &&
97
+ sentiment == o.sentiment
89
98
  end
90
99
 
91
100
  # @see the `==` method
@@ -97,7 +106,7 @@ module AylienNewsApi
97
106
  # Calculates hash code according to all attributes.
98
107
  # @return [Integer] Hash code
99
108
  def hash
100
- [count, published_at].hash
109
+ [count, published_at, sentiment].hash
101
110
  end
102
111
 
103
112
  # Builds the object from hash
@@ -20,11 +20,14 @@ module AylienNewsApi
20
20
  # The value of the trend
21
21
  attr_accessor :value
22
22
 
23
+ attr_accessor :sentiment
24
+
23
25
  # Attribute mapping from ruby-style variable name to JSON key.
24
26
  def self.attribute_map
25
27
  {
26
28
  :'count' => :'count',
27
- :'value' => :'value'
29
+ :'value' => :'value',
30
+ :'sentiment' => :'sentiment'
28
31
  }
29
32
  end
30
33
 
@@ -32,7 +35,8 @@ module AylienNewsApi
32
35
  def self.openapi_types
33
36
  {
34
37
  :'count' => :'Integer',
35
- :'value' => :'String'
38
+ :'value' => :'String',
39
+ :'sentiment' => :'AggregatedSentiment'
36
40
  }
37
41
  end
38
42
 
@@ -64,6 +68,10 @@ module AylienNewsApi
64
68
  if attributes.key?(:'value')
65
69
  self.value = attributes[:'value']
66
70
  end
71
+
72
+ if attributes.key?(:'sentiment')
73
+ self.sentiment = attributes[:'sentiment']
74
+ end
67
75
  end
68
76
 
69
77
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -85,7 +93,8 @@ module AylienNewsApi
85
93
  return true if self.equal?(o)
86
94
  self.class == o.class &&
87
95
  count == o.count &&
88
- value == o.value
96
+ value == o.value &&
97
+ sentiment == o.sentiment
89
98
  end
90
99
 
91
100
  # @see the `==` method
@@ -97,7 +106,7 @@ module AylienNewsApi
97
106
  # Calculates hash code according to all attributes.
98
107
  # @return [Integer] Hash code
99
108
  def hash
100
- [count, value].hash
109
+ [count, value, sentiment].hash
101
110
  end
102
111
 
103
112
  # Builds the object from hash