aylien_news_api 0.2.0 → 4.0.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.
- checksums.yaml +5 -5
- data/Gemfile +7 -1
- data/README.md +36 -47
- data/Rakefile +10 -0
- data/aylien_news_api.gemspec +25 -32
- data/docs/Author.md +12 -1
- data/docs/Autocomplete.md +10 -0
- data/docs/Autocompletes.md +9 -0
- data/docs/Category.md +19 -3
- data/docs/CategoryLinks.md +11 -1
- data/docs/CategoryTaxonomy.md +16 -0
- data/docs/Cluster.md +29 -0
- data/docs/Clusters.md +21 -0
- data/docs/Coverages.md +16 -4
- data/docs/DefaultApi.md +1310 -576
- data/docs/Entities.md +11 -1
- data/docs/Entity.md +16 -3
- data/docs/EntityLinks.md +9 -0
- data/docs/Error.md +16 -2
- data/docs/ErrorLinks.md +9 -0
- data/docs/Errors.md +9 -0
- data/docs/HistogramInterval.md +10 -0
- data/docs/Histograms.md +20 -3
- data/docs/Location.md +13 -2
- data/docs/Media.md +19 -1
- data/docs/MediaFormat.md +16 -0
- data/docs/MediaType.md +16 -0
- data/docs/Rank.md +21 -0
- data/docs/Rankings.md +17 -0
- data/docs/RelatedStories.md +14 -3
- data/docs/RepresentativeStory.md +23 -0
- data/docs/Scope.md +15 -3
- data/docs/ScopeLevel.md +16 -0
- data/docs/Sentiment.md +11 -1
- data/docs/SentimentPolarity.md +16 -0
- data/docs/Sentiments.md +12 -2
- data/docs/ShareCount.md +10 -0
- data/docs/ShareCounts.md +12 -0
- data/docs/Source.md +27 -3
- data/docs/Stories.md +15 -2
- data/docs/Story.md +48 -16
- data/docs/StoryCluster.md +14 -1
- data/docs/StoryLinks.md +14 -1
- data/docs/StoryTranslation.md +19 -0
- data/docs/StoryTranslations.md +17 -0
- data/docs/StoryTranslationsEn.md +21 -0
- data/docs/Summary.md +9 -0
- data/docs/TimeSeries.md +11 -1
- data/docs/TimeSeriesList.md +15 -3
- data/docs/Trend.md +11 -1
- data/docs/Trends.md +15 -1
- data/git_push.sh +58 -0
- data/lib/aylien_news_api.rb +23 -14
- data/lib/aylien_news_api/api/default_api.rb +2755 -892
- data/lib/aylien_news_api/api_client.rb +141 -102
- data/lib/aylien_news_api/api_error.rb +37 -18
- data/lib/aylien_news_api/configuration.rb +94 -43
- data/lib/aylien_news_api/models/author.rb +69 -53
- data/lib/aylien_news_api/models/autocomplete.rb +55 -39
- data/lib/aylien_news_api/models/autocompletes.rb +54 -38
- data/lib/aylien_news_api/models/category.rb +88 -97
- data/lib/aylien_news_api/models/category_links.rb +66 -50
- data/lib/aylien_news_api/models/category_taxonomy.rb +36 -0
- data/lib/aylien_news_api/models/cluster.rb +265 -0
- data/lib/aylien_news_api/models/clusters.rb +229 -0
- data/lib/aylien_news_api/models/coverages.rb +79 -75
- data/lib/aylien_news_api/models/entities.rb +67 -51
- data/lib/aylien_news_api/models/entity.rb +100 -81
- data/lib/aylien_news_api/models/entity_links.rb +54 -38
- data/lib/aylien_news_api/models/error.rb +79 -63
- data/lib/aylien_news_api/models/error_links.rb +54 -38
- data/lib/aylien_news_api/models/errors.rb +54 -38
- data/lib/aylien_news_api/models/histogram_interval.rb +55 -39
- data/lib/aylien_news_api/models/histograms.rb +99 -63
- data/lib/aylien_news_api/models/location.rb +70 -54
- data/lib/aylien_news_api/models/media.rb +97 -76
- data/lib/aylien_news_api/models/media_format.rb +44 -0
- data/lib/aylien_news_api/models/media_type.rb +36 -0
- data/lib/aylien_news_api/models/rank.rb +227 -0
- data/lib/aylien_news_api/models/rankings.rb +208 -0
- data/lib/aylien_news_api/models/related_stories.rb +72 -68
- data/lib/aylien_news_api/models/representative_story.rb +237 -0
- data/lib/aylien_news_api/models/scope.rb +76 -94
- data/lib/aylien_news_api/models/scope_level.rb +37 -0
- data/lib/aylien_news_api/models/sentiment.rb +70 -84
- data/lib/aylien_news_api/models/sentiment_polarity.rb +37 -0
- data/lib/aylien_news_api/models/sentiments.rb +65 -51
- data/lib/aylien_news_api/models/share_count.rb +55 -39
- data/lib/aylien_news_api/models/share_counts.rb +57 -41
- data/lib/aylien_news_api/models/source.rb +129 -64
- data/lib/aylien_news_api/models/stories.rb +79 -55
- data/lib/aylien_news_api/models/story.rb +191 -161
- data/lib/aylien_news_api/models/story_cluster.rb +71 -55
- data/lib/aylien_news_api/models/story_links.rb +73 -47
- data/lib/aylien_news_api/models/story_translation.rb +217 -0
- data/lib/aylien_news_api/models/story_translations.rb +207 -0
- data/lib/aylien_news_api/models/story_translations_en.rb +227 -0
- data/lib/aylien_news_api/models/summary.rb +54 -38
- data/lib/aylien_news_api/models/time_series.rb +66 -50
- data/lib/aylien_news_api/models/time_series_list.rb +75 -59
- data/lib/aylien_news_api/models/trend.rb +66 -50
- data/lib/aylien_news_api/models/trends.rb +80 -44
- data/lib/aylien_news_api/version.rb +12 -14
- data/spec/api/default_api_spec.rb +620 -284
- data/spec/api_client_spec.rb +43 -161
- data/spec/configuration_spec.rb +22 -19
- data/spec/models/author_spec.rb +21 -34
- data/spec/models/autocomplete_spec.rb +17 -26
- data/spec/models/autocompletes_spec.rb +16 -21
- data/spec/models/category_links_spec.rb +19 -28
- data/spec/models/category_spec.rb +31 -50
- data/spec/models/category_taxonomy_spec.rb +35 -0
- data/spec/models/cluster_spec.rb +77 -0
- data/spec/models/clusters_spec.rb +53 -0
- data/spec/models/coverages_spec.rb +24 -45
- data/spec/models/entities_spec.rb +19 -28
- data/spec/models/entity_links_spec.rb +16 -21
- data/spec/models/entity_spec.rb +25 -46
- data/spec/models/error_links_spec.rb +16 -21
- data/spec/models/error_spec.rb +27 -52
- data/spec/models/errors_spec.rb +16 -21
- data/spec/models/histogram_interval_spec.rb +17 -26
- data/spec/models/histograms_spec.rb +36 -45
- data/spec/models/location_spec.rb +21 -34
- data/spec/models/media_format_spec.rb +35 -0
- data/spec/models/media_spec.rb +41 -26
- data/spec/models/media_type_spec.rb +35 -0
- data/spec/models/rank_spec.rb +53 -0
- data/spec/models/rankings_spec.rb +41 -0
- data/spec/models/related_stories_spec.rb +21 -38
- data/spec/models/representative_story_spec.rb +59 -0
- data/spec/models/scope_level_spec.rb +35 -0
- data/spec/models/scope_spec.rb +23 -40
- data/spec/models/sentiment_polarity_spec.rb +35 -0
- data/spec/models/sentiment_spec.rb +17 -26
- data/spec/models/sentiments_spec.rb +19 -28
- data/spec/models/share_count_spec.rb +17 -26
- data/spec/models/share_counts_spec.rb +19 -36
- data/spec/models/source_spec.rb +54 -49
- data/spec/models/stories_spec.rb +26 -33
- data/spec/models/story_cluster_spec.rb +23 -44
- data/spec/models/story_links_spec.rb +25 -32
- data/spec/models/story_spec.rb +65 -134
- data/spec/models/story_translation_spec.rb +47 -0
- data/spec/models/story_translations_en_spec.rb +53 -0
- data/spec/models/story_translations_spec.rb +41 -0
- data/spec/models/summary_spec.rb +16 -21
- data/spec/models/time_series_list_spec.rb +22 -39
- data/spec/models/time_series_spec.rb +19 -28
- data/spec/models/trend_spec.rb +19 -28
- data/spec/models/trends_spec.rb +30 -27
- data/spec/spec_helper.rb +11 -13
- metadata +95 -193
- data/Gemfile.lock +0 -65
- data/LICENSE +0 -13
@@ -0,0 +1,37 @@
|
|
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 ScopeLevel
|
17
|
+
INTERNATIONAL = "international".freeze
|
18
|
+
NATIONAL = "national".freeze
|
19
|
+
LOCAL = "local".freeze
|
20
|
+
|
21
|
+
# Builds the enum from string
|
22
|
+
# @param [String] The enum value in the form of the string
|
23
|
+
# @return [String] The enum value
|
24
|
+
def self.build_from_hash(value)
|
25
|
+
new.build_from_hash(value)
|
26
|
+
end
|
27
|
+
|
28
|
+
# Builds the enum from string
|
29
|
+
# @param [String] The enum value in the form of the string
|
30
|
+
# @return [String] The enum value
|
31
|
+
def build_from_hash(value)
|
32
|
+
constantValues = ScopeLevel.constants.select { |c| ScopeLevel::const_get(c) == value }
|
33
|
+
raise "Invalid ENUM value #{value} for class #ScopeLevel" if constantValues.empty?
|
34
|
+
value
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -1,50 +1,24 @@
|
|
1
|
-
|
2
|
-
#
|
3
|
-
|
4
|
-
#
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
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
|
14
12
|
|
15
13
|
require 'date'
|
16
14
|
|
17
15
|
module AylienNewsApi
|
18
|
-
|
19
16
|
class Sentiment
|
20
|
-
# Polarity of the sentiment
|
21
17
|
attr_accessor :polarity
|
22
18
|
|
23
19
|
# Polarity score of the sentiment
|
24
20
|
attr_accessor :score
|
25
21
|
|
26
|
-
class EnumAttributeValidator
|
27
|
-
attr_reader :datatype
|
28
|
-
attr_reader :allowable_values
|
29
|
-
|
30
|
-
def initialize(datatype, allowable_values)
|
31
|
-
@allowable_values = allowable_values.map do |value|
|
32
|
-
case datatype.to_s
|
33
|
-
when /Integer/i
|
34
|
-
value.to_i
|
35
|
-
when /Float/i
|
36
|
-
value.to_f
|
37
|
-
else
|
38
|
-
value
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
def valid?(value)
|
44
|
-
!value || allowable_values.include?(value)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
22
|
# Attribute mapping from ruby-style variable name to JSON key.
|
49
23
|
def self.attribute_map
|
50
24
|
{
|
@@ -54,71 +28,75 @@ module AylienNewsApi
|
|
54
28
|
end
|
55
29
|
|
56
30
|
# Attribute type mapping.
|
57
|
-
def self.
|
31
|
+
def self.openapi_types
|
58
32
|
{
|
59
|
-
:'polarity' => :'
|
33
|
+
:'polarity' => :'SentimentPolarity',
|
60
34
|
:'score' => :'Float'
|
61
35
|
}
|
62
36
|
end
|
63
37
|
|
38
|
+
# List of attributes with nullable: true
|
39
|
+
def self.openapi_nullable
|
40
|
+
Set.new([
|
41
|
+
])
|
42
|
+
end
|
43
|
+
|
64
44
|
# Initializes the object
|
65
45
|
# @param [Hash] attributes Model attributes in the form of hash
|
66
46
|
def initialize(attributes = {})
|
67
|
-
|
47
|
+
if (!attributes.is_a?(Hash))
|
48
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::Sentiment` initialize method"
|
49
|
+
end
|
68
50
|
|
69
|
-
# convert string to symbol for hash key
|
70
|
-
attributes = attributes.each_with_object({}){|(k,v), h|
|
51
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
52
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
53
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
54
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `AylienNewsApi::Sentiment`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
55
|
+
end
|
56
|
+
h[k.to_sym] = v
|
57
|
+
}
|
71
58
|
|
72
|
-
if attributes.
|
59
|
+
if attributes.key?(:'polarity')
|
73
60
|
self.polarity = attributes[:'polarity']
|
74
61
|
end
|
75
62
|
|
76
|
-
if attributes.
|
63
|
+
if attributes.key?(:'score')
|
77
64
|
self.score = attributes[:'score']
|
78
65
|
end
|
79
|
-
|
80
66
|
end
|
81
67
|
|
82
68
|
# Show invalid properties with the reasons. Usually used together with valid?
|
83
|
-
# @return Array for valid
|
69
|
+
# @return Array for valid properties with the reasons
|
84
70
|
def list_invalid_properties
|
85
71
|
invalid_properties = Array.new
|
86
|
-
|
72
|
+
if !@score.nil? && @score > 1
|
73
|
+
invalid_properties.push('invalid value for "score", must be smaller than or equal to 1.')
|
74
|
+
end
|
75
|
+
|
76
|
+
if !@score.nil? && @score < 0
|
77
|
+
invalid_properties.push('invalid value for "score", must be greater than or equal to 0.')
|
78
|
+
end
|
79
|
+
|
80
|
+
invalid_properties
|
87
81
|
end
|
88
82
|
|
89
83
|
# Check to see if the all the properties in the model are valid
|
90
84
|
# @return true if the model is valid
|
91
85
|
def valid?
|
92
|
-
|
93
|
-
return false
|
94
|
-
|
95
|
-
return false if @score < 0.0
|
96
|
-
return true
|
97
|
-
end
|
98
|
-
|
99
|
-
# Custom attribute writer method checking allowed values (enum).
|
100
|
-
# @param [Object] polarity Object to be assigned
|
101
|
-
def polarity=(polarity)
|
102
|
-
validator = EnumAttributeValidator.new('String', ["positive", "neutral", "negative"])
|
103
|
-
unless validator.valid?(polarity)
|
104
|
-
fail ArgumentError, "invalid value for 'polarity', must be one of #{validator.allowable_values}."
|
105
|
-
end
|
106
|
-
@polarity = polarity
|
86
|
+
return false if !@score.nil? && @score > 1
|
87
|
+
return false if !@score.nil? && @score < 0
|
88
|
+
true
|
107
89
|
end
|
108
90
|
|
109
91
|
# Custom attribute writer method with validation
|
110
92
|
# @param [Object] score Value to be assigned
|
111
93
|
def score=(score)
|
112
|
-
if score.nil?
|
113
|
-
fail ArgumentError, "score
|
114
|
-
end
|
115
|
-
|
116
|
-
if score > 1.0
|
117
|
-
fail ArgumentError, "invalid value for 'score', must be smaller than or equal to 1.0."
|
94
|
+
if !score.nil? && score > 1
|
95
|
+
fail ArgumentError, 'invalid value for "score", must be smaller than or equal to 1.'
|
118
96
|
end
|
119
97
|
|
120
|
-
if score < 0
|
121
|
-
fail ArgumentError,
|
98
|
+
if !score.nil? && score < 0
|
99
|
+
fail ArgumentError, 'invalid value for "score", must be greater than or equal to 0.'
|
122
100
|
end
|
123
101
|
|
124
102
|
@score = score
|
@@ -140,22 +118,29 @@ module AylienNewsApi
|
|
140
118
|
end
|
141
119
|
|
142
120
|
# Calculates hash code according to all attributes.
|
143
|
-
# @return [
|
121
|
+
# @return [Integer] Hash code
|
144
122
|
def hash
|
145
123
|
[polarity, score].hash
|
146
124
|
end
|
147
125
|
|
126
|
+
# Builds the object from hash
|
127
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
128
|
+
# @return [Object] Returns the model itself
|
129
|
+
def self.build_from_hash(attributes)
|
130
|
+
new.build_from_hash(attributes)
|
131
|
+
end
|
132
|
+
|
148
133
|
# Builds the object from hash
|
149
134
|
# @param [Hash] attributes Model attributes in the form of hash
|
150
135
|
# @return [Object] Returns the model itself
|
151
136
|
def build_from_hash(attributes)
|
152
137
|
return nil unless attributes.is_a?(Hash)
|
153
|
-
self.class.
|
154
|
-
if type =~
|
155
|
-
# check to ensure the input is an array given that the
|
138
|
+
self.class.openapi_types.each_pair do |key, type|
|
139
|
+
if type =~ /\AArray<(.*)>/i
|
140
|
+
# check to ensure the input is an array given that the attribute
|
156
141
|
# is documented as an array but the input is not
|
157
142
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
158
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) }
|
143
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
159
144
|
end
|
160
145
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
161
146
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
@@ -181,8 +166,8 @@ module AylienNewsApi
|
|
181
166
|
value.to_i
|
182
167
|
when :Float
|
183
168
|
value.to_f
|
184
|
-
when :
|
185
|
-
if value.to_s =~
|
169
|
+
when :Boolean
|
170
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
186
171
|
true
|
187
172
|
else
|
188
173
|
false
|
@@ -193,7 +178,7 @@ module AylienNewsApi
|
|
193
178
|
when /\AArray<(?<inner_type>.+)>\z/
|
194
179
|
inner_type = Regexp.last_match[:inner_type]
|
195
180
|
value.map { |v| _deserialize(inner_type, v) }
|
196
|
-
when /\AHash<(?<k_type
|
181
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
197
182
|
k_type = Regexp.last_match[:k_type]
|
198
183
|
v_type = Regexp.last_match[:v_type]
|
199
184
|
{}.tap do |hash|
|
@@ -202,8 +187,7 @@ module AylienNewsApi
|
|
202
187
|
end
|
203
188
|
end
|
204
189
|
else # model
|
205
|
-
|
206
|
-
temp_model.build_from_hash(value)
|
190
|
+
AylienNewsApi.const_get(type).build_from_hash(value)
|
207
191
|
end
|
208
192
|
end
|
209
193
|
|
@@ -225,7 +209,11 @@ module AylienNewsApi
|
|
225
209
|
hash = {}
|
226
210
|
self.class.attribute_map.each_pair do |attr, param|
|
227
211
|
value = self.send(attr)
|
228
|
-
|
212
|
+
if value.nil?
|
213
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
214
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
215
|
+
end
|
216
|
+
|
229
217
|
hash[param] = _to_hash(value)
|
230
218
|
end
|
231
219
|
hash
|
@@ -237,7 +225,7 @@ module AylienNewsApi
|
|
237
225
|
# @return [Hash] Returns the value in the form of hash
|
238
226
|
def _to_hash(value)
|
239
227
|
if value.is_a?(Array)
|
240
|
-
value.compact.map{ |v| _to_hash(v) }
|
228
|
+
value.compact.map { |v| _to_hash(v) }
|
241
229
|
elsif value.is_a?(Hash)
|
242
230
|
{}.tap do |hash|
|
243
231
|
value.each { |k, v| hash[k] = _to_hash(v) }
|
@@ -248,7 +236,5 @@ module AylienNewsApi
|
|
248
236
|
value
|
249
237
|
end
|
250
238
|
end
|
251
|
-
|
252
239
|
end
|
253
|
-
|
254
240
|
end
|
@@ -0,0 +1,37 @@
|
|
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 SentimentPolarity
|
17
|
+
POSITIVE = "positive".freeze
|
18
|
+
NEUTRAL = "neutral".freeze
|
19
|
+
NEGATIVE = "negative".freeze
|
20
|
+
|
21
|
+
# Builds the enum from string
|
22
|
+
# @param [String] The enum value in the form of the string
|
23
|
+
# @return [String] The enum value
|
24
|
+
def self.build_from_hash(value)
|
25
|
+
new.build_from_hash(value)
|
26
|
+
end
|
27
|
+
|
28
|
+
# Builds the enum from string
|
29
|
+
# @param [String] The enum value in the form of the string
|
30
|
+
# @return [String] The enum value
|
31
|
+
def build_from_hash(value)
|
32
|
+
constantValues = SentimentPolarity.constants.select { |c| SentimentPolarity::const_get(c) == value }
|
33
|
+
raise "Invalid ENUM value #{value} for class #SentimentPolarity" if constantValues.empty?
|
34
|
+
value
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -1,74 +1,80 @@
|
|
1
|
-
|
2
|
-
#
|
3
|
-
|
4
|
-
#
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
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
|
14
12
|
|
15
13
|
require 'date'
|
16
14
|
|
17
15
|
module AylienNewsApi
|
18
|
-
|
19
16
|
class Sentiments
|
20
|
-
# The sentiment for the story title
|
21
|
-
attr_accessor :title
|
22
|
-
|
23
|
-
# The sentiment for the story body
|
24
17
|
attr_accessor :body
|
25
18
|
|
19
|
+
attr_accessor :title
|
26
20
|
|
27
21
|
# Attribute mapping from ruby-style variable name to JSON key.
|
28
22
|
def self.attribute_map
|
29
23
|
{
|
30
|
-
:'
|
31
|
-
:'
|
24
|
+
:'body' => :'body',
|
25
|
+
:'title' => :'title'
|
32
26
|
}
|
33
27
|
end
|
34
28
|
|
35
29
|
# Attribute type mapping.
|
36
|
-
def self.
|
30
|
+
def self.openapi_types
|
37
31
|
{
|
38
|
-
:'
|
39
|
-
:'
|
32
|
+
:'body' => :'Sentiment',
|
33
|
+
:'title' => :'Sentiment'
|
40
34
|
}
|
41
35
|
end
|
42
36
|
|
37
|
+
# List of attributes with nullable: true
|
38
|
+
def self.openapi_nullable
|
39
|
+
Set.new([
|
40
|
+
])
|
41
|
+
end
|
42
|
+
|
43
43
|
# Initializes the object
|
44
44
|
# @param [Hash] attributes Model attributes in the form of hash
|
45
45
|
def initialize(attributes = {})
|
46
|
-
|
47
|
-
|
48
|
-
# convert string to symbol for hash key
|
49
|
-
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
50
|
-
|
51
|
-
if attributes.has_key?(:'title')
|
52
|
-
self.title = attributes[:'title']
|
46
|
+
if (!attributes.is_a?(Hash))
|
47
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::Sentiments` initialize method"
|
53
48
|
end
|
54
49
|
|
55
|
-
if
|
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::Sentiments`. 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?(:'body')
|
56
59
|
self.body = attributes[:'body']
|
57
60
|
end
|
58
61
|
|
62
|
+
if attributes.key?(:'title')
|
63
|
+
self.title = attributes[:'title']
|
64
|
+
end
|
59
65
|
end
|
60
66
|
|
61
67
|
# Show invalid properties with the reasons. Usually used together with valid?
|
62
|
-
# @return Array for valid
|
68
|
+
# @return Array for valid properties with the reasons
|
63
69
|
def list_invalid_properties
|
64
70
|
invalid_properties = Array.new
|
65
|
-
|
71
|
+
invalid_properties
|
66
72
|
end
|
67
73
|
|
68
74
|
# Check to see if the all the properties in the model are valid
|
69
75
|
# @return true if the model is valid
|
70
76
|
def valid?
|
71
|
-
|
77
|
+
true
|
72
78
|
end
|
73
79
|
|
74
80
|
# Checks equality by comparing each attribute.
|
@@ -76,8 +82,8 @@ module AylienNewsApi
|
|
76
82
|
def ==(o)
|
77
83
|
return true if self.equal?(o)
|
78
84
|
self.class == o.class &&
|
79
|
-
|
80
|
-
|
85
|
+
body == o.body &&
|
86
|
+
title == o.title
|
81
87
|
end
|
82
88
|
|
83
89
|
# @see the `==` method
|
@@ -87,9 +93,16 @@ module AylienNewsApi
|
|
87
93
|
end
|
88
94
|
|
89
95
|
# Calculates hash code according to all attributes.
|
90
|
-
# @return [
|
96
|
+
# @return [Integer] Hash code
|
91
97
|
def hash
|
92
|
-
[
|
98
|
+
[body, title].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)
|
93
106
|
end
|
94
107
|
|
95
108
|
# Builds the object from hash
|
@@ -97,12 +110,12 @@ module AylienNewsApi
|
|
97
110
|
# @return [Object] Returns the model itself
|
98
111
|
def build_from_hash(attributes)
|
99
112
|
return nil unless attributes.is_a?(Hash)
|
100
|
-
self.class.
|
101
|
-
if type =~
|
102
|
-
# check to ensure the input is an array given that the
|
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
|
103
116
|
# is documented as an array but the input is not
|
104
117
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
105
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) }
|
118
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
106
119
|
end
|
107
120
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
108
121
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
@@ -128,8 +141,8 @@ module AylienNewsApi
|
|
128
141
|
value.to_i
|
129
142
|
when :Float
|
130
143
|
value.to_f
|
131
|
-
when :
|
132
|
-
if value.to_s =~
|
144
|
+
when :Boolean
|
145
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
133
146
|
true
|
134
147
|
else
|
135
148
|
false
|
@@ -140,7 +153,7 @@ module AylienNewsApi
|
|
140
153
|
when /\AArray<(?<inner_type>.+)>\z/
|
141
154
|
inner_type = Regexp.last_match[:inner_type]
|
142
155
|
value.map { |v| _deserialize(inner_type, v) }
|
143
|
-
when /\AHash<(?<k_type
|
156
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
144
157
|
k_type = Regexp.last_match[:k_type]
|
145
158
|
v_type = Regexp.last_match[:v_type]
|
146
159
|
{}.tap do |hash|
|
@@ -149,8 +162,7 @@ module AylienNewsApi
|
|
149
162
|
end
|
150
163
|
end
|
151
164
|
else # model
|
152
|
-
|
153
|
-
temp_model.build_from_hash(value)
|
165
|
+
AylienNewsApi.const_get(type).build_from_hash(value)
|
154
166
|
end
|
155
167
|
end
|
156
168
|
|
@@ -172,7 +184,11 @@ module AylienNewsApi
|
|
172
184
|
hash = {}
|
173
185
|
self.class.attribute_map.each_pair do |attr, param|
|
174
186
|
value = self.send(attr)
|
175
|
-
|
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
|
+
|
176
192
|
hash[param] = _to_hash(value)
|
177
193
|
end
|
178
194
|
hash
|
@@ -184,7 +200,7 @@ module AylienNewsApi
|
|
184
200
|
# @return [Hash] Returns the value in the form of hash
|
185
201
|
def _to_hash(value)
|
186
202
|
if value.is_a?(Array)
|
187
|
-
value.compact.map{ |v| _to_hash(v) }
|
203
|
+
value.compact.map { |v| _to_hash(v) }
|
188
204
|
elsif value.is_a?(Hash)
|
189
205
|
{}.tap do |hash|
|
190
206
|
value.each { |k, v| hash[k] = _to_hash(v) }
|
@@ -195,7 +211,5 @@ module AylienNewsApi
|
|
195
211
|
value
|
196
212
|
end
|
197
213
|
end
|
198
|
-
|
199
214
|
end
|
200
|
-
|
201
215
|
end
|