aylien_news_api 0.2.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/Gemfile +7 -1
- data/README.md +36 -47
- data/Rakefile +10 -0
- data/aylien_news_api.gemspec +25 -32
- data/docs/Author.md +12 -1
- data/docs/Autocomplete.md +10 -0
- data/docs/Autocompletes.md +9 -0
- data/docs/Category.md +19 -3
- data/docs/CategoryLinks.md +11 -1
- data/docs/CategoryTaxonomy.md +16 -0
- data/docs/Cluster.md +29 -0
- data/docs/Clusters.md +21 -0
- data/docs/Coverages.md +16 -4
- data/docs/DefaultApi.md +1310 -576
- data/docs/Entities.md +11 -1
- data/docs/Entity.md +16 -3
- data/docs/EntityLinks.md +9 -0
- data/docs/Error.md +16 -2
- data/docs/ErrorLinks.md +9 -0
- data/docs/Errors.md +9 -0
- data/docs/HistogramInterval.md +10 -0
- data/docs/Histograms.md +20 -3
- data/docs/Location.md +13 -2
- data/docs/Media.md +19 -1
- data/docs/MediaFormat.md +16 -0
- data/docs/MediaType.md +16 -0
- data/docs/Rank.md +21 -0
- data/docs/Rankings.md +17 -0
- data/docs/RelatedStories.md +14 -3
- data/docs/RepresentativeStory.md +23 -0
- data/docs/Scope.md +15 -3
- data/docs/ScopeLevel.md +16 -0
- data/docs/Sentiment.md +11 -1
- data/docs/SentimentPolarity.md +16 -0
- data/docs/Sentiments.md +12 -2
- data/docs/ShareCount.md +10 -0
- data/docs/ShareCounts.md +12 -0
- data/docs/Source.md +27 -3
- data/docs/Stories.md +15 -2
- data/docs/Story.md +48 -16
- data/docs/StoryCluster.md +14 -1
- data/docs/StoryLinks.md +14 -1
- data/docs/StoryTranslation.md +19 -0
- data/docs/StoryTranslations.md +17 -0
- data/docs/StoryTranslationsEn.md +21 -0
- data/docs/Summary.md +9 -0
- data/docs/TimeSeries.md +11 -1
- data/docs/TimeSeriesList.md +15 -3
- data/docs/Trend.md +11 -1
- data/docs/Trends.md +15 -1
- data/git_push.sh +58 -0
- data/lib/aylien_news_api.rb +23 -14
- data/lib/aylien_news_api/api/default_api.rb +2755 -892
- data/lib/aylien_news_api/api_client.rb +141 -102
- data/lib/aylien_news_api/api_error.rb +37 -18
- data/lib/aylien_news_api/configuration.rb +94 -43
- data/lib/aylien_news_api/models/author.rb +69 -53
- data/lib/aylien_news_api/models/autocomplete.rb +55 -39
- data/lib/aylien_news_api/models/autocompletes.rb +54 -38
- data/lib/aylien_news_api/models/category.rb +88 -97
- data/lib/aylien_news_api/models/category_links.rb +66 -50
- data/lib/aylien_news_api/models/category_taxonomy.rb +36 -0
- data/lib/aylien_news_api/models/cluster.rb +265 -0
- data/lib/aylien_news_api/models/clusters.rb +229 -0
- data/lib/aylien_news_api/models/coverages.rb +79 -75
- data/lib/aylien_news_api/models/entities.rb +67 -51
- data/lib/aylien_news_api/models/entity.rb +100 -81
- data/lib/aylien_news_api/models/entity_links.rb +54 -38
- data/lib/aylien_news_api/models/error.rb +79 -63
- data/lib/aylien_news_api/models/error_links.rb +54 -38
- data/lib/aylien_news_api/models/errors.rb +54 -38
- data/lib/aylien_news_api/models/histogram_interval.rb +55 -39
- data/lib/aylien_news_api/models/histograms.rb +99 -63
- data/lib/aylien_news_api/models/location.rb +70 -54
- data/lib/aylien_news_api/models/media.rb +97 -76
- data/lib/aylien_news_api/models/media_format.rb +44 -0
- data/lib/aylien_news_api/models/media_type.rb +36 -0
- data/lib/aylien_news_api/models/rank.rb +227 -0
- data/lib/aylien_news_api/models/rankings.rb +208 -0
- data/lib/aylien_news_api/models/related_stories.rb +72 -68
- data/lib/aylien_news_api/models/representative_story.rb +237 -0
- data/lib/aylien_news_api/models/scope.rb +76 -94
- data/lib/aylien_news_api/models/scope_level.rb +37 -0
- data/lib/aylien_news_api/models/sentiment.rb +70 -84
- data/lib/aylien_news_api/models/sentiment_polarity.rb +37 -0
- data/lib/aylien_news_api/models/sentiments.rb +65 -51
- data/lib/aylien_news_api/models/share_count.rb +55 -39
- data/lib/aylien_news_api/models/share_counts.rb +57 -41
- data/lib/aylien_news_api/models/source.rb +129 -64
- data/lib/aylien_news_api/models/stories.rb +79 -55
- data/lib/aylien_news_api/models/story.rb +191 -161
- data/lib/aylien_news_api/models/story_cluster.rb +71 -55
- data/lib/aylien_news_api/models/story_links.rb +73 -47
- data/lib/aylien_news_api/models/story_translation.rb +217 -0
- data/lib/aylien_news_api/models/story_translations.rb +207 -0
- data/lib/aylien_news_api/models/story_translations_en.rb +227 -0
- data/lib/aylien_news_api/models/summary.rb +54 -38
- data/lib/aylien_news_api/models/time_series.rb +66 -50
- data/lib/aylien_news_api/models/time_series_list.rb +75 -59
- data/lib/aylien_news_api/models/trend.rb +66 -50
- data/lib/aylien_news_api/models/trends.rb +80 -44
- data/lib/aylien_news_api/version.rb +12 -14
- data/spec/api/default_api_spec.rb +620 -284
- data/spec/api_client_spec.rb +43 -161
- data/spec/configuration_spec.rb +22 -19
- data/spec/models/author_spec.rb +21 -34
- data/spec/models/autocomplete_spec.rb +17 -26
- data/spec/models/autocompletes_spec.rb +16 -21
- data/spec/models/category_links_spec.rb +19 -28
- data/spec/models/category_spec.rb +31 -50
- data/spec/models/category_taxonomy_spec.rb +35 -0
- data/spec/models/cluster_spec.rb +77 -0
- data/spec/models/clusters_spec.rb +53 -0
- data/spec/models/coverages_spec.rb +24 -45
- data/spec/models/entities_spec.rb +19 -28
- data/spec/models/entity_links_spec.rb +16 -21
- data/spec/models/entity_spec.rb +25 -46
- data/spec/models/error_links_spec.rb +16 -21
- data/spec/models/error_spec.rb +27 -52
- data/spec/models/errors_spec.rb +16 -21
- data/spec/models/histogram_interval_spec.rb +17 -26
- data/spec/models/histograms_spec.rb +36 -45
- data/spec/models/location_spec.rb +21 -34
- data/spec/models/media_format_spec.rb +35 -0
- data/spec/models/media_spec.rb +41 -26
- data/spec/models/media_type_spec.rb +35 -0
- data/spec/models/rank_spec.rb +53 -0
- data/spec/models/rankings_spec.rb +41 -0
- data/spec/models/related_stories_spec.rb +21 -38
- data/spec/models/representative_story_spec.rb +59 -0
- data/spec/models/scope_level_spec.rb +35 -0
- data/spec/models/scope_spec.rb +23 -40
- data/spec/models/sentiment_polarity_spec.rb +35 -0
- data/spec/models/sentiment_spec.rb +17 -26
- data/spec/models/sentiments_spec.rb +19 -28
- data/spec/models/share_count_spec.rb +17 -26
- data/spec/models/share_counts_spec.rb +19 -36
- data/spec/models/source_spec.rb +54 -49
- data/spec/models/stories_spec.rb +26 -33
- data/spec/models/story_cluster_spec.rb +23 -44
- data/spec/models/story_links_spec.rb +25 -32
- data/spec/models/story_spec.rb +65 -134
- data/spec/models/story_translation_spec.rb +47 -0
- data/spec/models/story_translations_en_spec.rb +53 -0
- data/spec/models/story_translations_spec.rb +41 -0
- data/spec/models/summary_spec.rb +16 -21
- data/spec/models/time_series_list_spec.rb +22 -39
- data/spec/models/time_series_spec.rb +19 -28
- data/spec/models/trend_spec.rb +19 -28
- data/spec/models/trends_spec.rb +30 -27
- data/spec/spec_helper.rb +11 -13
- metadata +95 -193
- data/Gemfile.lock +0 -65
- data/LICENSE +0 -13
@@ -1,107 +1,116 @@
|
|
1
|
-
|
2
|
-
#
|
3
|
-
|
4
|
-
#
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
1
|
+
=begin
|
2
|
+
#AYLIEN News API
|
3
|
+
|
4
|
+
#The AYLIEN News API is the most powerful way of sourcing, searching and syndicating analyzed and enriched news content. It is accessed by sending HTTP requests to our server, which returns information to your client.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 3.0
|
7
|
+
Contact: support@aylien.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
14
12
|
|
15
13
|
require 'date'
|
16
14
|
|
17
15
|
module AylienNewsApi
|
18
|
-
|
19
16
|
class Media
|
20
|
-
# The
|
17
|
+
# The content length of media
|
18
|
+
attr_accessor :content_length
|
19
|
+
|
20
|
+
attr_accessor :format
|
21
|
+
|
22
|
+
# The height of media
|
23
|
+
attr_accessor :height
|
24
|
+
|
21
25
|
attr_accessor :type
|
22
26
|
|
23
27
|
# A URL which points to the media file
|
24
28
|
attr_accessor :url
|
25
29
|
|
26
|
-
|
27
|
-
|
28
|
-
attr_reader :allowable_values
|
29
|
-
|
30
|
-
def initialize(datatype, allowable_values)
|
31
|
-
@allowable_values = allowable_values.map do |value|
|
32
|
-
case datatype.to_s
|
33
|
-
when /Integer/i
|
34
|
-
value.to_i
|
35
|
-
when /Float/i
|
36
|
-
value.to_f
|
37
|
-
else
|
38
|
-
value
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
def valid?(value)
|
44
|
-
!value || allowable_values.include?(value)
|
45
|
-
end
|
46
|
-
end
|
30
|
+
# The width of media
|
31
|
+
attr_accessor :width
|
47
32
|
|
48
33
|
# Attribute mapping from ruby-style variable name to JSON key.
|
49
34
|
def self.attribute_map
|
50
35
|
{
|
36
|
+
:'content_length' => :'content_length',
|
37
|
+
:'format' => :'format',
|
38
|
+
:'height' => :'height',
|
51
39
|
:'type' => :'type',
|
52
|
-
:'url' => :'url'
|
40
|
+
:'url' => :'url',
|
41
|
+
:'width' => :'width'
|
53
42
|
}
|
54
43
|
end
|
55
44
|
|
56
45
|
# Attribute type mapping.
|
57
|
-
def self.
|
46
|
+
def self.openapi_types
|
58
47
|
{
|
59
|
-
:'
|
60
|
-
:'
|
48
|
+
:'content_length' => :'Integer',
|
49
|
+
:'format' => :'MediaFormat',
|
50
|
+
:'height' => :'Integer',
|
51
|
+
:'type' => :'MediaType',
|
52
|
+
:'url' => :'String',
|
53
|
+
:'width' => :'Integer'
|
61
54
|
}
|
62
55
|
end
|
63
56
|
|
57
|
+
# List of attributes with nullable: true
|
58
|
+
def self.openapi_nullable
|
59
|
+
Set.new([
|
60
|
+
])
|
61
|
+
end
|
62
|
+
|
64
63
|
# Initializes the object
|
65
64
|
# @param [Hash] attributes Model attributes in the form of hash
|
66
65
|
def initialize(attributes = {})
|
67
|
-
|
66
|
+
if (!attributes.is_a?(Hash))
|
67
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::Media` initialize method"
|
68
|
+
end
|
69
|
+
|
70
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
71
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
72
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
73
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `AylienNewsApi::Media`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
74
|
+
end
|
75
|
+
h[k.to_sym] = v
|
76
|
+
}
|
68
77
|
|
69
|
-
|
70
|
-
|
78
|
+
if attributes.key?(:'content_length')
|
79
|
+
self.content_length = attributes[:'content_length']
|
80
|
+
end
|
71
81
|
|
72
|
-
if attributes.
|
82
|
+
if attributes.key?(:'format')
|
83
|
+
self.format = attributes[:'format']
|
84
|
+
end
|
85
|
+
|
86
|
+
if attributes.key?(:'height')
|
87
|
+
self.height = attributes[:'height']
|
88
|
+
end
|
89
|
+
|
90
|
+
if attributes.key?(:'type')
|
73
91
|
self.type = attributes[:'type']
|
74
92
|
end
|
75
93
|
|
76
|
-
if attributes.
|
94
|
+
if attributes.key?(:'url')
|
77
95
|
self.url = attributes[:'url']
|
78
96
|
end
|
79
97
|
|
98
|
+
if attributes.key?(:'width')
|
99
|
+
self.width = attributes[:'width']
|
100
|
+
end
|
80
101
|
end
|
81
102
|
|
82
103
|
# Show invalid properties with the reasons. Usually used together with valid?
|
83
|
-
# @return Array for valid
|
104
|
+
# @return Array for valid properties with the reasons
|
84
105
|
def list_invalid_properties
|
85
106
|
invalid_properties = Array.new
|
86
|
-
|
107
|
+
invalid_properties
|
87
108
|
end
|
88
109
|
|
89
110
|
# Check to see if the all the properties in the model are valid
|
90
111
|
# @return true if the model is valid
|
91
112
|
def valid?
|
92
|
-
|
93
|
-
return false unless type_validator.valid?(@type)
|
94
|
-
return true
|
95
|
-
end
|
96
|
-
|
97
|
-
# Custom attribute writer method checking allowed values (enum).
|
98
|
-
# @param [Object] type Object to be assigned
|
99
|
-
def type=(type)
|
100
|
-
validator = EnumAttributeValidator.new('String', ["image", "video"])
|
101
|
-
unless validator.valid?(type)
|
102
|
-
fail ArgumentError, "invalid value for 'type', must be one of #{validator.allowable_values}."
|
103
|
-
end
|
104
|
-
@type = type
|
113
|
+
true
|
105
114
|
end
|
106
115
|
|
107
116
|
# Checks equality by comparing each attribute.
|
@@ -109,8 +118,12 @@ module AylienNewsApi
|
|
109
118
|
def ==(o)
|
110
119
|
return true if self.equal?(o)
|
111
120
|
self.class == o.class &&
|
121
|
+
content_length == o.content_length &&
|
122
|
+
format == o.format &&
|
123
|
+
height == o.height &&
|
112
124
|
type == o.type &&
|
113
|
-
url == o.url
|
125
|
+
url == o.url &&
|
126
|
+
width == o.width
|
114
127
|
end
|
115
128
|
|
116
129
|
# @see the `==` method
|
@@ -120,9 +133,16 @@ module AylienNewsApi
|
|
120
133
|
end
|
121
134
|
|
122
135
|
# Calculates hash code according to all attributes.
|
123
|
-
# @return [
|
136
|
+
# @return [Integer] Hash code
|
124
137
|
def hash
|
125
|
-
[type, url].hash
|
138
|
+
[content_length, format, height, type, url, width].hash
|
139
|
+
end
|
140
|
+
|
141
|
+
# Builds the object from hash
|
142
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
143
|
+
# @return [Object] Returns the model itself
|
144
|
+
def self.build_from_hash(attributes)
|
145
|
+
new.build_from_hash(attributes)
|
126
146
|
end
|
127
147
|
|
128
148
|
# Builds the object from hash
|
@@ -130,12 +150,12 @@ module AylienNewsApi
|
|
130
150
|
# @return [Object] Returns the model itself
|
131
151
|
def build_from_hash(attributes)
|
132
152
|
return nil unless attributes.is_a?(Hash)
|
133
|
-
self.class.
|
134
|
-
if type =~
|
135
|
-
# check to ensure the input is an array given that the
|
153
|
+
self.class.openapi_types.each_pair do |key, type|
|
154
|
+
if type =~ /\AArray<(.*)>/i
|
155
|
+
# check to ensure the input is an array given that the attribute
|
136
156
|
# is documented as an array but the input is not
|
137
157
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
138
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) }
|
158
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
139
159
|
end
|
140
160
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
141
161
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
@@ -161,8 +181,8 @@ module AylienNewsApi
|
|
161
181
|
value.to_i
|
162
182
|
when :Float
|
163
183
|
value.to_f
|
164
|
-
when :
|
165
|
-
if value.to_s =~
|
184
|
+
when :Boolean
|
185
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
166
186
|
true
|
167
187
|
else
|
168
188
|
false
|
@@ -173,7 +193,7 @@ module AylienNewsApi
|
|
173
193
|
when /\AArray<(?<inner_type>.+)>\z/
|
174
194
|
inner_type = Regexp.last_match[:inner_type]
|
175
195
|
value.map { |v| _deserialize(inner_type, v) }
|
176
|
-
when /\AHash<(?<k_type
|
196
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
177
197
|
k_type = Regexp.last_match[:k_type]
|
178
198
|
v_type = Regexp.last_match[:v_type]
|
179
199
|
{}.tap do |hash|
|
@@ -182,8 +202,7 @@ module AylienNewsApi
|
|
182
202
|
end
|
183
203
|
end
|
184
204
|
else # model
|
185
|
-
|
186
|
-
temp_model.build_from_hash(value)
|
205
|
+
AylienNewsApi.const_get(type).build_from_hash(value)
|
187
206
|
end
|
188
207
|
end
|
189
208
|
|
@@ -205,7 +224,11 @@ module AylienNewsApi
|
|
205
224
|
hash = {}
|
206
225
|
self.class.attribute_map.each_pair do |attr, param|
|
207
226
|
value = self.send(attr)
|
208
|
-
|
227
|
+
if value.nil?
|
228
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
229
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
230
|
+
end
|
231
|
+
|
209
232
|
hash[param] = _to_hash(value)
|
210
233
|
end
|
211
234
|
hash
|
@@ -217,7 +240,7 @@ module AylienNewsApi
|
|
217
240
|
# @return [Hash] Returns the value in the form of hash
|
218
241
|
def _to_hash(value)
|
219
242
|
if value.is_a?(Array)
|
220
|
-
value.compact.map{ |v| _to_hash(v) }
|
243
|
+
value.compact.map { |v| _to_hash(v) }
|
221
244
|
elsif value.is_a?(Hash)
|
222
245
|
{}.tap do |hash|
|
223
246
|
value.each { |k, v| hash[k] = _to_hash(v) }
|
@@ -228,7 +251,5 @@ module AylienNewsApi
|
|
228
251
|
value
|
229
252
|
end
|
230
253
|
end
|
231
|
-
|
232
254
|
end
|
233
|
-
|
234
255
|
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
=begin
|
2
|
+
#AYLIEN News API
|
3
|
+
|
4
|
+
#The AYLIEN News API is the most powerful way of sourcing, searching and syndicating analyzed and enriched news content. It is accessed by sending HTTP requests to our server, which returns information to your client.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 3.0
|
7
|
+
Contact: support@aylien.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module AylienNewsApi
|
16
|
+
class MediaFormat
|
17
|
+
BMP = "BMP".freeze
|
18
|
+
GIF = "GIF".freeze
|
19
|
+
JPEG = "JPEG".freeze
|
20
|
+
PNG = "PNG".freeze
|
21
|
+
TIFF = "TIFF".freeze
|
22
|
+
PSD = "PSD".freeze
|
23
|
+
ICO = "ICO".freeze
|
24
|
+
CUR = "CUR".freeze
|
25
|
+
WEBP = "WEBP".freeze
|
26
|
+
SVG = "SVG".freeze
|
27
|
+
|
28
|
+
# Builds the enum from string
|
29
|
+
# @param [String] The enum value in the form of the string
|
30
|
+
# @return [String] The enum value
|
31
|
+
def self.build_from_hash(value)
|
32
|
+
new.build_from_hash(value)
|
33
|
+
end
|
34
|
+
|
35
|
+
# Builds the enum from string
|
36
|
+
# @param [String] The enum value in the form of the string
|
37
|
+
# @return [String] The enum value
|
38
|
+
def build_from_hash(value)
|
39
|
+
constantValues = MediaFormat.constants.select { |c| MediaFormat::const_get(c) == value }
|
40
|
+
raise "Invalid ENUM value #{value} for class #MediaFormat" if constantValues.empty?
|
41
|
+
value
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
=begin
|
2
|
+
#AYLIEN News API
|
3
|
+
|
4
|
+
#The AYLIEN News API is the most powerful way of sourcing, searching and syndicating analyzed and enriched news content. It is accessed by sending HTTP requests to our server, which returns information to your client.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 3.0
|
7
|
+
Contact: support@aylien.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module AylienNewsApi
|
16
|
+
class MediaType
|
17
|
+
IMAGE = "image".freeze
|
18
|
+
VIDEO = "video".freeze
|
19
|
+
|
20
|
+
# Builds the enum from string
|
21
|
+
# @param [String] The enum value in the form of the string
|
22
|
+
# @return [String] The enum value
|
23
|
+
def self.build_from_hash(value)
|
24
|
+
new.build_from_hash(value)
|
25
|
+
end
|
26
|
+
|
27
|
+
# Builds the enum from string
|
28
|
+
# @param [String] The enum value in the form of the string
|
29
|
+
# @return [String] The enum value
|
30
|
+
def build_from_hash(value)
|
31
|
+
constantValues = MediaType.constants.select { |c| MediaType::const_get(c) == value }
|
32
|
+
raise "Invalid ENUM value #{value} for class #MediaType" if constantValues.empty?
|
33
|
+
value
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,227 @@
|
|
1
|
+
=begin
|
2
|
+
#AYLIEN News API
|
3
|
+
|
4
|
+
#The AYLIEN News API is the most powerful way of sourcing, searching and syndicating analyzed and enriched news content. It is accessed by sending HTTP requests to our server, which returns information to your client.
|
5
|
+
|
6
|
+
The version of the OpenAPI document: 3.0
|
7
|
+
Contact: support@aylien.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.0.0-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module AylienNewsApi
|
16
|
+
class Rank
|
17
|
+
# The country code which the rank is in it
|
18
|
+
attr_accessor :country
|
19
|
+
|
20
|
+
# The fetched date of the rank
|
21
|
+
attr_accessor :fetched_at
|
22
|
+
|
23
|
+
# The rank
|
24
|
+
attr_accessor :rank
|
25
|
+
|
26
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
27
|
+
def self.attribute_map
|
28
|
+
{
|
29
|
+
:'country' => :'country',
|
30
|
+
:'fetched_at' => :'fetched_at',
|
31
|
+
:'rank' => :'rank'
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
# Attribute type mapping.
|
36
|
+
def self.openapi_types
|
37
|
+
{
|
38
|
+
:'country' => :'String',
|
39
|
+
:'fetched_at' => :'DateTime',
|
40
|
+
:'rank' => :'Integer'
|
41
|
+
}
|
42
|
+
end
|
43
|
+
|
44
|
+
# List of attributes with nullable: true
|
45
|
+
def self.openapi_nullable
|
46
|
+
Set.new([
|
47
|
+
])
|
48
|
+
end
|
49
|
+
|
50
|
+
# Initializes the object
|
51
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
52
|
+
def initialize(attributes = {})
|
53
|
+
if (!attributes.is_a?(Hash))
|
54
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::Rank` initialize method"
|
55
|
+
end
|
56
|
+
|
57
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
58
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
59
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
60
|
+
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
|
61
|
+
end
|
62
|
+
h[k.to_sym] = v
|
63
|
+
}
|
64
|
+
|
65
|
+
if attributes.key?(:'country')
|
66
|
+
self.country = attributes[:'country']
|
67
|
+
end
|
68
|
+
|
69
|
+
if attributes.key?(:'fetched_at')
|
70
|
+
self.fetched_at = attributes[:'fetched_at']
|
71
|
+
end
|
72
|
+
|
73
|
+
if attributes.key?(:'rank')
|
74
|
+
self.rank = attributes[:'rank']
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
79
|
+
# @return Array for valid properties with the reasons
|
80
|
+
def list_invalid_properties
|
81
|
+
invalid_properties = Array.new
|
82
|
+
invalid_properties
|
83
|
+
end
|
84
|
+
|
85
|
+
# Check to see if the all the properties in the model are valid
|
86
|
+
# @return true if the model is valid
|
87
|
+
def valid?
|
88
|
+
true
|
89
|
+
end
|
90
|
+
|
91
|
+
# Checks equality by comparing each attribute.
|
92
|
+
# @param [Object] Object to be compared
|
93
|
+
def ==(o)
|
94
|
+
return true if self.equal?(o)
|
95
|
+
self.class == o.class &&
|
96
|
+
country == o.country &&
|
97
|
+
fetched_at == o.fetched_at &&
|
98
|
+
rank == o.rank
|
99
|
+
end
|
100
|
+
|
101
|
+
# @see the `==` method
|
102
|
+
# @param [Object] Object to be compared
|
103
|
+
def eql?(o)
|
104
|
+
self == o
|
105
|
+
end
|
106
|
+
|
107
|
+
# Calculates hash code according to all attributes.
|
108
|
+
# @return [Integer] Hash code
|
109
|
+
def hash
|
110
|
+
[country, fetched_at, rank].hash
|
111
|
+
end
|
112
|
+
|
113
|
+
# Builds the object from hash
|
114
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
115
|
+
# @return [Object] Returns the model itself
|
116
|
+
def self.build_from_hash(attributes)
|
117
|
+
new.build_from_hash(attributes)
|
118
|
+
end
|
119
|
+
|
120
|
+
# Builds the object from hash
|
121
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
122
|
+
# @return [Object] Returns the model itself
|
123
|
+
def build_from_hash(attributes)
|
124
|
+
return nil unless attributes.is_a?(Hash)
|
125
|
+
self.class.openapi_types.each_pair do |key, type|
|
126
|
+
if type =~ /\AArray<(.*)>/i
|
127
|
+
# check to ensure the input is an array given that the attribute
|
128
|
+
# is documented as an array but the input is not
|
129
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
130
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
131
|
+
end
|
132
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
133
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
134
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
135
|
+
end
|
136
|
+
|
137
|
+
self
|
138
|
+
end
|
139
|
+
|
140
|
+
# Deserializes the data based on type
|
141
|
+
# @param string type Data type
|
142
|
+
# @param string value Value to be deserialized
|
143
|
+
# @return [Object] Deserialized data
|
144
|
+
def _deserialize(type, value)
|
145
|
+
case type.to_sym
|
146
|
+
when :DateTime
|
147
|
+
DateTime.parse(value)
|
148
|
+
when :Date
|
149
|
+
Date.parse(value)
|
150
|
+
when :String
|
151
|
+
value.to_s
|
152
|
+
when :Integer
|
153
|
+
value.to_i
|
154
|
+
when :Float
|
155
|
+
value.to_f
|
156
|
+
when :Boolean
|
157
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
158
|
+
true
|
159
|
+
else
|
160
|
+
false
|
161
|
+
end
|
162
|
+
when :Object
|
163
|
+
# generic object (usually a Hash), return directly
|
164
|
+
value
|
165
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
166
|
+
inner_type = Regexp.last_match[:inner_type]
|
167
|
+
value.map { |v| _deserialize(inner_type, v) }
|
168
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
169
|
+
k_type = Regexp.last_match[:k_type]
|
170
|
+
v_type = Regexp.last_match[:v_type]
|
171
|
+
{}.tap do |hash|
|
172
|
+
value.each do |k, v|
|
173
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
174
|
+
end
|
175
|
+
end
|
176
|
+
else # model
|
177
|
+
AylienNewsApi.const_get(type).build_from_hash(value)
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
# Returns the string representation of the object
|
182
|
+
# @return [String] String presentation of the object
|
183
|
+
def to_s
|
184
|
+
to_hash.to_s
|
185
|
+
end
|
186
|
+
|
187
|
+
# to_body is an alias to to_hash (backward compatibility)
|
188
|
+
# @return [Hash] Returns the object in the form of hash
|
189
|
+
def to_body
|
190
|
+
to_hash
|
191
|
+
end
|
192
|
+
|
193
|
+
# Returns the object in the form of hash
|
194
|
+
# @return [Hash] Returns the object in the form of hash
|
195
|
+
def to_hash
|
196
|
+
hash = {}
|
197
|
+
self.class.attribute_map.each_pair do |attr, param|
|
198
|
+
value = self.send(attr)
|
199
|
+
if value.nil?
|
200
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
201
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
202
|
+
end
|
203
|
+
|
204
|
+
hash[param] = _to_hash(value)
|
205
|
+
end
|
206
|
+
hash
|
207
|
+
end
|
208
|
+
|
209
|
+
# Outputs non-array value in the form of hash
|
210
|
+
# For object, use to_hash. Otherwise, just return the value
|
211
|
+
# @param [Object] value Any valid value
|
212
|
+
# @return [Hash] Returns the value in the form of hash
|
213
|
+
def _to_hash(value)
|
214
|
+
if value.is_a?(Array)
|
215
|
+
value.compact.map { |v| _to_hash(v) }
|
216
|
+
elsif value.is_a?(Hash)
|
217
|
+
{}.tap do |hash|
|
218
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
219
|
+
end
|
220
|
+
elsif value.respond_to? :to_hash
|
221
|
+
value.to_hash
|
222
|
+
else
|
223
|
+
value
|
224
|
+
end
|
225
|
+
end
|
226
|
+
end
|
227
|
+
end
|