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
@@ -14,39 +14,56 @@ require 'date'
14
14
 
15
15
  module AylienNewsApi
16
16
  class Entity
17
- # The indices of the entity text
18
- attr_accessor :indices
17
+ # The unique ID of the entity
18
+ attr_accessor :id
19
19
 
20
20
  attr_accessor :links
21
21
 
22
- # The entity score
23
- attr_accessor :score
22
+ # The stock tickers of the entity (might be empty)
23
+ attr_accessor :stock_tickers
24
24
 
25
- # The entity text
26
- attr_accessor :text
27
-
28
- # An array of the dbpedia types
25
+ # An array of the entity types
29
26
  attr_accessor :types
30
27
 
28
+ attr_accessor :overall_sentiment
29
+
30
+ # Describes how relevant an entity is to the article
31
+ attr_accessor :overall_prominence
32
+
33
+ # Amount of entity surface form mentions in the article
34
+ attr_accessor :overall_frequency
35
+
36
+ attr_accessor :body
37
+
38
+ attr_accessor :title
39
+
31
40
  # Attribute mapping from ruby-style variable name to JSON key.
32
41
  def self.attribute_map
33
42
  {
34
- :'indices' => :'indices',
43
+ :'id' => :'id',
35
44
  :'links' => :'links',
36
- :'score' => :'score',
37
- :'text' => :'text',
38
- :'types' => :'types'
45
+ :'stock_tickers' => :'stock_tickers',
46
+ :'types' => :'types',
47
+ :'overall_sentiment' => :'overall_sentiment',
48
+ :'overall_prominence' => :'overall_prominence',
49
+ :'overall_frequency' => :'overall_frequency',
50
+ :'body' => :'body',
51
+ :'title' => :'title'
39
52
  }
40
53
  end
41
54
 
42
55
  # Attribute type mapping.
43
56
  def self.openapi_types
44
57
  {
45
- :'indices' => :'Array<Array<Integer>>',
58
+ :'id' => :'String',
46
59
  :'links' => :'EntityLinks',
47
- :'score' => :'Float',
48
- :'text' => :'String',
49
- :'types' => :'Array<String>'
60
+ :'stock_tickers' => :'Array<String>',
61
+ :'types' => :'Array<String>',
62
+ :'overall_sentiment' => :'EntitySentiment',
63
+ :'overall_prominence' => :'Float',
64
+ :'overall_frequency' => :'Integer',
65
+ :'body' => :'EntityInText',
66
+ :'title' => :'EntityInText'
50
67
  }
51
68
  end
52
69
 
@@ -71,22 +88,18 @@ module AylienNewsApi
71
88
  h[k.to_sym] = v
72
89
  }
73
90
 
74
- if attributes.key?(:'indices')
75
- if (value = attributes[:'indices']).is_a?(Array)
76
- self.indices = value
77
- end
91
+ if attributes.key?(:'id')
92
+ self.id = attributes[:'id']
78
93
  end
79
94
 
80
95
  if attributes.key?(:'links')
81
96
  self.links = attributes[:'links']
82
97
  end
83
98
 
84
- if attributes.key?(:'score')
85
- self.score = attributes[:'score']
86
- end
87
-
88
- if attributes.key?(:'text')
89
- self.text = attributes[:'text']
99
+ if attributes.key?(:'stock_tickers')
100
+ if (value = attributes[:'stock_tickers']).is_a?(Array)
101
+ self.stock_tickers = value
102
+ end
90
103
  end
91
104
 
92
105
  if attributes.key?(:'types')
@@ -94,18 +107,42 @@ module AylienNewsApi
94
107
  self.types = value
95
108
  end
96
109
  end
110
+
111
+ if attributes.key?(:'overall_sentiment')
112
+ self.overall_sentiment = attributes[:'overall_sentiment']
113
+ end
114
+
115
+ if attributes.key?(:'overall_prominence')
116
+ self.overall_prominence = attributes[:'overall_prominence']
117
+ end
118
+
119
+ if attributes.key?(:'overall_frequency')
120
+ self.overall_frequency = attributes[:'overall_frequency']
121
+ end
122
+
123
+ if attributes.key?(:'body')
124
+ self.body = attributes[:'body']
125
+ end
126
+
127
+ if attributes.key?(:'title')
128
+ self.title = attributes[:'title']
129
+ end
97
130
  end
98
131
 
99
132
  # Show invalid properties with the reasons. Usually used together with valid?
