aylien_news_api 1.0.0 → 3.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 +6 -0
- data/README.md +117 -4
- data/Rakefile +2 -0
- data/aylien_news_api.gemspec +16 -27
- data/docs/Author.md +12 -1
- data/docs/Autocomplete.md +10 -0
- data/docs/Autocompletes.md +9 -0
- data/docs/Category.md +17 -3
- data/docs/CategoryLinks.md +11 -1
- data/docs/Cluster.md +29 -0
- data/docs/Clusters.md +21 -0
- data/docs/Coverages.md +16 -4
- data/docs/DefaultApi.md +1250 -1117
- 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 +16 -3
- data/docs/Location.md +13 -2
- data/docs/Media.md +17 -3
- data/docs/Rank.md +12 -1
- data/docs/Rankings.md +9 -0
- data/docs/RelatedStories.md +14 -3
- data/docs/RepresentativeStory.md +23 -0
- data/docs/Scope.md +14 -2
- data/docs/Sentiment.md +10 -0
- data/docs/Sentiments.md +12 -2
- data/docs/ShareCount.md +10 -0
- data/docs/ShareCounts.md +12 -0
- data/docs/Source.md +27 -8
- data/docs/Stories.md +11 -2
- data/docs/Story.md +48 -16
- data/docs/StoryCluster.md +14 -1
- data/docs/StoryLinks.md +14 -2
- 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 +11 -1
- data/git_push.sh +58 -0
- data/lib/aylien_news_api.rb +11 -10
- data/lib/aylien_news_api/api/default_api.rb +2065 -1801
- data/lib/aylien_news_api/api_client.rb +129 -108
- data/lib/aylien_news_api/api_error.rb +25 -10
- data/lib/aylien_news_api/configuration.rb +69 -33
- data/lib/aylien_news_api/models/author.rb +50 -46
- data/lib/aylien_news_api/models/autocomplete.rb +36 -32
- data/lib/aylien_news_api/models/autocompletes.rb +35 -31
- data/lib/aylien_news_api/models/category.rb +63 -59
- data/lib/aylien_news_api/models/category_links.rb +47 -43
- data/lib/aylien_news_api/models/cluster.rb +255 -0
- data/lib/aylien_news_api/models/clusters.rb +219 -0
- data/lib/aylien_news_api/models/coverages.rb +60 -68
- data/lib/aylien_news_api/models/entities.rb +48 -44
- data/lib/aylien_news_api/models/entity.rb +71 -69
- data/lib/aylien_news_api/models/entity_links.rb +35 -31
- data/lib/aylien_news_api/models/error.rb +60 -56
- data/lib/aylien_news_api/models/error_links.rb +35 -31
- data/lib/aylien_news_api/models/errors.rb +35 -31
- data/lib/aylien_news_api/models/histogram_interval.rb +36 -32
- data/lib/aylien_news_api/models/histograms.rb +62 -58
- data/lib/aylien_news_api/models/location.rb +51 -47
- data/lib/aylien_news_api/models/media.rb +81 -76
- data/lib/aylien_news_api/models/rank.rb +48 -44
- data/lib/aylien_news_api/models/rankings.rb +35 -31
- data/lib/aylien_news_api/models/related_stories.rb +53 -61
- data/lib/aylien_news_api/models/representative_story.rb +227 -0
- data/lib/aylien_news_api/models/scope.rb +59 -54
- data/lib/aylien_news_api/models/sentiment.rb +41 -37
- data/lib/aylien_news_api/models/sentiments.rb +46 -44
- data/lib/aylien_news_api/models/share_count.rb +36 -32
- data/lib/aylien_news_api/models/share_counts.rb +38 -34
- data/lib/aylien_news_api/models/source.rb +95 -92
- data/lib/aylien_news_api/models/stories.rb +47 -55
- data/lib/aylien_news_api/models/story.rb +172 -154
- data/lib/aylien_news_api/models/story_cluster.rb +52 -48
- data/lib/aylien_news_api/models/story_links.rb +58 -54
- data/lib/aylien_news_api/models/story_translations.rb +197 -0
- data/lib/aylien_news_api/models/story_translations_en.rb +217 -0
- data/lib/aylien_news_api/models/summary.rb +35 -31
- data/lib/aylien_news_api/models/time_series.rb +47 -43
- data/lib/aylien_news_api/models/time_series_list.rb +56 -52
- data/lib/aylien_news_api/models/trend.rb +47 -43
- data/lib/aylien_news_api/models/trends.rb +48 -44
- data/lib/aylien_news_api/version.rb +7 -11
- data/spec/api/default_api_spec.rb +569 -533
- data/spec/api_client_spec.rb +34 -76
- data/spec/configuration_spec.rb +14 -18
- data/spec/models/author_spec.rb +15 -18
- data/spec/models/autocomplete_spec.rb +11 -14
- data/spec/models/autocompletes_spec.rb +10 -13
- data/spec/models/category_links_spec.rb +13 -16
- data/spec/models/category_spec.rb +24 -27
- data/spec/models/cluster_spec.rb +77 -0
- data/spec/models/clusters_spec.rb +53 -0
- data/spec/models/coverages_spec.rb +17 -26
- data/spec/models/entities_spec.rb +13 -16
- data/spec/models/entity_links_spec.rb +10 -13
- data/spec/models/entity_spec.rb +19 -22
- data/spec/models/error_links_spec.rb +10 -13
- data/spec/models/error_spec.rb +21 -24
- data/spec/models/errors_spec.rb +10 -13
- data/spec/models/histogram_interval_spec.rb +11 -14
- data/spec/models/histograms_spec.rb +18 -21
- data/spec/models/location_spec.rb +15 -18
- data/spec/models/media_spec.rb +29 -32
- data/spec/models/rank_spec.rb +15 -18
- data/spec/models/rankings_spec.rb +10 -13
- data/spec/models/related_stories_spec.rb +15 -24
- data/spec/models/representative_story_spec.rb +59 -0
- data/spec/models/scope_spec.rb +21 -24
- data/spec/models/sentiment_spec.rb +15 -18
- data/spec/models/sentiments_spec.rb +13 -16
- data/spec/models/share_count_spec.rb +11 -14
- data/spec/models/share_counts_spec.rb +13 -16
- data/spec/models/source_spec.rb +29 -32
- data/spec/models/stories_spec.rb +13 -22
- data/spec/models/story_cluster_spec.rb +17 -20
- data/spec/models/story_links_spec.rb +17 -20
- data/spec/models/story_spec.rb +59 -50
- 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 +10 -13
- data/spec/models/time_series_list_spec.rb +16 -19
- data/spec/models/time_series_spec.rb +13 -16
- data/spec/models/trend_spec.rb +13 -16
- data/spec/models/trends_spec.rb +13 -16
- data/spec/spec_helper.rb +6 -10
- metadata +68 -194
@@ -1,41 +1,35 @@
|
|
1
1
|
=begin
|
2
|
-
|
2
|
+
#AYLIEN News API
|
3
3
|
|
4
|
-
|
5
|
-
you may not use this file except in compliance with the License.
|
6
|
-
You may obtain a copy of the License at
|
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.
|
7
5
|
|
8
|
-
|
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: 4.1.3-SNAPSHOT
|
9
10
|
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
See the License for the specific language governing permissions and
|
14
|
-
limitations under the License.
|
15
11
|
=end
|
16
12
|
|
17
13
|
require 'date'
|
18
14
|
|
19
15
|
module AylienNewsApi
|
20
|
-
|
21
16
|
class Category
|
17
|
+
# It defines whether the extracted category is confident or not
|
18
|
+
attr_accessor :confident
|
19
|
+
|
22
20
|
# The ID of the category
|
23
21
|
attr_accessor :id
|
24
22
|
|
25
|
-
# The taxonomy of the category
|
26
|
-
attr_accessor :taxonomy
|
27
|
-
|
28
23
|
# The level of the category
|
29
24
|
attr_accessor :level
|
30
25
|
|
26
|
+
attr_accessor :links
|
27
|
+
|
31
28
|
# The score of the category
|
32
29
|
attr_accessor :score
|
33
30
|
|
34
|
-
#
|
35
|
-
attr_accessor :
|
36
|
-
|
37
|
-
# Related links for the category
|
38
|
-
attr_accessor :links
|
31
|
+
# The taxonomy of the category
|
32
|
+
attr_accessor :taxonomy
|
39
33
|
|
40
34
|
class EnumAttributeValidator
|
41
35
|
attr_reader :datatype
|
@@ -62,66 +56,72 @@ module AylienNewsApi
|
|
62
56
|
# Attribute mapping from ruby-style variable name to JSON key.
|
63
57
|
def self.attribute_map
|
64
58
|
{
|
59
|
+
:'confident' => :'confident',
|
65
60
|
:'id' => :'id',
|
66
|
-
:'taxonomy' => :'taxonomy',
|
67
61
|
:'level' => :'level',
|
62
|
+
:'links' => :'links',
|
68
63
|
:'score' => :'score',
|
69
|
-
:'
|
70
|
-
:'links' => :'links'
|
64
|
+
:'taxonomy' => :'taxonomy'
|
71
65
|
}
|
72
66
|
end
|
73
67
|
|
74
68
|
# Attribute type mapping.
|
75
|
-
def self.
|
69
|
+
def self.openapi_types
|
76
70
|
{
|
71
|
+
:'confident' => :'Boolean',
|
77
72
|
:'id' => :'String',
|
78
|
-
:'taxonomy' => :'String',
|
79
73
|
:'level' => :'Integer',
|
74
|
+
:'links' => :'CategoryLinks',
|
80
75
|
:'score' => :'Float',
|
81
|
-
:'
|
82
|
-
:'links' => :'CategoryLinks'
|
76
|
+
:'taxonomy' => :'String'
|
83
77
|
}
|
84
78
|
end
|
85
79
|
|
86
80
|
# Initializes the object
|
87
81
|
# @param [Hash] attributes Model attributes in the form of hash
|
88
82
|
def initialize(attributes = {})
|
89
|
-
|
83
|
+
if (!attributes.is_a?(Hash))
|
84
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::Category` initialize method"
|
85
|
+
end
|
90
86
|
|
91
|
-
# convert string to symbol for hash key
|
92
|
-
attributes = attributes.each_with_object({}){|(k,v), h|
|
87
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
88
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
89
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
90
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `AylienNewsApi::Category`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
91
|
+
end
|
92
|
+
h[k.to_sym] = v
|
93
|
+
}
|
93
94
|
|
94
|
-
if attributes.
|
95
|
-
self.
|
95
|
+
if attributes.key?(:'confident')
|
96
|
+
self.confident = attributes[:'confident']
|
96
97
|
end
|
97
98
|
|
98
|
-
if attributes.
|
99
|
-
self.
|
99
|
+
if attributes.key?(:'id')
|
100
|
+
self.id = attributes[:'id']
|
100
101
|
end
|
101
102
|
|
102
|
-
if attributes.
|
103
|
+
if attributes.key?(:'level')
|
103
104
|
self.level = attributes[:'level']
|
104
105
|
end
|
105
106
|
|
106
|
-
if attributes.
|
107
|
-
self.
|
107
|
+
if attributes.key?(:'links')
|
108
|
+
self.links = attributes[:'links']
|
108
109
|
end
|
109
110
|
|
110
|
-
if attributes.
|
111
|
-
self.
|
111
|
+
if attributes.key?(:'score')
|
112
|
+
self.score = attributes[:'score']
|
112
113
|
end
|
113
114
|
|
114
|
-
if attributes.
|
115
|
-
self.
|
115
|
+
if attributes.key?(:'taxonomy')
|
116
|
+
self.taxonomy = attributes[:'taxonomy']
|
116
117
|
end
|
117
|
-
|
118
118
|
end
|
119
119
|
|
120
120
|
# Show invalid properties with the reasons. Usually used together with valid?
|
121
|
-
# @return Array for valid
|
121
|
+
# @return Array for valid properties with the reasons
|
122
122
|
def list_invalid_properties
|
123
123
|
invalid_properties = Array.new
|
124
|
-
|
124
|
+
invalid_properties
|
125
125
|
end
|
126
126
|
|
127
127
|
# Check to see if the all the properties in the model are valid
|
@@ -129,7 +129,7 @@ module AylienNewsApi
|
|
129
129
|
def valid?
|
130
130
|
taxonomy_validator = EnumAttributeValidator.new('String', ["iab-qag", "iptc-subjectcode"])
|
131
131
|
return false unless taxonomy_validator.valid?(@taxonomy)
|
132
|
-
|
132
|
+
true
|
133
133
|
end
|
134
134
|
|
135
135
|
# Custom attribute writer method checking allowed values (enum).
|
@@ -137,7 +137,7 @@ module AylienNewsApi
|
|
137
137
|
def taxonomy=(taxonomy)
|
138
138
|
validator = EnumAttributeValidator.new('String', ["iab-qag", "iptc-subjectcode"])
|
139
139
|
unless validator.valid?(taxonomy)
|
140
|
-
fail ArgumentError, "invalid value for
|
140
|
+
fail ArgumentError, "invalid value for \"taxonomy\", must be one of #{validator.allowable_values}."
|
141
141
|
end
|
142
142
|
@taxonomy = taxonomy
|
143
143
|
end
|
@@ -147,12 +147,12 @@ module AylienNewsApi
|
|
147
147
|
def ==(o)
|
148
148
|
return true if self.equal?(o)
|
149
149
|
self.class == o.class &&
|
150
|
+
confident == o.confident &&
|
150
151
|
id == o.id &&
|
151
|
-
taxonomy == o.taxonomy &&
|
152
152
|
level == o.level &&
|
153
|
+
links == o.links &&
|
153
154
|
score == o.score &&
|
154
|
-
|
155
|
-
links == o.links
|
155
|
+
taxonomy == o.taxonomy
|
156
156
|
end
|
157
157
|
|
158
158
|
# @see the `==` method
|
@@ -162,9 +162,16 @@ module AylienNewsApi
|
|
162
162
|
end
|
163
163
|
|
164
164
|
# Calculates hash code according to all attributes.
|
165
|
-
# @return [
|
165
|
+
# @return [Integer] Hash code
|
166
166
|
def hash
|
167
|
-
[
|
167
|
+
[confident, id, level, links, score, taxonomy].hash
|
168
|
+
end
|
169
|
+
|
170
|
+
# Builds the object from hash
|
171
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
172
|
+
# @return [Object] Returns the model itself
|
173
|
+
def self.build_from_hash(attributes)
|
174
|
+
new.build_from_hash(attributes)
|
168
175
|
end
|
169
176
|
|
170
177
|
# Builds the object from hash
|
@@ -172,12 +179,12 @@ module AylienNewsApi
|
|
172
179
|
# @return [Object] Returns the model itself
|
173
180
|
def build_from_hash(attributes)
|
174
181
|
return nil unless attributes.is_a?(Hash)
|
175
|
-
self.class.
|
182
|
+
self.class.openapi_types.each_pair do |key, type|
|
176
183
|
if type =~ /\AArray<(.*)>/i
|
177
|
-
# check to ensure the input is an array given that the
|
184
|
+
# check to ensure the input is an array given that the attribute
|
178
185
|
# is documented as an array but the input is not
|
179
186
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
180
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) }
|
187
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
181
188
|
end
|
182
189
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
183
190
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
@@ -203,7 +210,7 @@ module AylienNewsApi
|
|
203
210
|
value.to_i
|
204
211
|
when :Float
|
205
212
|
value.to_f
|
206
|
-
when :
|
213
|
+
when :Boolean
|
207
214
|
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
208
215
|
true
|
209
216
|
else
|
@@ -224,8 +231,7 @@ module AylienNewsApi
|
|
224
231
|
end
|
225
232
|
end
|
226
233
|
else # model
|
227
|
-
|
228
|
-
temp_model.build_from_hash(value)
|
234
|
+
AylienNewsApi.const_get(type).build_from_hash(value)
|
229
235
|
end
|
230
236
|
end
|
231
237
|
|
@@ -259,7 +265,7 @@ module AylienNewsApi
|
|
259
265
|
# @return [Hash] Returns the value in the form of hash
|
260
266
|
def _to_hash(value)
|
261
267
|
if value.is_a?(Array)
|
262
|
-
value.compact.map{ |v| _to_hash(v) }
|
268
|
+
value.compact.map { |v| _to_hash(v) }
|
263
269
|
elsif value.is_a?(Hash)
|
264
270
|
{}.tap do |hash|
|
265
271
|
value.each { |k, v| hash[k] = _to_hash(v) }
|
@@ -270,7 +276,5 @@ module AylienNewsApi
|
|
270
276
|
value
|
271
277
|
end
|
272
278
|
end
|
273
|
-
|
274
279
|
end
|
275
|
-
|
276
280
|
end
|
@@ -1,76 +1,76 @@
|
|
1
1
|
=begin
|
2
|
-
|
2
|
+
#AYLIEN News API
|
3
3
|
|
4
|
-
|
5
|
-
you may not use this file except in compliance with the License.
|
6
|
-
You may obtain a copy of the License at
|
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.
|
7
5
|
|
8
|
-
|
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: 4.1.3-SNAPSHOT
|
9
10
|
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
See the License for the specific language governing permissions and
|
14
|
-
limitations under the License.
|
15
11
|
=end
|
16
12
|
|
17
13
|
require 'date'
|
18
14
|
|
19
15
|
module AylienNewsApi
|
20
|
-
|
21
16
|
class CategoryLinks
|
22
|
-
# A URL pointing to the category
|
23
|
-
attr_accessor :_self
|
24
|
-
|
25
17
|
# A URL pointing to the parent category
|
26
18
|
attr_accessor :parent
|
27
19
|
|
20
|
+
# A URL pointing to the category
|
21
|
+
attr_accessor :_self
|
28
22
|
|
29
23
|
# Attribute mapping from ruby-style variable name to JSON key.
|
30
24
|
def self.attribute_map
|
31
25
|
{
|
32
|
-
:'
|
33
|
-
:'
|
26
|
+
:'parent' => :'parent',
|
27
|
+
:'_self' => :'self'
|
34
28
|
}
|
35
29
|
end
|
36
30
|
|
37
31
|
# Attribute type mapping.
|
38
|
-
def self.
|
32
|
+
def self.openapi_types
|
39
33
|
{
|
40
|
-
:'
|
41
|
-
:'
|
34
|
+
:'parent' => :'String',
|
35
|
+
:'_self' => :'String'
|
42
36
|
}
|
43
37
|
end
|
44
38
|
|
45
39
|
# Initializes the object
|
46
40
|
# @param [Hash] attributes Model attributes in the form of hash
|
47
41
|
def initialize(attributes = {})
|
48
|
-
|
49
|
-
|
50
|
-
# convert string to symbol for hash key
|
51
|
-
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
52
|
-
|
53
|
-
if attributes.has_key?(:'self')
|
54
|
-
self._self = attributes[:'self']
|
42
|
+
if (!attributes.is_a?(Hash))
|
43
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::CategoryLinks` initialize method"
|
55
44
|
end
|
56
45
|
|
57
|
-
if
|
46
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
47
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
48
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
49
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `AylienNewsApi::CategoryLinks`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
50
|
+
end
|
51
|
+
h[k.to_sym] = v
|
52
|
+
}
|
53
|
+
|
54
|
+
if attributes.key?(:'parent')
|
58
55
|
self.parent = attributes[:'parent']
|
59
56
|
end
|
60
57
|
|
58
|
+
if attributes.key?(:'_self')
|
59
|
+
self._self = attributes[:'_self']
|
60
|
+
end
|
61
61
|
end
|
62
62
|
|
63
63
|
# Show invalid properties with the reasons. Usually used together with valid?
|
64
|
-
# @return Array for valid
|
64
|
+
# @return Array for valid properties with the reasons
|
65
65
|
def list_invalid_properties
|
66
66
|
invalid_properties = Array.new
|
67
|
-
|
67
|
+
invalid_properties
|
68
68
|
end
|
69
69
|
|
70
70
|
# Check to see if the all the properties in the model are valid
|
71
71
|
# @return true if the model is valid
|
72
72
|
def valid?
|
73
|
-
|
73
|
+
true
|
74
74
|
end
|
75
75
|
|
76
76
|
# Checks equality by comparing each attribute.
|
@@ -78,8 +78,8 @@ module AylienNewsApi
|
|
78
78
|
def ==(o)
|
79
79
|
return true if self.equal?(o)
|
80
80
|
self.class == o.class &&
|
81
|
-
|
82
|
-
|
81
|
+
parent == o.parent &&
|
82
|
+
_self == o._self
|
83
83
|
end
|
84
84
|
|
85
85
|
# @see the `==` method
|
@@ -89,9 +89,16 @@ module AylienNewsApi
|
|
89
89
|
end
|
90
90
|
|
91
91
|
# Calculates hash code according to all attributes.
|
92
|
-
# @return [
|
92
|
+
# @return [Integer] Hash code
|
93
93
|
def hash
|
94
|
-
[
|
94
|
+
[parent, _self].hash
|
95
|
+
end
|
96
|
+
|
97
|
+
# Builds the object from hash
|
98
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
99
|
+
# @return [Object] Returns the model itself
|
100
|
+
def self.build_from_hash(attributes)
|
101
|
+
new.build_from_hash(attributes)
|
95
102
|
end
|
96
103
|
|
97
104
|
# Builds the object from hash
|
@@ -99,12 +106,12 @@ module AylienNewsApi
|
|
99
106
|
# @return [Object] Returns the model itself
|
100
107
|
def build_from_hash(attributes)
|
101
108
|
return nil unless attributes.is_a?(Hash)
|
102
|
-
self.class.
|
109
|
+
self.class.openapi_types.each_pair do |key, type|
|
103
110
|
if type =~ /\AArray<(.*)>/i
|
104
|
-
# check to ensure the input is an array given that the
|
111
|
+
# check to ensure the input is an array given that the attribute
|
105
112
|
# is documented as an array but the input is not
|
106
113
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
107
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) }
|
114
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
108
115
|
end
|
109
116
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
110
117
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
@@ -130,7 +137,7 @@ module AylienNewsApi
|
|
130
137
|
value.to_i
|
131
138
|
when :Float
|
132
139
|
value.to_f
|
133
|
-
when :
|
140
|
+
when :Boolean
|
134
141
|
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
135
142
|
true
|
136
143
|
else
|
@@ -151,8 +158,7 @@ module AylienNewsApi
|
|
151
158
|
end
|
152
159
|
end
|
153
160
|
else # model
|
154
|
-
|
155
|
-
temp_model.build_from_hash(value)
|
161
|
+
AylienNewsApi.const_get(type).build_from_hash(value)
|
156
162
|
end
|
157
163
|
end
|
158
164
|
|
@@ -186,7 +192,7 @@ module AylienNewsApi
|
|
186
192
|
# @return [Hash] Returns the value in the form of hash
|
187
193
|
def _to_hash(value)
|
188
194
|
if value.is_a?(Array)
|
189
|
-
value.compact.map{ |v| _to_hash(v) }
|
195
|
+
value.compact.map { |v| _to_hash(v) }
|
190
196
|
elsif value.is_a?(Hash)
|
191
197
|
{}.tap do |hash|
|
192
198
|
value.each { |k, v| hash[k] = _to_hash(v) }
|
@@ -197,7 +203,5 @@ module AylienNewsApi
|
|
197
203
|
value
|
198
204
|
end
|
199
205
|
end
|
200
|
-
|
201
206
|
end
|
202
|
-
|
203
207
|
end
|
@@ -0,0 +1,255 @@
|
|
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: 4.1.3-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module AylienNewsApi
|
16
|
+
class Cluster
|
17
|
+
# Publication date of the earliest story in cluster
|
18
|
+
attr_accessor :earliest_story
|
19
|
+
|
20
|
+
# ID of the cluster which is a unique identification
|
21
|
+
attr_accessor :id
|
22
|
+
|
23
|
+
# Publication date of the latest story in cluster
|
24
|
+
attr_accessor :latest_story
|
25
|
+
|
26
|
+
attr_accessor :location
|
27
|
+
|
28
|
+
attr_accessor :representative_story
|
29
|
+
|
30
|
+
# Number of stories associated with the cluster
|
31
|
+
attr_accessor :story_count
|
32
|
+
|
33
|
+
# Time of the event
|
34
|
+
attr_accessor :time
|
35
|
+
|
36
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
37
|
+
def self.attribute_map
|
38
|
+
{
|
39
|
+
:'earliest_story' => :'earliest_story',
|
40
|
+
:'id' => :'id',
|
41
|
+
:'latest_story' => :'latest_story',
|
42
|
+
:'location' => :'location',
|
43
|
+
:'representative_story' => :'representative_story',
|
44
|
+
:'story_count' => :'story_count',
|
45
|
+
:'time' => :'time'
|
46
|
+
}
|
47
|
+
end
|
48
|
+
|
49
|
+
# Attribute type mapping.
|
50
|
+
def self.openapi_types
|
51
|
+
{
|
52
|
+
:'earliest_story' => :'DateTime',
|
53
|
+
:'id' => :'Integer',
|
54
|
+
:'latest_story' => :'DateTime',
|
55
|
+
:'location' => :'Location',
|
56
|
+
:'representative_story' => :'RepresentativeStory',
|
57
|
+
:'story_count' => :'Integer',
|
58
|
+
:'time' => :'DateTime'
|
59
|
+
}
|
60
|
+
end
|
61
|
+
|
62
|
+
# Initializes the object
|
63
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
64
|
+
def initialize(attributes = {})
|
65
|
+
if (!attributes.is_a?(Hash))
|
66
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::Cluster` initialize method"
|
67
|
+
end
|
68
|
+
|
69
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
70
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
71
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
72
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `AylienNewsApi::Cluster`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
73
|
+
end
|
74
|
+
h[k.to_sym] = v
|
75
|
+
}
|
76
|
+
|
77
|
+
if attributes.key?(:'earliest_story')
|
78
|
+
self.earliest_story = attributes[:'earliest_story']
|
79
|
+
end
|
80
|
+
|
81
|
+
if attributes.key?(:'id')
|
82
|
+
self.id = attributes[:'id']
|
83
|
+
end
|
84
|
+
|
85
|
+
if attributes.key?(:'latest_story')
|
86
|
+
self.latest_story = attributes[:'latest_story']
|
87
|
+
end
|
88
|
+
|
89
|
+
if attributes.key?(:'location')
|
90
|
+
self.location = attributes[:'location']
|
91
|
+
end
|
92
|
+
|
93
|
+
if attributes.key?(:'representative_story')
|
94
|
+
self.representative_story = attributes[:'representative_story']
|
95
|
+
end
|
96
|
+
|
97
|
+
if attributes.key?(:'story_count')
|
98
|
+
self.story_count = attributes[:'story_count']
|
99
|
+
end
|
100
|
+
|
101
|
+
if attributes.key?(:'time')
|
102
|
+
self.time = attributes[:'time']
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
107
|
+
# @return Array for valid properties with the reasons
|
108
|
+
def list_invalid_properties
|
109
|
+
invalid_properties = Array.new
|
110
|
+
invalid_properties
|
111
|
+
end
|
112
|
+
|
113
|
+
# Check to see if the all the properties in the model are valid
|
114
|
+
# @return true if the model is valid
|
115
|
+
def valid?
|
116
|
+
true
|
117
|
+
end
|
118
|
+
|
119
|
+
# Checks equality by comparing each attribute.
|
120
|
+
# @param [Object] Object to be compared
|
121
|
+
def ==(o)
|
122
|
+
return true if self.equal?(o)
|
123
|
+
self.class == o.class &&
|
124
|
+
earliest_story == o.earliest_story &&
|
125
|
+
id == o.id &&
|
126
|
+
latest_story == o.latest_story &&
|
127
|
+
location == o.location &&
|
128
|
+
representative_story == o.representative_story &&
|
129
|
+
story_count == o.story_count &&
|
130
|
+
time == o.time
|
131
|
+
end
|
132
|
+
|
133
|
+
# @see the `==` method
|
134
|
+
# @param [Object] Object to be compared
|
135
|
+
def eql?(o)
|
136
|
+
self == o
|
137
|
+
end
|
138
|
+
|
139
|
+
# Calculates hash code according to all attributes.
|
140
|
+
# @return [Integer] Hash code
|
141
|
+
def hash
|
142
|
+
[earliest_story, id, latest_story, location, representative_story, story_count, time].hash
|
143
|
+
end
|
144
|
+
|
145
|
+
# Builds the object from hash
|
146
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
147
|
+
# @return [Object] Returns the model itself
|
148
|
+
def self.build_from_hash(attributes)
|
149
|
+
new.build_from_hash(attributes)
|
150
|
+
end
|
151
|
+
|
152
|
+
# Builds the object from hash
|
153
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
154
|
+
# @return [Object] Returns the model itself
|
155
|
+
def build_from_hash(attributes)
|
156
|
+
return nil unless attributes.is_a?(Hash)
|
157
|
+
self.class.openapi_types.each_pair do |key, type|
|
158
|
+
if type =~ /\AArray<(.*)>/i
|
159
|
+
# check to ensure the input is an array given that the attribute
|
160
|
+
# is documented as an array but the input is not
|
161
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
162
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
163
|
+
end
|
164
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
165
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
166
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
167
|
+
end
|
168
|
+
|
169
|
+
self
|
170
|
+
end
|
171
|
+
|
172
|
+
# Deserializes the data based on type
|
173
|
+
# @param string type Data type
|
174
|
+
# @param string value Value to be deserialized
|
175
|
+
# @return [Object] Deserialized data
|
176
|
+
def _deserialize(type, value)
|
177
|
+
case type.to_sym
|
178
|
+
when :DateTime
|
179
|
+
DateTime.parse(value)
|
180
|
+
when :Date
|
181
|
+
Date.parse(value)
|
182
|
+
when :String
|
183
|
+
value.to_s
|
184
|
+
when :Integer
|
185
|
+
value.to_i
|
186
|
+
when :Float
|
187
|
+
value.to_f
|
188
|
+
when :Boolean
|
189
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
190
|
+
true
|
191
|
+
else
|
192
|
+
false
|
193
|
+
end
|
194
|
+
when :Object
|
195
|
+
# generic object (usually a Hash), return directly
|
196
|
+
value
|
197
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
198
|
+
inner_type = Regexp.last_match[:inner_type]
|
199
|
+
value.map { |v| _deserialize(inner_type, v) }
|
200
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
201
|
+
k_type = Regexp.last_match[:k_type]
|
202
|
+
v_type = Regexp.last_match[:v_type]
|
203
|
+
{}.tap do |hash|
|
204
|
+
value.each do |k, v|
|
205
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
206
|
+
end
|
207
|
+
end
|
208
|
+
else # model
|
209
|
+
AylienNewsApi.const_get(type).build_from_hash(value)
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
# Returns the string representation of the object
|
214
|
+
# @return [String] String presentation of the object
|
215
|
+
def to_s
|
216
|
+
to_hash.to_s
|
217
|
+
end
|
218
|
+
|
219
|
+
# to_body is an alias to to_hash (backward compatibility)
|
220
|
+
# @return [Hash] Returns the object in the form of hash
|
221
|
+
def to_body
|
222
|
+
to_hash
|
223
|
+
end
|
224
|
+
|
225
|
+
# Returns the object in the form of hash
|
226
|
+
# @return [Hash] Returns the object in the form of hash
|
227
|
+
def to_hash
|
228
|
+
hash = {}
|
229
|
+
self.class.attribute_map.each_pair do |attr, param|
|
230
|
+
value = self.send(attr)
|
231
|
+
next if value.nil?
|
232
|
+
hash[param] = _to_hash(value)
|
233
|
+
end
|
234
|
+
hash
|
235
|
+
end
|
236
|
+
|
237
|
+
# Outputs non-array value in the form of hash
|
238
|
+
# For object, use to_hash. Otherwise, just return the value
|
239
|
+
# @param [Object] value Any valid value
|
240
|
+
# @return [Hash] Returns the value in the form of hash
|
241
|
+
def _to_hash(value)
|
242
|
+
if value.is_a?(Array)
|
243
|
+
value.compact.map { |v| _to_hash(v) }
|
244
|
+
elsif value.is_a?(Hash)
|
245
|
+
{}.tap do |hash|
|
246
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
247
|
+
end
|
248
|
+
elsif value.respond_to? :to_hash
|
249
|
+
value.to_hash
|
250
|
+
else
|
251
|
+
value
|
252
|
+
end
|
253
|
+
end
|
254
|
+
end
|
255
|
+
end
|