aylien_news_api 1.0.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- 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,23 +1,18 @@
|
|
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 StoryCluster
|
22
17
|
# A unique identification for the cluster
|
23
18
|
attr_accessor :id
|
@@ -25,83 +20,88 @@ module AylienNewsApi
|
|
25
20
|
# Suggested labels for the cluster
|
26
21
|
attr_accessor :phrases
|
27
22
|
|
23
|
+
# The cluster score
|
24
|
+
attr_accessor :score
|
25
|
+
|
28
26
|
# Size of the cluster
|
29
27
|
attr_accessor :size
|
30
28
|
|
31
29
|
# Story ids which are in the cluster
|
32
30
|
attr_accessor :stories
|
33
31
|
|
34
|
-
# The cluster score
|
35
|
-
attr_accessor :score
|
36
|
-
|
37
|
-
|
38
32
|
# Attribute mapping from ruby-style variable name to JSON key.
|
39
33
|
def self.attribute_map
|
40
34
|
{
|
41
35
|
:'id' => :'id',
|
42
36
|
:'phrases' => :'phrases',
|
37
|
+
:'score' => :'score',
|
43
38
|
:'size' => :'size',
|
44
|
-
:'stories' => :'stories'
|
45
|
-
:'score' => :'score'
|
39
|
+
:'stories' => :'stories'
|
46
40
|
}
|
47
41
|
end
|
48
42
|
|
49
43
|
# Attribute type mapping.
|
50
|
-
def self.
|
44
|
+
def self.openapi_types
|
51
45
|
{
|
52
46
|
:'id' => :'Integer',
|
53
47
|
:'phrases' => :'Array<String>',
|
48
|
+
:'score' => :'Float',
|
54
49
|
:'size' => :'Integer',
|
55
|
-
:'stories' => :'Array<Integer>'
|
56
|
-
:'score' => :'Float'
|
50
|
+
:'stories' => :'Array<Integer>'
|
57
51
|
}
|
58
52
|
end
|
59
53
|
|
60
54
|
# Initializes the object
|
61
55
|
# @param [Hash] attributes Model attributes in the form of hash
|
62
56
|
def initialize(attributes = {})
|
63
|
-
|
57
|
+
if (!attributes.is_a?(Hash))
|
58
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::StoryCluster` initialize method"
|
59
|
+
end
|
64
60
|
|
65
|
-
# convert string to symbol for hash key
|
66
|
-
attributes = attributes.each_with_object({}){|(k,v), h|
|
61
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
62
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
63
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
64
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `AylienNewsApi::StoryCluster`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
65
|
+
end
|
66
|
+
h[k.to_sym] = v
|
67
|
+
}
|
67
68
|
|
68
|
-
if attributes.
|
69
|
+
if attributes.key?(:'id')
|
69
70
|
self.id = attributes[:'id']
|
70
71
|
end
|
71
72
|
|
72
|
-
if attributes.
|
73
|
+
if attributes.key?(:'phrases')
|
73
74
|
if (value = attributes[:'phrases']).is_a?(Array)
|
74
75
|
self.phrases = value
|
75
76
|
end
|
76
77
|
end
|
77
78
|
|
78
|
-
if attributes.
|
79
|
+
if attributes.key?(:'score')
|
80
|
+
self.score = attributes[:'score']
|
81
|
+
end
|
82
|
+
|
83
|
+
if attributes.key?(:'size')
|
79
84
|
self.size = attributes[:'size']
|
80
85
|
end
|
81
86
|
|
82
|
-
if attributes.
|
87
|
+
if attributes.key?(:'stories')
|
83
88
|
if (value = attributes[:'stories']).is_a?(Array)
|
84
89
|
self.stories = value
|
85
90
|
end
|
86
91
|
end
|
87
|
-
|
88
|
-
if attributes.has_key?(:'score')
|
89
|
-
self.score = attributes[:'score']
|
90
|
-
end
|
91
|
-
|
92
92
|
end
|
93
93
|
|
94
94
|
# Show invalid properties with the reasons. Usually used together with valid?
|
95
|
-
# @return Array for valid
|
95
|
+
# @return Array for valid properties with the reasons
|
96
96
|
def list_invalid_properties
|
97
97
|
invalid_properties = Array.new
|
98
|
-
|
98
|
+
invalid_properties
|
99
99
|
end
|
100
100
|
|
101
101
|
# Check to see if the all the properties in the model are valid
|
102
102
|
# @return true if the model is valid
|
103
103
|
def valid?
|
104
|
-
|
104
|
+
true
|
105
105
|
end
|
106
106
|
|
107
107
|
# Checks equality by comparing each attribute.
|
@@ -111,9 +111,9 @@ module AylienNewsApi
|
|
111
111
|
self.class == o.class &&
|
112
112
|
id == o.id &&
|
113
113
|
phrases == o.phrases &&
|
114
|
+
score == o.score &&
|
114
115
|
size == o.size &&
|
115
|
-
stories == o.stories
|
116
|
-
score == o.score
|
116
|
+
stories == o.stories
|
117
117
|
end
|
118
118
|
|
119
119
|
# @see the `==` method
|
@@ -123,9 +123,16 @@ module AylienNewsApi
|
|
123
123
|
end
|
124
124
|
|
125
125
|
# Calculates hash code according to all attributes.
|
126
|
-
# @return [
|
126
|
+
# @return [Integer] Hash code
|
127
127
|
def hash
|
128
|
-
[id, phrases, size, stories
|
128
|
+
[id, phrases, score, size, stories].hash
|
129
|
+
end
|
130
|
+
|
131
|
+
# Builds the object from hash
|
132
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
133
|
+
# @return [Object] Returns the model itself
|
134
|
+
def self.build_from_hash(attributes)
|
135
|
+
new.build_from_hash(attributes)
|
129
136
|
end
|
130
137
|
|
131
138
|
# Builds the object from hash
|
@@ -133,12 +140,12 @@ module AylienNewsApi
|
|
133
140
|
# @return [Object] Returns the model itself
|
134
141
|
def build_from_hash(attributes)
|
135
142
|
return nil unless attributes.is_a?(Hash)
|
136
|
-
self.class.
|
143
|
+
self.class.openapi_types.each_pair do |key, type|
|
137
144
|
if type =~ /\AArray<(.*)>/i
|
138
|
-
# check to ensure the input is an array given that the
|
145
|
+
# check to ensure the input is an array given that the attribute
|
139
146
|
# is documented as an array but the input is not
|
140
147
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
141
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) }
|
148
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
142
149
|
end
|
143
150
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
144
151
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
@@ -164,7 +171,7 @@ module AylienNewsApi
|
|
164
171
|
value.to_i
|
165
172
|
when :Float
|
166
173
|
value.to_f
|
167
|
-
when :
|
174
|
+
when :Boolean
|
168
175
|
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
169
176
|
true
|
170
177
|
else
|
@@ -185,8 +192,7 @@ module AylienNewsApi
|
|
185
192
|
end
|
186
193
|
end
|
187
194
|
else # model
|
188
|
-
|
189
|
-
temp_model.build_from_hash(value)
|
195
|
+
AylienNewsApi.const_get(type).build_from_hash(value)
|
190
196
|
end
|
191
197
|
end
|
192
198
|
|
@@ -220,7 +226,7 @@ module AylienNewsApi
|
|
220
226
|
# @return [Hash] Returns the value in the form of hash
|
221
227
|
def _to_hash(value)
|
222
228
|
if value.is_a?(Array)
|
223
|
-
value.compact.map{ |v| _to_hash(v) }
|
229
|
+
value.compact.map { |v| _to_hash(v) }
|
224
230
|
elsif value.is_a?(Hash)
|
225
231
|
{}.tap do |hash|
|
226
232
|
value.each { |k, v| hash[k] = _to_hash(v) }
|
@@ -231,7 +237,5 @@ module AylienNewsApi
|
|
231
237
|
value
|
232
238
|
end
|
233
239
|
end
|
234
|
-
|
235
240
|
end
|
236
|
-
|
237
241
|
end
|
@@ -1,94 +1,94 @@
|
|
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 StoryLinks
|
22
|
-
# The story
|
23
|
-
attr_accessor :
|
24
|
-
|
25
|
-
# The related stories URL
|
26
|
-
attr_accessor :related_stories
|
17
|
+
# The story canonical URL
|
18
|
+
attr_accessor :canonical
|
27
19
|
|
28
20
|
# The coverages URL
|
29
21
|
attr_accessor :coverages
|
30
22
|
|
31
|
-
# The story
|
32
|
-
attr_accessor :
|
23
|
+
# The story permalink URL
|
24
|
+
attr_accessor :permalink
|
33
25
|
|
26
|
+
# The related stories URL
|
27
|
+
attr_accessor :related_stories
|
34
28
|
|
35
29
|
# Attribute mapping from ruby-style variable name to JSON key.
|
36
30
|
def self.attribute_map
|
37
31
|
{
|
38
|
-
:'
|
39
|
-
:'related_stories' => :'related_stories',
|
32
|
+
:'canonical' => :'canonical',
|
40
33
|
:'coverages' => :'coverages',
|
41
|
-
:'
|
34
|
+
:'permalink' => :'permalink',
|
35
|
+
:'related_stories' => :'related_stories'
|
42
36
|
}
|
43
37
|
end
|
44
38
|
|
45
39
|
# Attribute type mapping.
|
46
|
-
def self.
|
40
|
+
def self.openapi_types
|
47
41
|
{
|
48
|
-
:'
|
49
|
-
:'related_stories' => :'String',
|
42
|
+
:'canonical' => :'String',
|
50
43
|
:'coverages' => :'String',
|
51
|
-
:'
|
44
|
+
:'permalink' => :'String',
|
45
|
+
:'related_stories' => :'String'
|
52
46
|
}
|
53
47
|
end
|
54
48
|
|
55
49
|
# Initializes the object
|
56
50
|
# @param [Hash] attributes Model attributes in the form of hash
|
57
51
|
def initialize(attributes = {})
|
58
|
-
|
59
|
-
|
60
|
-
# convert string to symbol for hash key
|
61
|
-
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
62
|
-
|
63
|
-
if attributes.has_key?(:'permalink')
|
64
|
-
self.permalink = attributes[:'permalink']
|
52
|
+
if (!attributes.is_a?(Hash))
|
53
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::StoryLinks` initialize method"
|
65
54
|
end
|
66
55
|
|
67
|
-
if
|
68
|
-
|
56
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
57
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
58
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
59
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `AylienNewsApi::StoryLinks`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
60
|
+
end
|
61
|
+
h[k.to_sym] = v
|
62
|
+
}
|
63
|
+
|
64
|
+
if attributes.key?(:'canonical')
|
65
|
+
self.canonical = attributes[:'canonical']
|
69
66
|
end
|
70
67
|
|
71
|
-
if attributes.
|
68
|
+
if attributes.key?(:'coverages')
|
72
69
|
self.coverages = attributes[:'coverages']
|
73
70
|
end
|
74
71
|
|
75
|
-
if attributes.
|
76
|
-
self.
|
72
|
+
if attributes.key?(:'permalink')
|
73
|
+
self.permalink = attributes[:'permalink']
|
77
74
|
end
|
78
75
|
|
76
|
+
if attributes.key?(:'related_stories')
|
77
|
+
self.related_stories = attributes[:'related_stories']
|
78
|
+
end
|
79
79
|
end
|
80
80
|
|
81
81
|
# Show invalid properties with the reasons. Usually used together with valid?
|
82
|
-
# @return Array for valid
|
82
|
+
# @return Array for valid properties with the reasons
|
83
83
|
def list_invalid_properties
|
84
84
|
invalid_properties = Array.new
|
85
|
-
|
85
|
+
invalid_properties
|
86
86
|
end
|
87
87
|
|
88
88
|
# Check to see if the all the properties in the model are valid
|
89
89
|
# @return true if the model is valid
|
90
90
|
def valid?
|
91
|
-
|
91
|
+
true
|
92
92
|
end
|
93
93
|
|
94
94
|
# Checks equality by comparing each attribute.
|
@@ -96,10 +96,10 @@ module AylienNewsApi
|
|
96
96
|
def ==(o)
|
97
97
|
return true if self.equal?(o)
|
98
98
|
self.class == o.class &&
|
99
|
-
|
100
|
-
related_stories == o.related_stories &&
|
99
|
+
canonical == o.canonical &&
|
101
100
|
coverages == o.coverages &&
|
102
|
-
|
101
|
+
permalink == o.permalink &&
|
102
|
+
related_stories == o.related_stories
|
103
103
|
end
|
104
104
|
|
105
105
|
# @see the `==` method
|
@@ -109,9 +109,16 @@ module AylienNewsApi
|
|
109
109
|
end
|
110
110
|
|
111
111
|
# Calculates hash code according to all attributes.
|
112
|
-
# @return [
|
112
|
+
# @return [Integer] Hash code
|
113
113
|
def hash
|
114
|
-
[
|
114
|
+
[canonical, coverages, permalink, related_stories].hash
|
115
|
+
end
|
116
|
+
|
117
|
+
# Builds the object from hash
|
118
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
119
|
+
# @return [Object] Returns the model itself
|
120
|
+
def self.build_from_hash(attributes)
|
121
|
+
new.build_from_hash(attributes)
|
115
122
|
end
|
116
123
|
|
117
124
|
# Builds the object from hash
|
@@ -119,12 +126,12 @@ module AylienNewsApi
|
|
119
126
|
# @return [Object] Returns the model itself
|
120
127
|
def build_from_hash(attributes)
|
121
128
|
return nil unless attributes.is_a?(Hash)
|
122
|
-
self.class.
|
129
|
+
self.class.openapi_types.each_pair do |key, type|
|
123
130
|
if type =~ /\AArray<(.*)>/i
|
124
|
-
# check to ensure the input is an array given that the
|
131
|
+
# check to ensure the input is an array given that the attribute
|
125
132
|
# is documented as an array but the input is not
|
126
133
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
127
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) }
|
134
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
128
135
|
end
|
129
136
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
130
137
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
@@ -150,7 +157,7 @@ module AylienNewsApi
|
|
150
157
|
value.to_i
|
151
158
|
when :Float
|
152
159
|
value.to_f
|
153
|
-
when :
|
160
|
+
when :Boolean
|
154
161
|
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
155
162
|
true
|
156
163
|
else
|
@@ -171,8 +178,7 @@ module AylienNewsApi
|
|
171
178
|
end
|
172
179
|
end
|
173
180
|
else # model
|
174
|
-
|
175
|
-
temp_model.build_from_hash(value)
|
181
|
+
AylienNewsApi.const_get(type).build_from_hash(value)
|
176
182
|
end
|
177
183
|
end
|
178
184
|
|
@@ -206,7 +212,7 @@ module AylienNewsApi
|
|
206
212
|
# @return [Hash] Returns the value in the form of hash
|
207
213
|
def _to_hash(value)
|
208
214
|
if value.is_a?(Array)
|
209
|
-
value.compact.map{ |v| _to_hash(v) }
|
215
|
+
value.compact.map { |v| _to_hash(v) }
|
210
216
|
elsif value.is_a?(Hash)
|
211
217
|
{}.tap do |hash|
|
212
218
|
value.each { |k, v| hash[k] = _to_hash(v) }
|
@@ -217,7 +223,5 @@ module AylienNewsApi
|
|
217
223
|
value
|
218
224
|
end
|
219
225
|
end
|
220
|
-
|
221
226
|
end
|
222
|
-
|
223
227
|
end
|
@@ -0,0 +1,197 @@
|
|
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
|
+
# Translations of the story. Each language has it's own key and object
|
17
|
+
class StoryTranslations
|
18
|
+
attr_accessor :en
|
19
|
+
|
20
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
21
|
+
def self.attribute_map
|
22
|
+
{
|
23
|
+
:'en' => :'en'
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
# Attribute type mapping.
|
28
|
+
def self.openapi_types
|
29
|
+
{
|
30
|
+
:'en' => :'StoryTranslationsEn'
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
# Initializes the object
|
35
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
36
|
+
def initialize(attributes = {})
|
37
|
+
if (!attributes.is_a?(Hash))
|
38
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::StoryTranslations` initialize method"
|
39
|
+
end
|
40
|
+
|
41
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
42
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
43
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
44
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `AylienNewsApi::StoryTranslations`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
45
|
+
end
|
46
|
+
h[k.to_sym] = v
|
47
|
+
}
|
48
|
+
|
49
|
+
if attributes.key?(:'en')
|
50
|
+
self.en = attributes[:'en']
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
55
|
+
# @return Array for valid properties with the reasons
|
56
|
+
def list_invalid_properties
|
57
|
+
invalid_properties = Array.new
|
58
|
+
invalid_properties
|
59
|
+
end
|
60
|
+
|
61
|
+
# Check to see if the all the properties in the model are valid
|
62
|
+
# @return true if the model is valid
|
63
|
+
def valid?
|
64
|
+
true
|
65
|
+
end
|
66
|
+
|
67
|
+
# Checks equality by comparing each attribute.
|
68
|
+
# @param [Object] Object to be compared
|
69
|
+
def ==(o)
|
70
|
+
return true if self.equal?(o)
|
71
|
+
self.class == o.class &&
|
72
|
+
en == o.en
|
73
|
+
end
|
74
|
+
|
75
|
+
# @see the `==` method
|
76
|
+
# @param [Object] Object to be compared
|
77
|
+
def eql?(o)
|
78
|
+
self == o
|
79
|
+
end
|
80
|
+
|
81
|
+
# Calculates hash code according to all attributes.
|
82
|
+
# @return [Integer] Hash code
|
83
|
+
def hash
|
84
|
+
[en].hash
|
85
|
+
end
|
86
|
+
|
87
|
+
# Builds the object from hash
|
88
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
89
|
+
# @return [Object] Returns the model itself
|
90
|
+
def self.build_from_hash(attributes)
|
91
|
+
new.build_from_hash(attributes)
|
92
|
+
end
|
93
|
+
|
94
|
+
# Builds the object from hash
|
95
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
96
|
+
# @return [Object] Returns the model itself
|
97
|
+
def build_from_hash(attributes)
|
98
|
+
return nil unless attributes.is_a?(Hash)
|
99
|
+
self.class.openapi_types.each_pair do |key, type|
|
100
|
+
if type =~ /\AArray<(.*)>/i
|
101
|
+
# check to ensure the input is an array given that the attribute
|
102
|
+
# is documented as an array but the input is not
|
103
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
104
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
105
|
+
end
|
106
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
107
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
108
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
109
|
+
end
|
110
|
+
|
111
|
+
self
|
112
|
+
end
|
113
|
+
|
114
|
+
# Deserializes the data based on type
|
115
|
+
# @param string type Data type
|
116
|
+
# @param string value Value to be deserialized
|
117
|
+
# @return [Object] Deserialized data
|
118
|
+
def _deserialize(type, value)
|
119
|
+
case type.to_sym
|
120
|
+
when :DateTime
|
121
|
+
DateTime.parse(value)
|
122
|
+
when :Date
|
123
|
+
Date.parse(value)
|
124
|
+
when :String
|
125
|
+
value.to_s
|
126
|
+
when :Integer
|
127
|
+
value.to_i
|
128
|
+
when :Float
|
129
|
+
value.to_f
|
130
|
+
when :Boolean
|
131
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
132
|
+
true
|
133
|
+
else
|
134
|
+
false
|
135
|
+
end
|
136
|
+
when :Object
|
137
|
+
# generic object (usually a Hash), return directly
|
138
|
+
value
|
139
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
140
|
+
inner_type = Regexp.last_match[:inner_type]
|
141
|
+
value.map { |v| _deserialize(inner_type, v) }
|
142
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
143
|
+
k_type = Regexp.last_match[:k_type]
|
144
|
+
v_type = Regexp.last_match[:v_type]
|
145
|
+
{}.tap do |hash|
|
146
|
+
value.each do |k, v|
|
147
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
148
|
+
end
|
149
|
+
end
|
150
|
+
else # model
|
151
|
+
AylienNewsApi.const_get(type).build_from_hash(value)
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
# Returns the string representation of the object
|
156
|
+
# @return [String] String presentation of the object
|
157
|
+
def to_s
|
158
|
+
to_hash.to_s
|
159
|
+
end
|
160
|
+
|
161
|
+
# to_body is an alias to to_hash (backward compatibility)
|
162
|
+
# @return [Hash] Returns the object in the form of hash
|
163
|
+
def to_body
|
164
|
+
to_hash
|
165
|
+
end
|
166
|
+
|
167
|
+
# Returns the object in the form of hash
|
168
|
+
# @return [Hash] Returns the object in the form of hash
|
169
|
+
def to_hash
|
170
|
+
hash = {}
|
171
|
+
self.class.attribute_map.each_pair do |attr, param|
|
172
|
+
value = self.send(attr)
|
173
|
+
next if value.nil?
|
174
|
+
hash[param] = _to_hash(value)
|
175
|
+
end
|
176
|
+
hash
|
177
|
+
end
|
178
|
+
|
179
|
+
# Outputs non-array value in the form of hash
|
180
|
+
# For object, use to_hash. Otherwise, just return the value
|
181
|
+
# @param [Object] value Any valid value
|
182
|
+
# @return [Hash] Returns the value in the form of hash
|
183
|
+
def _to_hash(value)
|
184
|
+
if value.is_a?(Array)
|
185
|
+
value.compact.map { |v| _to_hash(v) }
|
186
|
+
elsif value.is_a?(Hash)
|
187
|
+
{}.tap do |hash|
|
188
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
189
|
+
end
|
190
|
+
elsif value.respond_to? :to_hash
|
191
|
+
value.to_hash
|
192
|
+
else
|
193
|
+
value
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
197
|
+
end
|