100
133
  # @return Array for valid properties with the reasons
101
134
  def list_invalid_properties
102
135
  invalid_properties = Array.new
103
- if !@score.nil? && @score > 1
104
- invalid_properties.push('invalid value for "score", must be smaller than or equal to 1.')
136
+ if !@overall_prominence.nil? && @overall_prominence > 1
137
+ invalid_properties.push('invalid value for "overall_prominence", must be smaller than or equal to 1.')
105
138
  end
106
139
 
107
- if !@score.nil? && @score < 0
108
- invalid_properties.push('invalid value for "score", must be greater than or equal to 0.')
140
+ if !@overall_prominence.nil? && @overall_prominence < 0
141
+ invalid_properties.push('invalid value for "overall_prominence", must be greater than or equal to 0.')
142
+ end
143
+
144
+ if !@overall_frequency.nil? && @overall_frequency < 0
145
+ invalid_properties.push('invalid value for "overall_frequency", must be greater than or equal to 0.')
109
146
  end
110
147
 
111
148
  invalid_properties
@@ -114,23 +151,34 @@ module AylienNewsApi
114
151
  # Check to see if the all the properties in the model are valid
115
152
  # @return true if the model is valid
116
153
  def valid?
117
- return false if !@score.nil? && @score > 1
118
- return false if !@score.nil? && @score < 0
154
+ return false if !@overall_prominence.nil? && @overall_prominence > 1
155
+ return false if !@overall_prominence.nil? && @overall_prominence < 0
156
+ return false if !@overall_frequency.nil? && @overall_frequency < 0
119
157
  true
120
158
  end
121
159
 
122
160
  # Custom attribute writer method with validation
123
- # @param [Object] score Value to be assigned
124
- def score=(score)
125
- if !score.nil? && score > 1
126
- fail ArgumentError, 'invalid value for "score", must be smaller than or equal to 1.'
161
+ # @param [Object] overall_prominence Value to be assigned
162
+ def overall_prominence=(overall_prominence)
163
+ if !overall_prominence.nil? && overall_prominence > 1
164
+ fail ArgumentError, 'invalid value for "overall_prominence", must be smaller than or equal to 1.'
165
+ end
166
+
167
+ if !overall_prominence.nil? && overall_prominence < 0
168
+ fail ArgumentError, 'invalid value for "overall_prominence", must be greater than or equal to 0.'
127
169
  end
128
170
 
129
- if !score.nil? && score < 0
130
- fail ArgumentError, 'invalid value for "score", must be greater than or equal to 0.'
171
+ @overall_prominence = overall_prominence
172
+ end
173
+
174
+ # Custom attribute writer method with validation
175
+ # @param [Object] overall_frequency Value to be assigned
176
+ def overall_frequency=(overall_frequency)
177
+ if !overall_frequency.nil? && overall_frequency < 0
178
+ fail ArgumentError, 'invalid value for "overall_frequency", must be greater than or equal to 0.'
131
179
  end
132
180
 
133
- @score = score
181
+ @overall_frequency = overall_frequency
134
182
  end
135
183
 
136
184
  # Checks equality by comparing each attribute.
@@ -138,11 +186,15 @@ module AylienNewsApi
138
186
  def ==(o)
139
187
  return true if self.equal?(o)
140
188
  self.class == o.class &&
141
- indices == o.indices &&
189
+ id == o.id &&
142
190
  links == o.links &&
143
- score == o.score &&
144
- text == o.text &&
145
- types == o.types
191
+ stock_tickers == o.stock_tickers &&
192
+ types == o.types &&
193
+ overall_sentiment == o.overall_sentiment &&
194
+ overall_prominence == o.overall_prominence &&
195
+ overall_frequency == o.overall_frequency &&
196
+ body == o.body &&
197
+ title == o.title
146
198
  end
147
199
 
148
200
  # @see the `==` method
@@ -154,7 +206,7 @@ module AylienNewsApi
154
206
  # Calculates hash code according to all attributes.
155
207
  # @return [Integer] Hash code
156
208
  def hash
157
- [indices, links, score, text, types].hash
209
+ [id, links, stock_tickers, types, overall_sentiment, overall_prominence, overall_frequency, body, title].hash
158
210
  end
159
211
 
160
212
  # Builds the object from hash
