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,85 +1,85 @@
|
|
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 Rank
|
22
|
-
# The rank
|
23
|
-
attr_accessor :rank
|
24
|
-
|
25
17
|
# The country code which the rank is in it
|
26
18
|
attr_accessor :country
|
27
19
|
|
28
20
|
# The fetched date of the rank
|
29
21
|
attr_accessor :fetched_at
|
30
22
|
|
23
|
+
# The rank
|
24
|
+
attr_accessor :rank
|
31
25
|
|
32
26
|
# Attribute mapping from ruby-style variable name to JSON key.
|
33
27
|
def self.attribute_map
|
34
28
|
{
|
35
|
-
:'rank' => :'rank',
|
36
29
|
:'country' => :'country',
|
37
|
-
:'fetched_at' => :'fetched_at'
|
30
|
+
:'fetched_at' => :'fetched_at',
|
31
|
+
:'rank' => :'rank'
|
38
32
|
}
|
39
33
|
end
|
40
34
|
|
41
35
|
# Attribute type mapping.
|
42
|
-
def self.
|
36
|
+
def self.openapi_types
|
43
37
|
{
|
44
|
-
:'rank' => :'Integer',
|
45
38
|
:'country' => :'String',
|
46
|
-
:'fetched_at' => :'DateTime'
|
39
|
+
:'fetched_at' => :'DateTime',
|
40
|
+
:'rank' => :'Integer'
|
47
41
|
}
|
48
42
|
end
|
49
43
|
|
50
44
|
# Initializes the object
|
51
45
|
# @param [Hash] attributes Model attributes in the form of hash
|
52
46
|
def initialize(attributes = {})
|
53
|
-
|
54
|
-
|
55
|
-
# convert string to symbol for hash key
|
56
|
-
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
57
|
-
|
58
|
-
if attributes.has_key?(:'rank')
|
59
|
-
self.rank = attributes[:'rank']
|
47
|
+
if (!attributes.is_a?(Hash))
|
48
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::Rank` initialize method"
|
60
49
|
end
|
61
50
|
|
62
|
-
if
|
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::Rank`. 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
|
+
}
|
58
|
+
|
59
|
+
if attributes.key?(:'country')
|
63
60
|
self.country = attributes[:'country']
|
64
61
|
end
|
65
62
|
|
66
|
-
if attributes.
|
63
|
+
if attributes.key?(:'fetched_at')
|
67
64
|
self.fetched_at = attributes[:'fetched_at']
|
68
65
|
end
|
69
66
|
|
67
|
+
if attributes.key?(:'rank')
|
68
|
+
self.rank = attributes[:'rank']
|
69
|
+
end
|
70
70
|
end
|
71
71
|
|
72
72
|
# Show invalid properties with the reasons. Usually used together with valid?
|
73
|
-
# @return Array for valid
|
73
|
+
# @return Array for valid properties with the reasons
|
74
74
|
def list_invalid_properties
|
75
75
|
invalid_properties = Array.new
|
76
|
-
|
76
|
+
invalid_properties
|
77
77
|
end
|
78
78
|
|
79
79
|
# Check to see if the all the properties in the model are valid
|
80
80
|
# @return true if the model is valid
|
81
81
|
def valid?
|
82
|
-
|
82
|
+
true
|
83
83
|
end
|
84
84
|
|
85
85
|
# Checks equality by comparing each attribute.
|
@@ -87,9 +87,9 @@ module AylienNewsApi
|
|
87
87
|
def ==(o)
|
88
88
|
return true if self.equal?(o)
|
89
89
|
self.class == o.class &&
|
90
|
-
rank == o.rank &&
|
91
90
|
country == o.country &&
|
92
|
-
fetched_at == o.fetched_at
|
91
|
+
fetched_at == o.fetched_at &&
|
92
|
+
rank == o.rank
|
93
93
|
end
|
94
94
|
|
95
95
|
# @see the `==` method
|
@@ -99,9 +99,16 @@ module AylienNewsApi
|
|
99
99
|
end
|
100
100
|
|
101
101
|
# Calculates hash code according to all attributes.
|
102
|
-
# @return [
|
102
|
+
# @return [Integer] Hash code
|
103
103
|
def hash
|
104
|
-
[
|
104
|
+
[country, fetched_at, rank].hash
|
105
|
+
end
|
106
|
+
|
107
|
+
# Builds the object from hash
|
108
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
109
|
+
# @return [Object] Returns the model itself
|
110
|
+
def self.build_from_hash(attributes)
|
111
|
+
new.build_from_hash(attributes)
|
105
112
|
end
|
106
113
|
|
107
114
|
# Builds the object from hash
|
@@ -109,12 +116,12 @@ module AylienNewsApi
|
|
109
116
|
# @return [Object] Returns the model itself
|
110
117
|
def build_from_hash(attributes)
|
111
118
|
return nil unless attributes.is_a?(Hash)
|
112
|
-
self.class.
|
119
|
+
self.class.openapi_types.each_pair do |key, type|
|
113
120
|
if type =~ /\AArray<(.*)>/i
|
114
|
-
# check to ensure the input is an array given that the
|
121
|
+
# check to ensure the input is an array given that the attribute
|
115
122
|
# is documented as an array but the input is not
|
116
123
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
117
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) }
|
124
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
118
125
|
end
|
119
126
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
120
127
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
@@ -140,7 +147,7 @@ module AylienNewsApi
|
|
140
147
|
value.to_i
|
141
148
|
when :Float
|
142
149
|
value.to_f
|
143
|
-
when :
|
150
|
+
when :Boolean
|
144
151
|
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
145
152
|
true
|
146
153
|
else
|
@@ -161,8 +168,7 @@ module AylienNewsApi
|
|
161
168
|
end
|
162
169
|
end
|
163
170
|
else # model
|
164
|
-
|
165
|
-
temp_model.build_from_hash(value)
|
171
|
+
AylienNewsApi.const_get(type).build_from_hash(value)
|
166
172
|
end
|
167
173
|
end
|
168
174
|
|
@@ -196,7 +202,7 @@ module AylienNewsApi
|
|
196
202
|
# @return [Hash] Returns the value in the form of hash
|
197
203
|
def _to_hash(value)
|
198
204
|
if value.is_a?(Array)
|
199
|
-
value.compact.map{ |v| _to_hash(v) }
|
205
|
+
value.compact.map { |v| _to_hash(v) }
|
200
206
|
elsif value.is_a?(Hash)
|
201
207
|
{}.tap do |hash|
|
202
208
|
value.each { |k, v| hash[k] = _to_hash(v) }
|
@@ -207,7 +213,5 @@ module AylienNewsApi
|
|
207
213
|
value
|
208
214
|
end
|
209
215
|
end
|
210
|
-
|
211
216
|
end
|
212
|
-
|
213
217
|
end
|
@@ -1,27 +1,21 @@
|
|
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 Rankings
|
22
17
|
attr_accessor :alexa
|
23
18
|
|
24
|
-
|
25
19
|
# Attribute mapping from ruby-style variable name to JSON key.
|
26
20
|
def self.attribute_map
|
27
21
|
{
|
@@ -30,7 +24,7 @@ module AylienNewsApi
|
|
30
24
|
end
|
31
25
|
|
32
26
|
# Attribute type mapping.
|
33
|
-
def self.
|
27
|
+
def self.openapi_types
|
34
28
|
{
|
35
29
|
:'alexa' => :'Array<Rank>'
|
36
30
|
}
|
@@ -39,30 +33,36 @@ module AylienNewsApi
|
|
39
33
|
# Initializes the object
|
40
34
|
# @param [Hash] attributes Model attributes in the form of hash
|
41
35
|
def initialize(attributes = {})
|
42
|
-
|
36
|
+
if (!attributes.is_a?(Hash))
|
37
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::Rankings` initialize method"
|
38
|
+
end
|
43
39
|
|
44
|
-
# convert string to symbol for hash key
|
45
|
-
attributes = attributes.each_with_object({}){|(k,v), h|
|
40
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
41
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
42
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
43
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `AylienNewsApi::Rankings`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
44
|
+
end
|
45
|
+
h[k.to_sym] = v
|
46
|
+
}
|
46
47
|
|
47
|
-
if attributes.
|
48
|
+
if attributes.key?(:'alexa')
|
48
49
|
if (value = attributes[:'alexa']).is_a?(Array)
|
49
50
|
self.alexa = value
|
50
51
|
end
|
51
52
|
end
|
52
|
-
|
53
53
|
end
|
54
54
|
|
55
55
|
# Show invalid properties with the reasons. Usually used together with valid?
|
56
|
-
# @return Array for valid
|
56
|
+
# @return Array for valid properties with the reasons
|
57
57
|
def list_invalid_properties
|
58
58
|
invalid_properties = Array.new
|
59
|
-
|
59
|
+
invalid_properties
|
60
60
|
end
|
61
61
|
|
62
62
|
# Check to see if the all the properties in the model are valid
|
63
63
|
# @return true if the model is valid
|
64
64
|
def valid?
|
65
|
-
|
65
|
+
true
|
66
66
|
end
|
67
67
|
|
68
68
|
# Checks equality by comparing each attribute.
|
@@ -80,22 +80,29 @@ module AylienNewsApi
|
|
80
80
|
end
|
81
81
|
|
82
82
|
# Calculates hash code according to all attributes.
|
83
|
-
# @return [
|
83
|
+
# @return [Integer] Hash code
|
84
84
|
def hash
|
85
85
|
[alexa].hash
|
86
86
|
end
|
87
87
|
|
88
|
+
# Builds the object from hash
|
89
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
90
|
+
# @return [Object] Returns the model itself
|
91
|
+
def self.build_from_hash(attributes)
|
92
|
+
new.build_from_hash(attributes)
|
93
|
+
end
|
94
|
+
|
88
95
|
# Builds the object from hash
|
89
96
|
# @param [Hash] attributes Model attributes in the form of hash
|
90
97
|
# @return [Object] Returns the model itself
|
91
98
|
def build_from_hash(attributes)
|
92
99
|
return nil unless attributes.is_a?(Hash)
|
93
|
-
self.class.
|
100
|
+
self.class.openapi_types.each_pair do |key, type|
|
94
101
|
if type =~ /\AArray<(.*)>/i
|
95
|
-
# check to ensure the input is an array given that the
|
102
|
+
# check to ensure the input is an array given that the attribute
|
96
103
|
# is documented as an array but the input is not
|
97
104
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
98
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) }
|
105
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
99
106
|
end
|
100
107
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
101
108
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
@@ -121,7 +128,7 @@ module AylienNewsApi
|
|
121
128
|
value.to_i
|
122
129
|
when :Float
|
123
130
|
value.to_f
|
124
|
-
when :
|
131
|
+
when :Boolean
|
125
132
|
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
126
133
|
true
|
127
134
|
else
|
@@ -142,8 +149,7 @@ module AylienNewsApi
|
|
142
149
|
end
|
143
150
|
end
|
144
151
|
else # model
|
145
|
-
|
146
|
-
temp_model.build_from_hash(value)
|
152
|
+
AylienNewsApi.const_get(type).build_from_hash(value)
|
147
153
|
end
|
148
154
|
end
|
149
155
|
|
@@ -177,7 +183,7 @@ module AylienNewsApi
|
|
177
183
|
# @return [Hash] Returns the value in the form of hash
|
178
184
|
def _to_hash(value)
|
179
185
|
if value.is_a?(Array)
|
180
|
-
value.compact.map{ |v| _to_hash(v) }
|
186
|
+
value.compact.map { |v| _to_hash(v) }
|
181
187
|
elsif value.is_a?(Hash)
|
182
188
|
{}.tap do |hash|
|
183
189
|
value.each { |k, v| hash[k] = _to_hash(v) }
|
@@ -188,7 +194,5 @@ module AylienNewsApi
|
|
188
194
|
value
|
189
195
|
end
|
190
196
|
end
|
191
|
-
|
192
197
|
end
|
193
|
-
|
194
198
|
end
|
@@ -1,26 +1,21 @@
|
|
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 RelatedStories
|
22
|
-
#
|
23
|
-
attr_accessor :
|
17
|
+
# An array of related stories for the input story
|
18
|
+
attr_accessor :related_stories
|
24
19
|
|
25
20
|
# The input story body
|
26
21
|
attr_accessor :story_body
|
@@ -28,80 +23,74 @@ module AylienNewsApi
|
|
28
23
|
# The input story language
|
29
24
|
attr_accessor :story_language
|
30
25
|
|
31
|
-
#
|
32
|
-
attr_accessor :
|
33
|
-
|
34
|
-
# An array of clusters
|
35
|
-
attr_accessor :clusters
|
36
|
-
|
26
|
+
# The input story title
|
27
|
+
attr_accessor :story_title
|
37
28
|
|
38
29
|
# Attribute mapping from ruby-style variable name to JSON key.
|
39
30
|
def self.attribute_map
|
40
31
|
{
|
41
|
-
:'
|
32
|
+
:'related_stories' => :'related_stories',
|
42
33
|
:'story_body' => :'story_body',
|
43
34
|
:'story_language' => :'story_language',
|
44
|
-
:'
|
45
|
-
:'clusters' => :'clusters'
|
35
|
+
:'story_title' => :'story_title'
|
46
36
|
}
|
47
37
|
end
|
48
38
|
|
49
39
|
# Attribute type mapping.
|
50
|
-
def self.
|
40
|
+
def self.openapi_types
|
51
41
|
{
|
52
|
-
:'
|
42
|
+
:'related_stories' => :'Array<Story>',
|
53
43
|
:'story_body' => :'String',
|
54
44
|
:'story_language' => :'String',
|
55
|
-
:'
|
56
|
-
:'clusters' => :'Array<StoryCluster>'
|
45
|
+
:'story_title' => :'String'
|
57
46
|
}
|
58
47
|
end
|
59
48
|
|
60
49
|
# Initializes the object
|
61
50
|
# @param [Hash] attributes Model attributes in the form of hash
|
62
51
|
def initialize(attributes = {})
|
63
|
-
|
52
|
+
if (!attributes.is_a?(Hash))
|
53
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::RelatedStories` initialize method"
|
54
|
+
end
|
64
55
|
|
65
|
-
# convert string to symbol for hash key
|
66
|
-
attributes = attributes.each_with_object({}){|(k,v), h|
|
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::RelatedStories`. 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
|
+
}
|
67
63
|
|
68
|
-
if attributes.
|
69
|
-
|
64
|
+
if attributes.key?(:'related_stories')
|
65
|
+
if (value = attributes[:'related_stories']).is_a?(Array)
|
66
|
+
self.related_stories = value
|
67
|
+
end
|
70
68
|
end
|
71
69
|
|
72
|
-
if attributes.
|
70
|
+
if attributes.key?(:'story_body')
|
73
71
|
self.story_body = attributes[:'story_body']
|
74
72
|
end
|
75
73
|
|
76
|
-
if attributes.
|
74
|
+
if attributes.key?(:'story_language')
|
77
75
|
self.story_language = attributes[:'story_language']
|
78
76
|
end
|
79
77
|
|
80
|
-
if attributes.
|
81
|
-
|
82
|
-
self.related_stories = value
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
if attributes.has_key?(:'clusters')
|
87
|
-
if (value = attributes[:'clusters']).is_a?(Array)
|
88
|
-
self.clusters = value
|
89
|
-
end
|
78
|
+
if attributes.key?(:'story_title')
|
79
|
+
self.story_title = attributes[:'story_title']
|
90
80
|
end
|
91
|
-
|
92
81
|
end
|
93
82
|
|
94
83
|
# Show invalid properties with the reasons. Usually used together with valid?
|
95
|
-
# @return Array for valid
|
84
|
+
# @return Array for valid properties with the reasons
|
96
85
|
def list_invalid_properties
|
97
86
|
invalid_properties = Array.new
|
98
|
-
|
87
|
+
invalid_properties
|
99
88
|
end
|
100
89
|
|
101
90
|
# Check to see if the all the properties in the model are valid
|
102
91
|
# @return true if the model is valid
|
103
92
|
def valid?
|
104
|
-
|
93
|
+
true
|
105
94
|
end
|
106
95
|
|
107
96
|
# Checks equality by comparing each attribute.
|
@@ -109,11 +98,10 @@ module AylienNewsApi
|
|
109
98
|
def ==(o)
|
110
99
|
return true if self.equal?(o)
|
111
100
|
self.class == o.class &&
|
112
|
-
|
101
|
+
related_stories == o.related_stories &&
|
113
102
|
story_body == o.story_body &&
|
114
103
|
story_language == o.story_language &&
|
115
|
-
|
116
|
-
clusters == o.clusters
|
104
|
+
story_title == o.story_title
|
117
105
|
end
|
118
106
|
|
119
107
|
# @see the `==` method
|
@@ -123,9 +111,16 @@ module AylienNewsApi
|
|
123
111
|
end
|
124
112
|
|
125
113
|
# Calculates hash code according to all attributes.
|
126
|
-
# @return [
|
114
|
+
# @return [Integer] Hash code
|
127
115
|
def hash
|
128
|
-
[
|
116
|
+
[related_stories, story_body, story_language, story_title].hash
|
117
|
+
end
|
118
|
+
|
119
|
+
# Builds the object from hash
|
120
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
121
|
+
# @return [Object] Returns the model itself
|
122
|
+
def self.build_from_hash(attributes)
|
123
|
+
new.build_from_hash(attributes)
|
129
124
|
end
|
130
125
|
|
131
126
|
# Builds the object from hash
|
@@ -133,12 +128,12 @@ module AylienNewsApi
|
|
133
128
|
# @return [Object] Returns the model itself
|
134
129
|
def build_from_hash(attributes)
|
135
130
|
return nil unless attributes.is_a?(Hash)
|
136
|
-
self.class.
|
131
|
+
self.class.openapi_types.each_pair do |key, type|
|
137
132
|
if type =~ /\AArray<(.*)>/i
|
138
|
-
# check to ensure the input is an array given that the
|
133
|
+
# check to ensure the input is an array given that the attribute
|
139
134
|
# is documented as an array but the input is not
|
140
135
|
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) }
|
136
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
142
137
|
end
|
143
138
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
144
139
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
@@ -164,7 +159,7 @@ module AylienNewsApi
|
|
164
159
|
value.to_i
|
165
160
|
when :Float
|
166
161
|
value.to_f
|
167
|
-
when :
|
162
|
+
when :Boolean
|
168
163
|
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
169
164
|
true
|
170
165
|
else
|
@@ -185,8 +180,7 @@ module AylienNewsApi
|
|
185
180
|
end
|
186
181
|
end
|
187
182
|
else # model
|
188
|
-
|
189
|
-
temp_model.build_from_hash(value)
|
183
|
+
AylienNewsApi.const_get(type).build_from_hash(value)
|
190
184
|
end
|
191
185
|
end
|
192
186
|
|
@@ -220,7 +214,7 @@ module AylienNewsApi
|
|
220
214
|
# @return [Hash] Returns the value in the form of hash
|
221
215
|
def _to_hash(value)
|
222
216
|
if value.is_a?(Array)
|
223
|
-
value.compact.map{ |v| _to_hash(v) }
|
217
|
+
value.compact.map { |v| _to_hash(v) }
|
224
218
|
elsif value.is_a?(Hash)
|
225
219
|
{}.tap do |hash|
|
226
220
|
value.each { |k, v| hash[k] = _to_hash(v) }
|
@@ -231,7 +225,5 @@ module AylienNewsApi
|
|
231
225
|
value
|
232
226
|
end
|
233
227
|
end
|
234
|
-
|
235
228
|
end
|
236
|
-
|
237
229
|
end
|