aylien_news_api 0.4.0 → 4.1.1
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 +20 -28
- 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 +1299 -826
- 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 +18 -4
- 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 +2407 -1520
- data/lib/aylien_news_api/api_client.rb +137 -111
- data/lib/aylien_news_api/api_error.rb +37 -18
- data/lib/aylien_news_api/configuration.rb +74 -36
- data/lib/aylien_news_api/models/author.rb +66 -50
- data/lib/aylien_news_api/models/autocomplete.rb +52 -36
- data/lib/aylien_news_api/models/autocompletes.rb +51 -35
- data/lib/aylien_news_api/models/category.rb +85 -94
- data/lib/aylien_news_api/models/category_links.rb +63 -47
- 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 +76 -72
- data/lib/aylien_news_api/models/entities.rb +64 -48
- data/lib/aylien_news_api/models/entity.rb +93 -79
- data/lib/aylien_news_api/models/entity_links.rb +51 -35
- data/lib/aylien_news_api/models/error.rb +76 -60
- data/lib/aylien_news_api/models/error_links.rb +62 -37
- data/lib/aylien_news_api/models/errors.rb +51 -35
- data/lib/aylien_news_api/models/histogram_interval.rb +52 -36
- data/lib/aylien_news_api/models/histograms.rb +96 -60
- data/lib/aylien_news_api/models/location.rb +67 -51
- data/lib/aylien_news_api/models/media.rb +83 -114
- 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 +64 -48
- data/lib/aylien_news_api/models/rankings.rb +51 -35
- data/lib/aylien_news_api/models/related_stories.rb +84 -60
- data/lib/aylien_news_api/models/representative_story.rb +237 -0
- data/lib/aylien_news_api/models/scope.rb +73 -91
- data/lib/aylien_news_api/models/scope_level.rb +37 -0
- data/lib/aylien_news_api/models/sentiment.rb +63 -82
- data/lib/aylien_news_api/models/sentiment_polarity.rb +37 -0
- data/lib/aylien_news_api/models/sentiments.rb +62 -48
- data/lib/aylien_news_api/models/share_count.rb +52 -36
- data/lib/aylien_news_api/models/share_counts.rb +54 -38
- data/lib/aylien_news_api/models/source.rb +111 -96
- data/lib/aylien_news_api/models/stories.rb +86 -50
- data/lib/aylien_news_api/models/story.rb +188 -158
- data/lib/aylien_news_api/models/story_cluster.rb +68 -52
- data/lib/aylien_news_api/models/story_links.rb +70 -44
- 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 +51 -35
- data/lib/aylien_news_api/models/time_series.rb +63 -47
- data/lib/aylien_news_api/models/time_series_list.rb +72 -56
- data/lib/aylien_news_api/models/trend.rb +63 -47
- data/lib/aylien_news_api/models/trends.rb +77 -41
- 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 +91 -192
- data/Gemfile.lock +0 -65
- data/LICENSE +0 -13
- data/aylien_news_api-0.2.0.gem +0 -0
- data/aylien_news_api-0.3.0.gem +0 -0
@@ -1,74 +1,82 @@
|
|
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 Trend
|
20
|
-
# The value of the trend
|
21
|
-
attr_accessor :value
|
22
|
-
|
23
17
|
# The count of the trend
|
24
18
|
attr_accessor :count
|
25
19
|
|
20
|
+
# The value of the trend
|
21
|
+
attr_accessor :value
|
26
22
|
|
27
23
|
# Attribute mapping from ruby-style variable name to JSON key.
|
28
24
|
def self.attribute_map
|
29
25
|
{
|
30
|
-
:'
|
31
|
-
:'
|
26
|
+
:'count' => :'count',
|
27
|
+
:'value' => :'value'
|
32
28
|
}
|
33
29
|
end
|
34
30
|
|
35
31
|
# Attribute type mapping.
|
36
|
-
def self.
|
32
|
+
def self.openapi_types
|
37
33
|
{
|
38
|
-
:'
|
39
|
-
:'
|
34
|
+
:'count' => :'Integer',
|
35
|
+
:'value' => :'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
|
-
|
47
|
-
|
48
|
-
# convert string to symbol for hash key
|
49
|
-
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
50
|
-
|
51
|
-
if attributes.has_key?(:'value')
|
52
|
-
self.value = attributes[:'value']
|
48
|
+
if (!attributes.is_a?(Hash))
|
49
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::Trend` initialize method"
|
53
50
|
end
|
54
51
|
|
55
|
-
if
|
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::Trend`. 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
|
+
}
|
59
|
+
|
60
|
+
if attributes.key?(:'count')
|
56
61
|
self.count = attributes[:'count']
|
57
62
|
end
|
58
63
|
|
64
|
+
if attributes.key?(:'value')
|
65
|
+
self.value = attributes[:'value']
|
66
|
+
end
|
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.
|
@@ -76,8 +84,8 @@ module AylienNewsApi
|
|
76
84
|
def ==(o)
|
77
85
|
return true if self.equal?(o)
|
78
86
|
self.class == o.class &&
|
79
|
-
|
80
|
-
|
87
|
+
count == o.count &&
|
88
|
+
value == o.value
|
81
89
|
end
|
82
90
|
|
83
91
|
# @see the `==` method
|
@@ -87,9 +95,16 @@ 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
|
+
[count, value].hash
|
101
|
+
end
|
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)
|
93
108
|
end
|
94
109
|
|
95
110
|
# Builds the object from hash
|
@@ -97,12 +112,12 @@ module AylienNewsApi
|
|
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.
|
115
|
+
self.class.openapi_types.each_pair do |key, type|
|
101
116
|
if type =~ /\AArray<(.*)>/i
|
102
|
-
# check to ensure the input is an array given that the
|
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,7 +143,7 @@ module AylienNewsApi
|
|
128
143
|
value.to_i
|
129
144
|
when :Float
|
130
145
|
value.to_f
|
131
|
-
when :
|
146
|
+
when :Boolean
|
132
147
|
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
133
148
|
true
|
134
149
|
else
|
@@ -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
|
@@ -1,76 +1,102 @@
|
|
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 Trends
|
17
|
+
# The field of trends
|
18
|
+
attr_accessor :field
|
19
|
+
|
20
20
|
# An array of trends
|
21
21
|
attr_accessor :trends
|
22
22
|
|
23
|
-
# The
|
24
|
-
attr_accessor :
|
23
|
+
# The end of a period in which searched stories were published
|
24
|
+
attr_accessor :published_at_end
|
25
25
|
|
26
|
+
# The start of a period in which searched stories were published
|
27
|
+
attr_accessor :published_at_start
|
26
28
|
|
27
29
|
# Attribute mapping from ruby-style variable name to JSON key.
|
28
30
|
def self.attribute_map
|
29
31
|
{
|
32
|
+
:'field' => :'field',
|
30
33
|
:'trends' => :'trends',
|
31
|
-
:'
|
34
|
+
:'published_at_end' => :'published_at.end',
|
35
|
+
:'published_at_start' => :'published_at.start'
|
32
36
|
}
|
33
37
|
end
|
34
38
|
|
35
39
|
# Attribute type mapping.
|
36
|
-
def self.
|
40
|
+
def self.openapi_types
|
37
41
|
{
|
42
|
+
:'field' => :'String',
|
38
43
|
:'trends' => :'Array<Trend>',
|
39
|
-
:'
|
44
|
+
:'published_at_end' => :'DateTime',
|
45
|
+
:'published_at_start' => :'DateTime'
|
40
46
|
}
|
41
47
|
end
|
42
48
|
|
49
|
+
# List of attributes with nullable: true
|
50
|
+
def self.openapi_nullable
|
51
|
+
Set.new([
|
52
|
+
])
|
53
|
+
end
|
54
|
+
|
43
55
|
# Initializes the object
|
44
56
|
# @param [Hash] attributes Model attributes in the form of hash
|
45
57
|
def initialize(attributes = {})
|
46
|
-
|
58
|
+
if (!attributes.is_a?(Hash))
|
59
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::Trends` initialize method"
|
60
|
+
end
|
47
61
|
|
48
|
-
# convert string to symbol for hash key
|
49
|
-
attributes = attributes.each_with_object({}){|(k,v), h|
|
62
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
63
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
64
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
65
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `AylienNewsApi::Trends`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
66
|
+
end
|
67
|
+
h[k.to_sym] = v
|
68
|
+
}
|
50
69
|
|
51
|
-
if attributes.
|
70
|
+
if attributes.key?(:'field')
|
71
|
+
self.field = attributes[:'field']
|
72
|
+
end
|
73
|
+
|
74
|
+
if attributes.key?(:'trends')
|
52
75
|
if (value = attributes[:'trends']).is_a?(Array)
|
53
76
|
self.trends = value
|
54
77
|
end
|
55
78
|
end
|
56
79
|
|
57
|
-
if attributes.
|
58
|
-
self.
|
80
|
+
if attributes.key?(:'published_at_end')
|
81
|
+
self.published_at_end = attributes[:'published_at_end']
|
59
82
|
end
|
60
83
|
|
84
|
+
if attributes.key?(:'published_at_start')
|
85
|
+
self.published_at_start = attributes[:'published_at_start']
|
86
|
+
end
|
61
87
|
end
|
62
88
|
|
63
89
|
# Show invalid properties with the reasons. Usually used together with valid?
|
64
|
-
# @return Array for valid
|
90
|
+
# @return Array for valid properties with the reasons
|
65
91
|
def list_invalid_properties
|
66
92
|
invalid_properties = Array.new
|
67
|
-
|
93
|
+
invalid_properties
|
68
94
|
end
|
69
95
|
|
70
96
|
# Check to see if the all the properties in the model are valid
|
71
97
|
# @return true if the model is valid
|
72
98
|
def valid?
|
73
|
-
|
99
|
+
true
|
74
100
|
end
|
75
101
|
|
76
102
|
# Checks equality by comparing each attribute.
|
@@ -78,8 +104,10 @@ module AylienNewsApi
|
|
78
104
|
def ==(o)
|
79
105
|
return true if self.equal?(o)
|
80
106
|
self.class == o.class &&
|
107
|
+
field == o.field &&
|
81
108
|
trends == o.trends &&
|
82
|
-
|
109
|
+
published_at_end == o.published_at_end &&
|
110
|
+
published_at_start == o.published_at_start
|
83
111
|
end
|
84
112
|
|
85
113
|
# @see the `==` method
|
@@ -89,9 +117,16 @@ module AylienNewsApi
|
|
89
117
|
end
|
90
118
|
|
91
119
|
# Calculates hash code according to all attributes.
|
92
|
-
# @return [
|
120
|
+
# @return [Integer] Hash code
|
93
121
|
def hash
|
94
|
-
[trends,
|
122
|
+
[field, trends, published_at_end, published_at_start].hash
|
123
|
+
end
|
124
|
+
|
125
|
+
# Builds the object from hash
|
126
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
127
|
+
# @return [Object] Returns the model itself
|
128
|
+
def self.build_from_hash(attributes)
|
129
|
+
new.build_from_hash(attributes)
|
95
130
|
end
|
96
131
|
|
97
132
|
# Builds the object from hash
|
@@ -99,12 +134,12 @@ module AylienNewsApi
|
|
99
134
|
# @return [Object] Returns the model itself
|
100
135
|
def build_from_hash(attributes)
|
101
136
|
return nil unless attributes.is_a?(Hash)
|
102
|
-
self.class.
|
137
|
+
self.class.openapi_types.each_pair do |key, type|
|
103
138
|
if type =~ /\AArray<(.*)>/i
|
104
|
-
# check to ensure the input is an array given that the
|
139
|
+
# check to ensure the input is an array given that the attribute
|
105
140
|
# is documented as an array but the input is not
|
106
141
|
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) }
|
142
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
108
143
|
end
|
109
144
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
110
145
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
@@ -130,7 +165,7 @@ module AylienNewsApi
|
|
130
165
|
value.to_i
|
131
166
|
when :Float
|
132
167
|
value.to_f
|
133
|
-
when :
|
168
|
+
when :Boolean
|
134
169
|
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
135
170
|
true
|
136
171
|
else
|
@@ -151,8 +186,7 @@ module AylienNewsApi
|
|
151
186
|
end
|
152
187
|
end
|
153
188
|
else # model
|
154
|
-
|
155
|
-
temp_model.build_from_hash(value)
|
189
|
+
AylienNewsApi.const_get(type).build_from_hash(value)
|
156
190
|
end
|
157
191
|
end
|
158
192
|
|
@@ -174,7 +208,11 @@ module AylienNewsApi
|
|
174
208
|
hash = {}
|
175
209
|
self.class.attribute_map.each_pair do |attr, param|
|
176
210
|
value = self.send(attr)
|
177
|
-
|
211
|
+
if value.nil?
|
212
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
213
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
214
|
+
end
|
215
|
+
|
178
216
|
hash[param] = _to_hash(value)
|
179
217
|
end
|
180
218
|
hash
|
@@ -186,7 +224,7 @@ module AylienNewsApi
|
|
186
224
|
# @return [Hash] Returns the value in the form of hash
|
187
225
|
def _to_hash(value)
|
188
226
|
if value.is_a?(Array)
|
189
|
-
value.compact.map{ |v| _to_hash(v) }
|
227
|
+
value.compact.map { |v| _to_hash(v) }
|
190
228
|
elsif value.is_a?(Hash)
|
191
229
|
{}.tap do |hash|
|
192
230
|
value.each { |k, v| hash[k] = _to_hash(v) }
|
@@ -197,7 +235,5 @@ module AylienNewsApi
|
|
197
235
|
value
|
198
236
|
end
|
199
237
|
end
|
200
|
-
|
201
238
|
end
|
202
|
-
|
203
239
|
end
|
@@ -0,0 +1,226 @@
|
|
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 Warning
|
17
|
+
# The identfier of the warning, represents its origin.
|
18
|
+
attr_accessor :id
|
19
|
+
|
20
|
+
attr_accessor :links
|
21
|
+
|
22
|
+
# The detailed description of the warning.
|
23
|
+
attr_accessor :detail
|
24
|
+
|
25
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
26
|
+
def self.attribute_map
|
27
|
+
{
|
28
|
+
:'id' => :'id',
|
29
|
+
:'links' => :'links',
|
30
|
+
:'detail' => :'detail'
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
# Attribute type mapping.
|
35
|
+
def self.openapi_types
|
36
|
+
{
|
37
|
+
:'id' => :'String',
|
38
|
+
:'links' => :'ErrorLinks',
|
39
|
+
:'detail' => :'String'
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
# List of attributes with nullable: true
|
44
|
+
def self.openapi_nullable
|
45
|
+
Set.new([
|
46
|
+
])
|
47
|
+
end
|
48
|
+
|
49
|
+
# Initializes the object
|
50
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
51
|
+
def initialize(attributes = {})
|
52
|
+
if (!attributes.is_a?(Hash))
|
53
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::Warning` initialize method"
|
54
|
+
end
|
55
|
+
|
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::Warning`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
60
|
+
end
|
61
|
+
h[k.to_sym] = v
|
62
|
+
}
|
63
|
+
|
64
|
+
if attributes.key?(:'id')
|
65
|
+
self.id = attributes[:'id']
|
66
|
+
end
|
67
|
+
|
68
|
+
if attributes.key?(:'links')
|
69
|
+
self.links = attributes[:'links']
|
70
|
+
end
|
71
|
+
|
72
|
+
if attributes.key?(:'detail')
|
73
|
+
self.detail = attributes[:'detail']
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
78
|
+
# @return Array for valid properties with the reasons
|
79
|
+
def list_invalid_properties
|
80
|
+
invalid_properties = Array.new
|
81
|
+
invalid_properties
|
82
|
+
end
|
83
|
+
|
84
|
+
# Check to see if the all the properties in the model are valid
|
85
|
+
# @return true if the model is valid
|
86
|
+
def valid?
|
87
|
+
true
|
88
|
+
end
|
89
|
+
|
90
|
+
# Checks equality by comparing each attribute.
|
91
|
+
# @param [Object] Object to be compared
|
92
|
+
def ==(o)
|
93
|
+
return true if self.equal?(o)
|
94
|
+
self.class == o.class &&
|
95
|
+
id == o.id &&
|
96
|
+
links == o.links &&
|
97
|
+
detail == o.detail
|
98
|
+
end
|
99
|
+
|
100
|
+
# @see the `==` method
|
101
|
+
# @param [Object] Object to be compared
|
102
|
+
def eql?(o)
|
103
|
+
self == o
|
104
|
+
end
|
105
|
+
|
106
|
+
# Calculates hash code according to all attributes.
|
107
|
+
# @return [Integer] Hash code
|
108
|
+
def hash
|
109
|
+
[id, links, detail].hash
|
110
|
+
end
|
111
|
+
|
112
|
+
# Builds the object from hash
|
113
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
114
|
+
# @return [Object] Returns the model itself
|
115
|
+
def self.build_from_hash(attributes)
|
116
|
+
new.build_from_hash(attributes)
|
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 build_from_hash(attributes)
|
123
|
+
return nil unless attributes.is_a?(Hash)
|
124
|
+
self.class.openapi_types.each_pair do |key, type|
|
125
|
+
if type =~ /\AArray<(.*)>/i
|
126
|
+
# check to ensure the input is an array given that the attribute
|
127
|
+
# is documented as an array but the input is not
|
128
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
129
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
130
|
+
end
|
131
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
132
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
133
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
134
|
+
end
|
135
|
+
|
136
|
+
self
|
137
|
+
end
|
138
|
+
|
139
|
+
# Deserializes the data based on type
|
140
|
+
# @param string type Data type
|
141
|
+
# @param string value Value to be deserialized
|
142
|
+
# @return [Object] Deserialized data
|
143
|
+
def _deserialize(type, value)
|
144
|
+
case type.to_sym
|
145
|
+
when :DateTime
|
146
|
+
DateTime.parse(value)
|
147
|
+
when :Date
|
148
|
+
Date.parse(value)
|
149
|
+
when :String
|
150
|
+
value.to_s
|
151
|
+
when :Integer
|
152
|
+
value.to_i
|
153
|
+
when :Float
|
154
|
+
value.to_f
|
155
|
+
when :Boolean
|
156
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
157
|
+
true
|
158
|
+
else
|
159
|
+
false
|
160
|
+
end
|
161
|
+
when :Object
|
162
|
+
# generic object (usually a Hash), return directly
|
163
|
+
value
|
164
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
165
|
+
inner_type = Regexp.last_match[:inner_type]
|
166
|
+
value.map { |v| _deserialize(inner_type, v) }
|
167
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
168
|
+
k_type = Regexp.last_match[:k_type]
|
169
|
+
v_type = Regexp.last_match[:v_type]
|
170
|
+
{}.tap do |hash|
|
171
|
+
value.each do |k, v|
|
172
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
173
|
+
end
|
174
|
+
end
|
175
|
+
else # model
|
176
|
+
AylienNewsApi.const_get(type).build_from_hash(value)
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
# Returns the string representation of the object
|
181
|
+
# @return [String] String presentation of the object
|
182
|
+
def to_s
|
183
|
+
to_hash.to_s
|
184
|
+
end
|
185
|
+
|
186
|
+
# to_body is an alias to to_hash (backward compatibility)
|
187
|
+
# @return [Hash] Returns the object in the form of hash
|
188
|
+
def to_body
|
189
|
+
to_hash
|
190
|
+
end
|
191
|
+
|
192
|
+
# Returns the object in the form of hash
|
193
|
+
# @return [Hash] Returns the object in the form of hash
|
194
|
+
def to_hash
|
195
|
+
hash = {}
|
196
|
+
self.class.attribute_map.each_pair do |attr, param|
|
197
|
+
value = self.send(attr)
|
198
|
+
if value.nil?
|
199
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
200
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
201
|
+
end
|
202
|
+
|
203
|
+
hash[param] = _to_hash(value)
|
204
|
+
end
|
205
|
+
hash
|
206
|
+
end
|
207
|
+
|
208
|
+
# Outputs non-array value in the form of hash
|
209
|
+
# For object, use to_hash. Otherwise, just return the value
|
210
|
+
# @param [Object] value Any valid value
|
211
|
+
# @return [Hash] Returns the value in the form of hash
|
212
|
+
def _to_hash(value)
|
213
|
+
if value.is_a?(Array)
|
214
|
+
value.compact.map { |v| _to_hash(v) }
|
215
|
+
elsif value.is_a?(Hash)
|
216
|
+
{}.tap do |hash|
|
217
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
218
|
+
end
|
219
|
+
elsif value.respond_to? :to_hash
|
220
|
+
value.to_hash
|
221
|
+
else
|
222
|
+
value
|
223
|
+
end
|
224
|
+
end
|
225
|
+
end
|
226
|
+
end
|