aylien_news_api 0.3.0 → 4.1.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 +117 -4
- data/Rakefile +10 -0
- data/aylien_news_api.gemspec +24 -31
- 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 -636
- 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 +11 -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 +12 -1
- data/docs/Rankings.md +9 -0
- data/docs/RelatedStories.md +18 -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 -8
- data/docs/Stories.md +17 -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/docs/Warning.md +21 -0
- data/git_push.sh +58 -0
- data/lib/aylien_news_api.rb +22 -14
- data/lib/aylien_news_api/api/default_api.rb +2631 -1120
- data/lib/aylien_news_api/api_client.rb +139 -105
- data/lib/aylien_news_api/api_error.rb +37 -18
- data/lib/aylien_news_api/configuration.rb +80 -42
- 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 +96 -83
- 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 +65 -40
- 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 +67 -51
- data/lib/aylien_news_api/models/rankings.rb +54 -38
- data/lib/aylien_news_api/models/related_stories.rb +87 -63
- 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 +66 -86
- 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 +114 -99
- data/lib/aylien_news_api/models/stories.rb +89 -53
- 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/models/warning.rb +226 -0
- 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 +22 -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 +20 -21
- data/spec/models/rankings_spec.rb +15 -16
- data/spec/models/related_stories_spec.rb +33 -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 +32 -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/models/warning_spec.rb +53 -0
- data/spec/spec_helper.rb +11 -13
- metadata +92 -195
- data/Gemfile.lock +0 -65
- data/LICENSE +0 -13
- data/aylien_news_api-0.2.0.gem +0 -0
@@ -1,18 +1,14 @@
|
|
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.
|
14
|
-
|
15
|
-
require 'uri'
|
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
|
16
12
|
|
17
13
|
module AylienNewsApi
|
18
14
|
class Configuration
|
@@ -78,6 +74,11 @@ module AylienNewsApi
|
|
78
74
|
# Default to 0 (never times out).
|
79
75
|
attr_accessor :timeout
|
80
76
|
|
77
|
+
# Set this to false to skip client side validation in the operation.
|
78
|
+
# Default to true.
|
79
|
+
# @return [true, false]
|
80
|
+
attr_accessor :client_side_validation
|
81
|
+
|
81
82
|
### TLS/SSL setting
|
82
83
|
# Set this to false to skip verifying SSL certificate when calling API from https server.
|
83
84
|
# Default to true.
|
@@ -85,33 +86,28 @@ module AylienNewsApi
|
|
85
86
|
# @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
|
86
87
|
#
|
87
88
|
# @return [true, false]
|
88
|
-
attr_accessor :
|
89
|
+
attr_accessor :ssl_verify
|
89
90
|
|
90
91
|
### TLS/SSL setting
|
91
|
-
#
|
92
|
-
# Default to true.
|
92
|
+
# Any `OpenSSL::SSL::` constant (see https://ruby-doc.org/stdlib-2.5.1/libdoc/openssl/rdoc/OpenSSL/SSL.html)
|
93
93
|
#
|
94
94
|
# @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
|
95
95
|
#
|
96
|
-
|
97
|
-
attr_accessor :verify_ssl_host
|
96
|
+
attr_accessor :ssl_verify_mode
|
98
97
|
|
99
98
|
### TLS/SSL setting
|
100
99
|
# Set this to customize the certificate file to verify the peer.
|
101
100
|
#
|
102
101
|
# @return [String] the path to the certificate file
|
103
|
-
|
104
|
-
# @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code:
|
105
|
-
# https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145
|
106
|
-
attr_accessor :ssl_ca_cert
|
102
|
+
attr_accessor :ssl_ca_file
|
107
103
|
|
108
104
|
### TLS/SSL setting
|
109
105
|
# Client certificate file (for client certificate)
|
110
|
-
attr_accessor :
|
106
|
+
attr_accessor :ssl_client_cert
|
111
107
|
|
112
108
|
### TLS/SSL setting
|
113
109
|
# Client private key file (for client certificate)
|
114
|
-
attr_accessor :
|
110
|
+
attr_accessor :ssl_client_key
|
115
111
|
|
116
112
|
# Set this to customize parameters encoding of array parameter with multi collectionFormat.
|
117
113
|
# Default to nil.
|
@@ -126,16 +122,17 @@ module AylienNewsApi
|
|
126
122
|
|
127
123
|
def initialize
|
128
124
|
@scheme = 'https'
|
129
|
-
@host = 'api.
|
130
|
-
@base_path = '/
|
125
|
+
@host = 'api.aylien.com'
|
126
|
+
@base_path = '/news'
|
131
127
|
@api_key = {}
|
132
128
|
@api_key_prefix = {}
|
133
129
|
@timeout = 0
|
134
|
-
@
|
135
|
-
@
|
136
|
-
@
|
137
|
-
@
|
138
|
-
@
|
130
|
+
@client_side_validation = true
|
131
|
+
@ssl_verify = true
|
132
|
+
@ssl_verify_mode = nil
|
133
|
+
@ssl_ca_file = nil
|
134
|
+
@ssl_client_cert = nil
|
135
|
+
@ssl_client_key = nil
|
139
136
|
@debugging = false
|
140
137
|
@inject_format = false
|
141
138
|
@force_ending_format = false
|
@@ -166,12 +163,11 @@ module AylienNewsApi
|
|
166
163
|
def base_path=(base_path)
|
167
164
|
# Add leading and trailing slashes to base_path
|
168
165
|
@base_path = "/#{base_path}".gsub(/\/+/, '/')
|
169
|
-
@base_path =
|
166
|
+
@base_path = '' if @base_path == '/'
|
170
167
|
end
|
171
168
|
|
172
169
|
def base_url
|
173
|
-
|
174
|
-
URI.encode(url)
|
170
|
+
"#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
|
175
171
|
end
|
176
172
|
|
177
173
|
# Gets API key (with prefix if set).
|
@@ -192,21 +188,63 @@ module AylienNewsApi
|
|
192
188
|
# Returns Auth Settings hash for api client.
|
193
189
|
def auth_settings
|
194
190
|
{
|
195
|
-
'
|
191
|
+
'app_id' =>
|
196
192
|
{
|
197
193
|
type: 'api_key',
|
198
194
|
in: 'header',
|
199
|
-
key: 'X-AYLIEN-NewsAPI-Application-
|
200
|
-
value: api_key_with_prefix('X-AYLIEN-NewsAPI-Application-
|
195
|
+
key: 'X-AYLIEN-NewsAPI-Application-ID',
|
196
|
+
value: api_key_with_prefix('X-AYLIEN-NewsAPI-Application-ID')
|
201
197
|
},
|
202
|
-
'
|
198
|
+
'app_key' =>
|
203
199
|
{
|
204
200
|
type: 'api_key',
|
205
201
|
in: 'header',
|
206
|
-
key: 'X-AYLIEN-NewsAPI-Application-
|
207
|
-
value: api_key_with_prefix('X-AYLIEN-NewsAPI-Application-
|
202
|
+
key: 'X-AYLIEN-NewsAPI-Application-Key',
|
203
|
+
value: api_key_with_prefix('X-AYLIEN-NewsAPI-Application-Key')
|
208
204
|
},
|
209
205
|
}
|
210
206
|
end
|
207
|
+
|
208
|
+
# Returns an array of Server setting
|
209
|
+
def server_settings
|
210
|
+
[
|
211
|
+
{
|
212
|
+
url: "https://api.aylien.com/news",
|
213
|
+
description: "No description provided",
|
214
|
+
}
|
215
|
+
]
|
216
|
+
end
|
217
|
+
|
218
|
+
# Returns URL based on server settings
|
219
|
+
#
|
220
|
+
# @param index array index of the server settings
|
221
|
+
# @param variables hash of variable and the corresponding value
|
222
|
+
def server_url(index, variables = {})
|
223
|
+
servers = server_settings
|
224
|
+
|
225
|
+
# check array index out of bound
|
226
|
+
if (index < 0 || index >= servers.size)
|
227
|
+
fail ArgumentError, "Invalid index #{index} when selecting the server. Must be less than #{servers.size}"
|
228
|
+
end
|
229
|
+
|
230
|
+
server = servers[index]
|
231
|
+
url = server[:url]
|
232
|
+
|
233
|
+
# go through variable and assign a value
|
234
|
+
server[:variables].each do |name, variable|
|
235
|
+
if variables.key?(name)
|
236
|
+
if (server[:variables][name][:enum_values].include? variables[name])
|
237
|
+
url.gsub! "{" + name.to_s + "}", variables[name]
|
238
|
+
else
|
239
|
+
fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}."
|
240
|
+
end
|
241
|
+
else
|
242
|
+
# use default value
|
243
|
+
url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value]
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
247
|
+
url
|
248
|
+
end
|
211
249
|
end
|
212
250
|
end
|
@@ -1,83 +1,91 @@
|
|
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 Author
|
17
|
+
# A URL which points to the author avatar
|
18
|
+
attr_accessor :avatar_url
|
19
|
+
|
20
20
|
# A unique identification for the author
|
21
21
|
attr_accessor :id
|
22
22
|
|
23
23
|
# The extracted author full name
|
24
24
|
attr_accessor :name
|
25
25
|
|
26
|
-
# A URL which points to the author avatar
|
27
|
-
attr_accessor :avatar_url
|
28
|
-
|
29
|
-
|
30
26
|
# Attribute mapping from ruby-style variable name to JSON key.
|
31
27
|
def self.attribute_map
|
32
28
|
{
|
29
|
+
:'avatar_url' => :'avatar_url',
|
33
30
|
:'id' => :'id',
|
34
|
-
:'name' => :'name'
|
35
|
-
:'avatar_url' => :'avatar_url'
|
31
|
+
:'name' => :'name'
|
36
32
|
}
|
37
33
|
end
|
38
34
|
|
39
35
|
# Attribute type mapping.
|
40
|
-
def self.
|
36
|
+
def self.openapi_types
|
41
37
|
{
|
38
|
+
:'avatar_url' => :'String',
|
42
39
|
:'id' => :'Integer',
|
43
|
-
:'name' => :'String'
|
44
|
-
:'avatar_url' => :'String'
|
40
|
+
:'name' => :'String'
|
45
41
|
}
|
46
42
|
end
|
47
43
|
|
44
|
+
# List of attributes with nullable: true
|
45
|
+
def self.openapi_nullable
|
46
|
+
Set.new([
|
47
|
+
])
|
48
|
+
end
|
49
|
+
|
48
50
|
# Initializes the object
|
49
51
|
# @param [Hash] attributes Model attributes in the form of hash
|
50
52
|
def initialize(attributes = {})
|
51
|
-
|
53
|
+
if (!attributes.is_a?(Hash))
|
54
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::Author` initialize method"
|
55
|
+
end
|
52
56
|
|
53
|
-
# convert string to symbol for hash key
|
54
|
-
attributes = attributes.each_with_object({}){|(k,v), h|
|
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::Author`. 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
|
+
}
|
55
64
|
|
56
|
-
if attributes.
|
57
|
-
self.
|
65
|
+
if attributes.key?(:'avatar_url')
|
66
|
+
self.avatar_url = attributes[:'avatar_url']
|
58
67
|
end
|
59
68
|
|
60
|
-
if attributes.
|
61
|
-
self.
|
69
|
+
if attributes.key?(:'id')
|
70
|
+
self.id = attributes[:'id']
|
62
71
|
end
|
63
72
|
|
64
|
-
if attributes.
|
65
|
-
self.
|
73
|
+
if attributes.key?(:'name')
|
74
|
+
self.name = attributes[:'name']
|
66
75
|
end
|
67
|
-
|
68
76
|
end
|
69
77
|
|
70
78
|
# Show invalid properties with the reasons. Usually used together with valid?
|
71
|
-
# @return Array for valid
|
79
|
+
# @return Array for valid properties with the reasons
|
72
80
|
def list_invalid_properties
|
73
81
|
invalid_properties = Array.new
|
74
|
-
|
82
|
+
invalid_properties
|
75
83
|
end
|
76
84
|
|
77
85
|
# Check to see if the all the properties in the model are valid
|
78
86
|
# @return true if the model is valid
|
79
87
|
def valid?
|
80
|
-
|
88
|
+
true
|
81
89
|
end
|
82
90
|
|
83
91
|
# Checks equality by comparing each attribute.
|
@@ -85,9 +93,9 @@ module AylienNewsApi
|
|
85
93
|
def ==(o)
|
86
94
|
return true if self.equal?(o)
|
87
95
|
self.class == o.class &&
|
96
|
+
avatar_url == o.avatar_url &&
|
88
97
|
id == o.id &&
|
89
|
-
name == o.name
|
90
|
-
avatar_url == o.avatar_url
|
98
|
+
name == o.name
|
91
99
|
end
|
92
100
|
|
93
101
|
# @see the `==` method
|
@@ -97,9 +105,16 @@ module AylienNewsApi
|
|
97
105
|
end
|
98
106
|
|
99
107
|
# Calculates hash code according to all attributes.
|
100
|
-
# @return [
|
108
|
+
# @return [Integer] Hash code
|
101
109
|
def hash
|
102
|
-
[id, name
|
110
|
+
[avatar_url, id, name].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)
|
103
118
|
end
|
104
119
|
|
105
120
|
# Builds the object from hash
|
@@ -107,12 +122,12 @@ module AylienNewsApi
|
|
107
122
|
# @return [Object] Returns the model itself
|
108
123
|
def build_from_hash(attributes)
|
109
124
|
return nil unless attributes.is_a?(Hash)
|
110
|
-
self.class.
|
111
|
-
if type =~
|
112
|
-
# check to ensure the input is an array given that the
|
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
|
113
128
|
# is documented as an array but the input is not
|
114
129
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
115
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) }
|
130
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
116
131
|
end
|
117
132
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
118
133
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
@@ -138,8 +153,8 @@ module AylienNewsApi
|
|
138
153
|
value.to_i
|
139
154
|
when :Float
|
140
155
|
value.to_f
|
141
|
-
when :
|
142
|
-
if value.to_s =~
|
156
|
+
when :Boolean
|
157
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
143
158
|
true
|
144
159
|
else
|
145
160
|
false
|
@@ -150,7 +165,7 @@ module AylienNewsApi
|
|
150
165
|
when /\AArray<(?<inner_type>.+)>\z/
|
151
166
|
inner_type = Regexp.last_match[:inner_type]
|
152
167
|
value.map { |v| _deserialize(inner_type, v) }
|
153
|
-
when /\AHash<(?<k_type
|
168
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
154
169
|
k_type = Regexp.last_match[:k_type]
|
155
170
|
v_type = Regexp.last_match[:v_type]
|
156
171
|
{}.tap do |hash|
|
@@ -159,8 +174,7 @@ module AylienNewsApi
|
|
159
174
|
end
|
160
175
|
end
|
161
176
|
else # model
|
162
|
-
|
163
|
-
temp_model.build_from_hash(value)
|
177
|
+
AylienNewsApi.const_get(type).build_from_hash(value)
|
164
178
|
end
|
165
179
|
end
|
166
180
|
|
@@ -182,7 +196,11 @@ module AylienNewsApi
|
|
182
196
|
hash = {}
|
183
197
|
self.class.attribute_map.each_pair do |attr, param|
|
184
198
|
value = self.send(attr)
|
185
|
-
|
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
|
+
|
186
204
|
hash[param] = _to_hash(value)
|
187
205
|
end
|
188
206
|
hash
|
@@ -194,7 +212,7 @@ module AylienNewsApi
|
|
194
212
|
# @return [Hash] Returns the value in the form of hash
|
195
213
|
def _to_hash(value)
|
196
214
|
if value.is_a?(Array)
|
197
|
-
value.compact.map{ |v| _to_hash(v) }
|
215
|
+
value.compact.map { |v| _to_hash(v) }
|
198
216
|
elsif value.is_a?(Hash)
|
199
217
|
{}.tap do |hash|
|
200
218
|
value.each { |k, v| hash[k] = _to_hash(v) }
|
@@ -205,7 +223,5 @@ module AylienNewsApi
|
|
205
223
|
value
|
206
224
|
end
|
207
225
|
end
|
208
|
-
|
209
226
|
end
|
210
|
-
|
211
227
|
end
|
@@ -1,21 +1,18 @@
|
|
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 Autocomplete
|
20
17
|
# ID of the autocomplete
|
21
18
|
attr_accessor :id
|
@@ -23,7 +20,6 @@ module AylienNewsApi
|
|
23
20
|
# Text of the autocomplete
|
24
21
|
attr_accessor :text
|
25
22
|
|
26
|
-
|
27
23
|
# Attribute mapping from ruby-style variable name to JSON key.
|
28
24
|
def self.attribute_map
|
29
25
|
{
|
@@ -33,42 +29,54 @@ module AylienNewsApi
|
|
33
29
|
end
|
34
30
|
|
35
31
|
# Attribute type mapping.
|
36
|
-
def self.
|
32
|
+
def self.openapi_types
|
37
33
|
{
|
38
34
|
:'id' => :'String',
|
39
35
|
:'text' => :'String'
|
40
36
|
}
|
41
37
|
end
|
42
38
|
|
39
|
+
# List of attributes with nullable: true
|
40
|
+
def self.openapi_nullable
|
41
|
+
Set.new([
|
42
|
+
])
|
43
|
+
end
|
44
|
+
|
43
45
|
# Initializes the object
|
44
46
|
# @param [Hash] attributes Model attributes in the form of hash
|
45
47
|
def initialize(attributes = {})
|
46
|
-
|
48
|
+
if (!attributes.is_a?(Hash))
|
49
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::Autocomplete` initialize method"
|
50
|
+
end
|
47
51
|
|
48
|
-
# convert string to symbol for hash key
|
49
|
-
attributes = attributes.each_with_object({}){|(k,v), h|
|
52
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
53
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
54
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
55
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `AylienNewsApi::Autocomplete`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
56
|
+
end
|
57
|
+
h[k.to_sym] = v
|
58
|
+
}
|
50
59
|
|
51
|
-
if attributes.
|
60
|
+
if attributes.key?(:'id')
|
52
61
|
self.id = attributes[:'id']
|
53
62
|
end
|
54
63
|
|
55
|
-
if attributes.
|
64
|
+
if attributes.key?(:'text')
|
56
65
|
self.text = attributes[:'text']
|
57
66
|
end
|
58
|
-
|
59
67
|
end
|
60
68
|
|
61
69
|
# Show invalid properties with the reasons. Usually used together with valid?
|
62
|
-
# @return Array for valid
|
70
|
+
# @return Array for valid properties with the reasons
|
63
71
|
def list_invalid_properties
|
64
72
|
invalid_properties = Array.new
|
65
|
-
|
73
|
+
invalid_properties
|
66
74
|
end
|
67
75
|
|
68
76
|
# Check to see if the all the properties in the model are valid
|
69
77
|
# @return true if the model is valid
|
70
78
|
def valid?
|
71
|
-
|
79
|
+
true
|
72
80
|
end
|
73
81
|
|
74
82
|
# Checks equality by comparing each attribute.
|
@@ -87,22 +95,29 @@ module AylienNewsApi
|
|
87
95
|
end
|
88
96
|
|
89
97
|
# Calculates hash code according to all attributes.
|
90
|
-
# @return [
|
98
|
+
# @return [Integer] Hash code
|
91
99
|
def hash
|
92
100
|
[id, text].hash
|
93
101
|
end
|
94
102
|
|
103
|
+
# Builds the object from hash
|
104
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
105
|
+
# @return [Object] Returns the model itself
|
106
|
+
def self.build_from_hash(attributes)
|
107
|
+
new.build_from_hash(attributes)
|
108
|
+
end
|
109
|
+
|
95
110
|
# Builds the object from hash
|
96
111
|
# @param [Hash] attributes Model attributes in the form of hash
|
97
112
|
# @return [Object] Returns the model itself
|
98
113
|
def build_from_hash(attributes)
|
99
114
|
return nil unless attributes.is_a?(Hash)
|
100
|
-
self.class.
|
101
|
-
if type =~
|
102
|
-
# check to ensure the input is an array given that the
|
115
|
+
self.class.openapi_types.each_pair do |key, type|
|
116
|
+
if type =~ /\AArray<(.*)>/i
|
117
|
+
# check to ensure the input is an array given that the attribute
|
103
118
|
# is documented as an array but the input is not
|
104
119
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
105
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) }
|
120
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
106
121
|
end
|
107
122
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
108
123
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
@@ -128,8 +143,8 @@ module AylienNewsApi
|
|
128
143
|
value.to_i
|
129
144
|
when :Float
|
130
145
|
value.to_f
|
131
|
-
when :
|
132
|
-
if value.to_s =~
|
146
|
+
when :Boolean
|
147
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
133
148
|
true
|
134
149
|
else
|
135
150
|
false
|
@@ -140,7 +155,7 @@ module AylienNewsApi
|
|
140
155
|
when /\AArray<(?<inner_type>.+)>\z/
|
141
156
|
inner_type = Regexp.last_match[:inner_type]
|
142
157
|
value.map { |v| _deserialize(inner_type, v) }
|
143
|
-
when /\AHash<(?<k_type
|
158
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
144
159
|
k_type = Regexp.last_match[:k_type]
|
145
160
|
v_type = Regexp.last_match[:v_type]
|
146
161
|
{}.tap do |hash|
|
@@ -149,8 +164,7 @@ module AylienNewsApi
|
|
149
164
|
end
|
150
165
|
end
|
151
166
|
else # model
|
152
|
-
|
153
|
-
temp_model.build_from_hash(value)
|
167
|
+
AylienNewsApi.const_get(type).build_from_hash(value)
|
154
168
|
end
|
155
169
|
end
|
156
170
|
|
@@ -172,7 +186,11 @@ module AylienNewsApi
|
|
172
186
|
hash = {}
|
173
187
|
self.class.attribute_map.each_pair do |attr, param|
|
174
188
|
value = self.send(attr)
|
175
|
-
|
189
|
+
if value.nil?
|
190
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
191
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
192
|
+
end
|
193
|
+
|
176
194
|
hash[param] = _to_hash(value)
|
177
195
|
end
|
178
196
|
hash
|
@@ -184,7 +202,7 @@ module AylienNewsApi
|
|
184
202
|
# @return [Hash] Returns the value in the form of hash
|
185
203
|
def _to_hash(value)
|
186
204
|
if value.is_a?(Array)
|
187
|
-
value.compact.map{ |v| _to_hash(v) }
|
205
|
+
value.compact.map { |v| _to_hash(v) }
|
188
206
|
elsif value.is_a?(Hash)
|
189
207
|
{}.tap do |hash|
|
190
208
|
value.each { |k, v| hash[k] = _to_hash(v) }
|
@@ -195,7 +213,5 @@ module AylienNewsApi
|
|
195
213
|
value
|
196
214
|
end
|
197
215
|
end
|
198
|
-
|
199
216
|
end
|
200
|
-
|
201
217
|
end
|