@@ -0,0 +1,217 @@
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 EntityInText
17
+ attr_accessor :sentiment
18
+
19
+ attr_accessor :surface_forms
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'sentiment' => :'sentiment',
25
+ :'surface_forms' => :'surface_forms'
26
+ }
27
+ end
28
+
29
+ # Attribute type mapping.
30
+ def self.openapi_types
31
+ {
32
+ :'sentiment' => :'EntitySentiment',
33
+ :'surface_forms' => :'Array<EntitySurfaceForm>'
34
+ }
35
+ end
36
+
37
+ # List of attributes with nullable: true
38
+ def self.openapi_nullable
39
+ Set.new([
40
+ ])
41
+ end
42
+
43
+ # Initializes the object
44
+ # @param [Hash] attributes Model attributes in the form of hash
45
+ def initialize(attributes = {})
46
+ if (!attributes.is_a?(Hash))
47
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::EntityInText` initialize method"
48
+ end
49
+
50
+ # check to see if the attribute exists and convert string to symbol for hash key
51
+ attributes = attributes.each_with_object({}) { |(k, v), h|
52
+ if (!self.class.attribute_map.key?(k.to_sym))
53
+ fail ArgumentError, "`#{k}` is not a valid attribute in `AylienNewsApi::EntityInText`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
54
+ end
55
+ h[k.to_sym] = v
56
+ }
57
+
58
+ if attributes.key?(:'sentiment')
59
+ self.sentiment = attributes[:'sentiment']
60
+ end
61
+
62
+ if attributes.key?(:'surface_forms')
63
+ if (value = attributes[:'surface_forms']).is_a?(Array)
64
+ self.surface_forms = value
65
+ end
66
+ end
67
+ end
68
+
69
+ # Show invalid properties with the reasons. Usually used together with valid?
70
+ # @return Array for valid properties with the reasons
71
+ def list_invalid_properties
72
+ invalid_properties = Array.new
73
+ invalid_properties
74
+ end
75
+
76
+ # Check to see if the all the properties in the model are valid
77
+ # @return true if the model is valid
78
+ def valid?
79
+ true
80
+ end
81
+
82
+ # Checks equality by comparing each attribute.
83
+ # @param [Object] Object to be compared
84
+ def ==(o)
85
+ return true if self.equal?(o)
86
+ self.class == o.class &&
87
+ sentiment == o.sentiment &&
88
+ surface_forms == o.surface_forms
89
+ end
90
+
91
+ # @see the `==` method
92
+ # @param [Object] Object to be compared
93
+ def eql?(o)
94
+ self == o
95
+ end
96
+
97
+ # Calculates hash code according to all attributes.
98
+ # @return [Integer] Hash code
99
+ def hash
100
+ [sentiment, surface_forms].hash
101
+ end
102
+
103
+ # Builds the object from hash
104
+ # @param [Hash] attributes Model attributes in the form of hash
105
+ # @return [Object] Returns the model itself
106
+ def self.build_from_hash(attributes)
107
+ new.build_from_hash(attributes)
108
+ end
109
+
110
+ # Builds the object from hash
111
+ # @param [Hash] attributes Model attributes in the form of hash
112
+ # @return [Object] Returns the model itself
113
+ def build_from_hash(attributes)
114
+ return nil unless attributes.is_a?(Hash)
115
+ self.class.openapi_types.each_pair do |key, type|
116
+ if type =~ /\AArray<(.*)>/i
117
+ # check to ensure the input is an array given that the attribute
118
+ # is documented as an array but the input is not
119
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
120
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
121
+ end
122
+ elsif !attributes[self.class.attribute_map[key]].nil?
123
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
124
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
125
+ end
126
+
127
+ self
128
+ end
129
+
130
+ # Deserializes the data based on type
131
+ # @param string type Data type
132
+ # @param string value Value to be deserialized
133
+ # @return [Object] Deserialized data
134
+ def _deserialize(type, value)
135
+ case type.to_sym
136
+ when :DateTime
137
+ DateTime.parse(value)
138
+ when :Date
139
+ Date.parse(value)
140
+ when :String
141
+ value.to_s
142
+ when :Integer
143
+ value.to_i
144
+ when :Float
145
+ value.to_f
146
+ when :Boolean
147
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
148
+ true
149
+ else
150
+ false
151
+ end
152
+ when :Object
153
+ # generic object (usually a Hash), return directly
154
+ value
155
+ when /\AArray<(?<inner_type>.+)>\z/
156
+ inner_type = Regexp.last_match[:inner_type]
157
+ value.map { |v| _deserialize(inner_type, v) }
158
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
159
+ k_type = Regexp.last_match[:k_type]
160
+ v_type = Regexp.last_match[:v_type]
161
+ {}.tap do |hash|
162
+ value.each do |k, v|
163
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
164
+ end
165
+ end
166
+ else # model
167
+ AylienNewsApi.const_get(type).build_from_hash(value)
168
+ end
169
+ end
170
+
171
+ # Returns the string representation of the object
172
+ # @return [String] String presentation of the object
173
+ def to_s
174
+ to_hash.to_s
175
+ end
176
+
177
+ # to_body is an alias to to_hash (backward compatibility)
178
+ # @return [Hash] Returns the object in the form of hash
179
+ def to_body
180
+ to_hash
181
+ end
182
+
183
+ # Returns the object in the form of hash
184
+ # @return [Hash] Returns the object in the form of hash
185
+ def to_hash
186
+ hash = {}
187
+ self.class.attribute_map.each_pair do |attr, param|
188
+ value = self.send(attr)
189
+ if value.nil?
190
+ is_nullable = self.class.openapi_nullable.include?(attr)
191
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
192
+ end
193
+
194
+ hash[param] = _to_hash(value)
195
+ end
196
+ hash
197
+ end
198
+
199
+ # Outputs non-array value in the form of hash
200
+ # For object, use to_hash. Otherwise, just return the value
201
+ # @param [Object] value Any valid value
202
+ # @return [Hash] Returns the value in the form of hash
203
+ def _to_hash(value)
204
+ if value.is_a?(Array)
205
+ value.compact.map { |v| _to_hash(v) }
206
+ elsif value.is_a?(Hash)
207
+ {}.tap do |hash|
208
+ value.each { |k, v| hash[k] = _to_hash(v) }
209
+ end
210
+ elsif value.respond_to? :to_hash
211
+ value.to_hash
212
+ else
213
+ value
214
+ end
215
+ end
216
+ end
217
+ end
@@ -14,20 +14,30 @@ require 'date'
14
14
 
