aylien_news_api 4.3.0 → 5.0.0

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