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,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 Sentiment
|
22
17
|
# Polarity of the sentiment
|
23
18
|
attr_accessor :polarity
|
@@ -56,7 +51,7 @@ module AylienNewsApi
|
|
56
51
|
end
|
57
52
|
|
58
53
|
# Attribute type mapping.
|
59
|
-
def self.
|
54
|
+
def self.openapi_types
|
60
55
|
{
|
61
56
|
:'polarity' => :'String',
|
62
57
|
:'score' => :'Float'
|
@@ -66,34 +61,40 @@ module AylienNewsApi
|
|
66
61
|
# Initializes the object
|
67
62
|
# @param [Hash] attributes Model attributes in the form of hash
|
68
63
|
def initialize(attributes = {})
|
69
|
-
|
64
|
+
if (!attributes.is_a?(Hash))
|
65
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::Sentiment` initialize method"
|
66
|
+
end
|
70
67
|
|
71
|
-
# convert string to symbol for hash key
|
72
|
-
attributes = attributes.each_with_object({}){|(k,v), h|
|
68
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
69
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
70
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
71
|
+
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
|
72
|
+
end
|
73
|
+
h[k.to_sym] = v
|
74
|
+
}
|
73
75
|
|
74
|
-
if attributes.
|
76
|
+
if attributes.key?(:'polarity')
|
75
77
|
self.polarity = attributes[:'polarity']
|
76
78
|
end
|
77
79
|
|
78
|
-
if attributes.
|
80
|
+
if attributes.key?(:'score')
|
79
81
|
self.score = attributes[:'score']
|
80
82
|
end
|
81
|
-
|
82
83
|
end
|
83
84
|
|
84
85
|
# Show invalid properties with the reasons. Usually used together with valid?
|
85
|
-
# @return Array for valid
|
86
|
+
# @return Array for valid properties with the reasons
|
86
87
|
def list_invalid_properties
|
87
88
|
invalid_properties = Array.new
|
88
89
|
if !@score.nil? && @score > 1
|
89
|
-
invalid_properties.push(
|
90
|
+
invalid_properties.push('invalid value for "score", must be smaller than or equal to 1.')
|
90
91
|
end
|
91
92
|
|
92
93
|
if !@score.nil? && @score < 0
|
93
|
-
invalid_properties.push(
|
94
|
+
invalid_properties.push('invalid value for "score", must be greater than or equal to 0.')
|
94
95
|
end
|
95
96
|
|
96
|
-
|
97
|
+
invalid_properties
|
97
98
|
end
|
98
99
|
|
99
100
|
# Check to see if the all the properties in the model are valid
|
@@ -103,7 +104,7 @@ module AylienNewsApi
|
|
103
104
|
return false unless polarity_validator.valid?(@polarity)
|
104
105
|
return false if !@score.nil? && @score > 1
|
105
106
|
return false if !@score.nil? && @score < 0
|
106
|
-
|
107
|
+
true
|
107
108
|
end
|
108
109
|
|
109
110
|
# Custom attribute writer method checking allowed values (enum).
|
@@ -111,7 +112,7 @@ module AylienNewsApi
|
|
111
112
|
def polarity=(polarity)
|
112
113
|
validator = EnumAttributeValidator.new('String', ["positive", "neutral", "negative"])
|
113
114
|
unless validator.valid?(polarity)
|
114
|
-
fail ArgumentError, "invalid value for
|
115
|
+
fail ArgumentError, "invalid value for \"polarity\", must be one of #{validator.allowable_values}."
|
115
116
|
end
|
116
117
|
@polarity = polarity
|
117
118
|
end
|
@@ -119,13 +120,12 @@ module AylienNewsApi
|
|
119
120
|
# Custom attribute writer method with validation
|
120
121
|
# @param [Object] score Value to be assigned
|
121
122
|
def score=(score)
|
122
|
-
|
123
123
|
if !score.nil? && score > 1
|
124
|
-
fail ArgumentError,
|
124
|
+
fail ArgumentError, 'invalid value for "score", must be smaller than or equal to 1.'
|
125
125
|
end
|
126
126
|
|
127
127
|
if !score.nil? && score < 0
|
128
|
-
fail ArgumentError,
|
128
|
+
fail ArgumentError, 'invalid value for "score", must be greater than or equal to 0.'
|
129
129
|
end
|
130
130
|
|
131
131
|
@score = score
|
@@ -147,22 +147,29 @@ module AylienNewsApi
|
|
147
147
|
end
|
148
148
|
|
149
149
|
# Calculates hash code according to all attributes.
|
150
|
-
# @return [
|
150
|
+
# @return [Integer] Hash code
|
151
151
|
def hash
|
152
152
|
[polarity, score].hash
|
153
153
|
end
|
154
154
|
|
155
|
+
# Builds the object from hash
|
156
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
157
|
+
# @return [Object] Returns the model itself
|
158
|
+
def self.build_from_hash(attributes)
|
159
|
+
new.build_from_hash(attributes)
|
160
|
+
end
|
161
|
+
|
155
162
|
# Builds the object from hash
|
156
163
|
# @param [Hash] attributes Model attributes in the form of hash
|
157
164
|
# @return [Object] Returns the model itself
|
158
165
|
def build_from_hash(attributes)
|
159
166
|
return nil unless attributes.is_a?(Hash)
|
160
|
-
self.class.
|
167
|
+
self.class.openapi_types.each_pair do |key, type|
|
161
168
|
if type =~ /\AArray<(.*)>/i
|
162
|
-
# check to ensure the input is an array given that the
|
169
|
+
# check to ensure the input is an array given that the attribute
|
163
170
|
# is documented as an array but the input is not
|
164
171
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
165
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) }
|
172
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
166
173
|
end
|
167
174
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
168
175
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
@@ -188,7 +195,7 @@ module AylienNewsApi
|
|
188
195
|
value.to_i
|
189
196
|
when :Float
|
190
197
|
value.to_f
|
191
|
-
when :
|
198
|
+
when :Boolean
|
192
199
|
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
193
200
|
true
|
194
201
|
else
|
@@ -209,8 +216,7 @@ module AylienNewsApi
|
|
209
216
|
end
|
210
217
|
end
|
211
218
|
else # model
|
212
|
-
|
213
|
-
temp_model.build_from_hash(value)
|
219
|
+
AylienNewsApi.const_get(type).build_from_hash(value)
|
214
220
|
end
|
215
221
|
end
|
216
222
|
|
@@ -244,7 +250,7 @@ module AylienNewsApi
|
|
244
250
|
# @return [Hash] Returns the value in the form of hash
|
245
251
|
def _to_hash(value)
|
246
252
|
if value.is_a?(Array)
|
247
|
-
value.compact.map{ |v| _to_hash(v) }
|
253
|
+
value.compact.map { |v| _to_hash(v) }
|
248
254
|
elsif value.is_a?(Hash)
|
249
255
|
{}.tap do |hash|
|
250
256
|
value.each { |k, v| hash[k] = _to_hash(v) }
|
@@ -255,7 +261,5 @@ module AylienNewsApi
|
|
255
261
|
value
|
256
262
|
end
|
257
263
|
end
|
258
|
-
|
259
264
|
end
|
260
|
-
|
261
265
|
end
|
@@ -1,76 +1,74 @@
|
|
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 Sentiments
|
22
|
-
# The sentiment for the story title
|
23
|
-
attr_accessor :title
|
24
|
-
|
25
|
-
# The sentiment for the story body
|
26
17
|
attr_accessor :body
|
27
18
|
|
19
|
+
attr_accessor :title
|
28
20
|
|
29
21
|
# Attribute mapping from ruby-style variable name to JSON key.
|
30
22
|
def self.attribute_map
|
31
23
|
{
|
32
|
-
:'
|
33
|
-
:'
|
24
|
+
:'body' => :'body',
|
25
|
+
:'title' => :'title'
|
34
26
|
}
|
35
27
|
end
|
36
28
|
|
37
29
|
# Attribute type mapping.
|
38
|
-
def self.
|
30
|
+
def self.openapi_types
|
39
31
|
{
|
40
|
-
:'
|
41
|
-
:'
|
32
|
+
:'body' => :'Sentiment',
|
33
|
+
:'title' => :'Sentiment'
|
42
34
|
}
|
43
35
|
end
|
44
36
|
|
45
37
|
# Initializes the object
|
46
38
|
# @param [Hash] attributes Model attributes in the form of hash
|
47
39
|
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?(:'title')
|
54
|
-
self.title = attributes[:'title']
|
40
|
+
if (!attributes.is_a?(Hash))
|
41
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::Sentiments` initialize method"
|
55
42
|
end
|
56
43
|
|
57
|
-
if
|
44
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
45
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
46
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
47
|
+
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
|
48
|
+
end
|
49
|
+
h[k.to_sym] = v
|
50
|
+
}
|
51
|
+
|
52
|
+
if attributes.key?(:'body')
|
58
53
|
self.body = attributes[:'body']
|
59
54
|
end
|
60
55
|
|
56
|
+
if attributes.key?(:'title')
|
57
|
+
self.title = attributes[:'title']
|
58
|
+
end
|
61
59
|
end
|
62
60
|
|
63
61
|
# Show invalid properties with the reasons. Usually used together with valid?
|
64
|
-
# @return Array for valid
|
62
|
+
# @return Array for valid properties with the reasons
|
65
63
|
def list_invalid_properties
|
66
64
|
invalid_properties = Array.new
|
67
|
-
|
65
|
+
invalid_properties
|
68
66
|
end
|
69
67
|
|
70
68
|
# Check to see if the all the properties in the model are valid
|
71
69
|
# @return true if the model is valid
|
72
70
|
def valid?
|
73
|
-
|
71
|
+
true
|
74
72
|
end
|
75
73
|
|
76
74
|
# Checks equality by comparing each attribute.
|
@@ -78,8 +76,8 @@ module AylienNewsApi
|
|
78
76
|
def ==(o)
|
79
77
|
return true if self.equal?(o)
|
80
78
|
self.class == o.class &&
|
81
|
-
|
82
|
-
|
79
|
+
body == o.body &&
|
80
|
+
title == o.title
|
83
81
|
end
|
84
82
|
|
85
83
|
# @see the `==` method
|
@@ -89,9 +87,16 @@ module AylienNewsApi
|
|
89
87
|
end
|
90
88
|
|
91
89
|
# Calculates hash code according to all attributes.
|
92
|
-
# @return [
|
90
|
+
# @return [Integer] Hash code
|
93
91
|
def hash
|
94
|
-
[
|
92
|
+
[body, title].hash
|
93
|
+
end
|
94
|
+
|
95
|
+
# Builds the object from hash
|
96
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
97
|
+
# @return [Object] Returns the model itself
|
98
|
+
def self.build_from_hash(attributes)
|
99
|
+
new.build_from_hash(attributes)
|
95
100
|
end
|
96
101
|
|
97
102
|
# Builds the object from hash
|
@@ -99,12 +104,12 @@ module AylienNewsApi
|
|
99
104
|
# @return [Object] Returns the model itself
|
100
105
|
def build_from_hash(attributes)
|
101
106
|
return nil unless attributes.is_a?(Hash)
|
102
|
-
self.class.
|
107
|
+
self.class.openapi_types.each_pair do |key, type|
|
103
108
|
if type =~ /\AArray<(.*)>/i
|
104
|
-
# check to ensure the input is an array given that the
|
109
|
+
# check to ensure the input is an array given that the attribute
|
105
110
|
# is documented as an array but the input is not
|
106
111
|
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) }
|
112
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
108
113
|
end
|
109
114
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
110
115
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
@@ -130,7 +135,7 @@ module AylienNewsApi
|
|
130
135
|
value.to_i
|
131
136
|
when :Float
|
132
137
|
value.to_f
|
133
|
-
when :
|
138
|
+
when :Boolean
|
134
139
|
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
135
140
|
true
|
136
141
|
else
|
@@ -151,8 +156,7 @@ module AylienNewsApi
|
|
151
156
|
end
|
152
157
|
end
|
153
158
|
else # model
|
154
|
-
|
155
|
-
temp_model.build_from_hash(value)
|
159
|
+
AylienNewsApi.const_get(type).build_from_hash(value)
|
156
160
|
end
|
157
161
|
end
|
158
162
|
|
@@ -186,7 +190,7 @@ module AylienNewsApi
|
|
186
190
|
# @return [Hash] Returns the value in the form of hash
|
187
191
|
def _to_hash(value)
|
188
192
|
if value.is_a?(Array)
|
189
|
-
value.compact.map{ |v| _to_hash(v) }
|
193
|
+
value.compact.map { |v| _to_hash(v) }
|
190
194
|
elsif value.is_a?(Hash)
|
191
195
|
{}.tap do |hash|
|
192
196
|
value.each { |k, v| hash[k] = _to_hash(v) }
|
@@ -197,7 +201,5 @@ module AylienNewsApi
|
|
197
201
|
value
|
198
202
|
end
|
199
203
|
end
|
200
|
-
|
201
204
|
end
|
202
|
-
|
203
205
|
end
|
@@ -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 ShareCount
|
22
17
|
# The number of shares
|
23
18
|
attr_accessor :count
|
@@ -25,7 +20,6 @@ module AylienNewsApi
|
|
25
20
|
# The fetched date of the shares
|
26
21
|
attr_accessor :fetched_at
|
27
22
|
|
28
|
-
|
29
23
|
# Attribute mapping from ruby-style variable name to JSON key.
|
30
24
|
def self.attribute_map
|
31
25
|
{
|
@@ -35,7 +29,7 @@ module AylienNewsApi
|
|
35
29
|
end
|
36
30
|
|
37
31
|
# Attribute type mapping.
|
38
|
-
def self.
|
32
|
+
def self.openapi_types
|
39
33
|
{
|
40
34
|
:'count' => :'Integer',
|
41
35
|
:'fetched_at' => :'DateTime'
|
@@ -45,32 +39,38 @@ module AylienNewsApi
|
|
45
39
|
# Initializes the object
|
46
40
|
# @param [Hash] attributes Model attributes in the form of hash
|
47
41
|
def initialize(attributes = {})
|
48
|
-
|
42
|
+
if (!attributes.is_a?(Hash))
|
43
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::ShareCount` initialize method"
|
44
|
+
end
|
49
45
|
|
50
|
-
# convert string to symbol for hash key
|
51
|
-
attributes = attributes.each_with_object({}){|(k,v), h|
|
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::ShareCount`. 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
|
+
}
|
52
53
|
|
53
|
-
if attributes.
|
54
|
+
if attributes.key?(:'count')
|
54
55
|
self.count = attributes[:'count']
|
55
56
|
end
|
56
57
|
|
57
|
-
if attributes.
|
58
|
+
if attributes.key?(:'fetched_at')
|
58
59
|
self.fetched_at = attributes[:'fetched_at']
|
59
60
|
end
|
60
|
-
|
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.
|
@@ -89,22 +89,29 @@ 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
|
[count, fetched_at].hash
|
95
95
|
end
|
96
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)
|
102
|
+
end
|
103
|
+
|
97
104
|
# Builds the object from hash
|
98
105
|
# @param [Hash] attributes Model attributes in the form of hash
|
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
|