15
15
  module AylienNewsApi
16
16
  class EntityLinks
17
- # A dbpedia resource URL
17
+ # A dbpedia resource URL (deprecated)
18
18
  attr_accessor :dbpedia
19
19
 
20
+ # A wikipedia resource URL
21
+ attr_accessor :wikipedia
22
+
23
+ # A wikidata resource URL
24
+ attr_accessor :wikidata
25
+
20
26
  # Attribute mapping from ruby-style variable name to JSON key.
21
27
  def self.attribute_map
22
28
  {
23
- :'dbpedia' => :'dbpedia'
29
+ :'dbpedia' => :'dbpedia',
30
+ :'wikipedia' => :'wikipedia',
31
+ :'wikidata' => :'wikidata'
24
32
  }
25
33
  end
26
34
 
27
35
  # Attribute type mapping.
28
36
  def self.openapi_types
29
37
  {
30
- :'dbpedia' => :'String'
38
+ :'dbpedia' => :'String',
39
+ :'wikipedia' => :'String',
40
+ :'wikidata' => :'String'
31
41
  }
32
42
  end
33
43
 
@@ -55,6 +65,14 @@ module AylienNewsApi
55
65
  if attributes.key?(:'dbpedia')
56
66
  self.dbpedia = attributes[:'dbpedia']
57
67
  end
68
+
69
+ if attributes.key?(:'wikipedia')
70
+ self.wikipedia = attributes[:'wikipedia']
71
+ end
72
+
73
+ if attributes.key?(:'wikidata')
74
+ self.wikidata = attributes[:'wikidata']
75
+ end
58
76
  end
59
77
 
60
78
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -75,7 +93,9 @@ module AylienNewsApi
75
93
  def ==(o)
76
94
  return true if self.equal?(o)
77
95
  self.class == o.class &&
78
- dbpedia == o.dbpedia
96
+ dbpedia == o.dbpedia &&
97
+ wikipedia == o.wikipedia &&
98
+ wikidata == o.wikidata
79
99
  end
80
100
 
81
101
  # @see the `==` method
@@ -87,7 +107,7 @@ module AylienNewsApi
87
107
  # Calculates hash code according to all attributes.
88
108
  # @return [Integer] Hash code
89
109
  def hash
90
- [dbpedia].hash
110
+ [dbpedia, wikipedia, wikidata].hash
91
111
  end
92
112
 
93
113
  # Builds the object from hash