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,26 +1,22 @@
|
|
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 Autocompletes
|
20
17
|
# An array of autocompletes
|
21
18
|
attr_accessor :autocompletes
|
22
19
|
|
23
|
-
|
24
20
|
# Attribute mapping from ruby-style variable name to JSON key.
|
25
21
|
def self.attribute_map
|
26
22
|
{
|
@@ -29,39 +25,51 @@ module AylienNewsApi
|
|
29
25
|
end
|
30
26
|
|
31
27
|
# Attribute type mapping.
|
32
|
-
def self.
|
28
|
+
def self.openapi_types
|
33
29
|
{
|
34
30
|
:'autocompletes' => :'Array<Autocomplete>'
|
35
31
|
}
|
36
32
|
end
|
37
33
|
|
34
|
+
# List of attributes with nullable: true
|
35
|
+
def self.openapi_nullable
|
36
|
+
Set.new([
|
37
|
+
])
|
38
|
+
end
|
39
|
+
|
38
40
|
# Initializes the object
|
39
41
|
# @param [Hash] attributes Model attributes in the form of hash
|
40
42
|
def initialize(attributes = {})
|
41
|
-
|
43
|
+
if (!attributes.is_a?(Hash))
|
44
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::Autocompletes` initialize method"
|
45
|
+
end
|
42
46
|
|
43
|
-
# convert string to symbol for hash key
|
44
|
-
attributes = attributes.each_with_object({}){|(k,v), h|
|
47
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
48
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
49
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
50
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `AylienNewsApi::Autocompletes`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
51
|
+
end
|
52
|
+
h[k.to_sym] = v
|
53
|
+
}
|
45
54
|
|
46
|
-
if attributes.
|
55
|
+
if attributes.key?(:'autocompletes')
|
47
56
|
if (value = attributes[:'autocompletes']).is_a?(Array)
|
48
57
|
self.autocompletes = value
|
49
58
|
end
|
50
59
|
end
|
51
|
-
|
52
60
|
end
|
53
61
|
|
54
62
|
# Show invalid properties with the reasons. Usually used together with valid?
|
55
|
-
# @return Array for valid
|
63
|
+
# @return Array for valid properties with the reasons
|
56
64
|
def list_invalid_properties
|
57
65
|
invalid_properties = Array.new
|
58
|
-
|
66
|
+
invalid_properties
|
59
67
|
end
|
60
68
|
|
61
69
|
# Check to see if the all the properties in the model are valid
|
62
70
|
# @return true if the model is valid
|
63
71
|
def valid?
|
64
|
-
|
72
|
+
true
|
65
73
|
end
|
66
74
|
|
67
75
|
# Checks equality by comparing each attribute.
|
@@ -79,22 +87,29 @@ module AylienNewsApi
|
|
79
87
|
end
|
80
88
|
|
81
89
|
# Calculates hash code according to all attributes.
|
82
|
-
# @return [
|
90
|
+
# @return [Integer] Hash code
|
83
91
|
def hash
|
84
92
|
[autocompletes].hash
|
85
93
|
end
|
86
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)
|
100
|
+
end
|
101
|
+
|
87
102
|
# Builds the object from hash
|
88
103
|
# @param [Hash] attributes Model attributes in the form of hash
|
89
104
|
# @return [Object] Returns the model itself
|
90
105
|
def build_from_hash(attributes)
|
91
106
|
return nil unless attributes.is_a?(Hash)
|
92
|
-
self.class.
|
93
|
-
if type =~
|
94
|
-
# check to ensure the input is an array given that the
|
107
|
+
self.class.openapi_types.each_pair do |key, type|
|
108
|
+
if type =~ /\AArray<(.*)>/i
|
109
|
+
# check to ensure the input is an array given that the attribute
|
95
110
|
# is documented as an array but the input is not
|
96
111
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
97
|
-
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) })
|
98
113
|
end
|
99
114
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
100
115
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
@@ -120,8 +135,8 @@ module AylienNewsApi
|
|
120
135
|
value.to_i
|
121
136
|
when :Float
|
122
137
|
value.to_f
|
123
|
-
when :
|
124
|
-
if value.to_s =~
|
138
|
+
when :Boolean
|
139
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
125
140
|
true
|
126
141
|
else
|
127
142
|
false
|
@@ -132,7 +147,7 @@ module AylienNewsApi
|
|
132
147
|
when /\AArray<(?<inner_type>.+)>\z/
|
133
148
|
inner_type = Regexp.last_match[:inner_type]
|
134
149
|
value.map { |v| _deserialize(inner_type, v) }
|
135
|
-
when /\AHash<(?<k_type
|
150
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
136
151
|
k_type = Regexp.last_match[:k_type]
|
137
152
|
v_type = Regexp.last_match[:v_type]
|
138
153
|
{}.tap do |hash|
|
@@ -141,8 +156,7 @@ module AylienNewsApi
|
|
141
156
|
end
|
142
157
|
end
|
143
158
|
else # model
|
144
|
-
|
145
|
-
temp_model.build_from_hash(value)
|
159
|
+
AylienNewsApi.const_get(type).build_from_hash(value)
|
146
160
|
end
|
147
161
|
end
|
148
162
|
|
@@ -164,7 +178,11 @@ module AylienNewsApi
|
|
164
178
|
hash = {}
|
165
179
|
self.class.attribute_map.each_pair do |attr, param|
|
166
180
|
value = self.send(attr)
|
167
|
-
|
181
|
+
if value.nil?
|
182
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
183
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
184
|
+
end
|
185
|
+
|
168
186
|
hash[param] = _to_hash(value)
|
169
187
|
end
|
170
188
|
hash
|
@@ -176,7 +194,7 @@ module AylienNewsApi
|
|
176
194
|
# @return [Hash] Returns the value in the form of hash
|
177
195
|
def _to_hash(value)
|
178
196
|
if value.is_a?(Array)
|
179
|
-
value.compact.map{ |v| _to_hash(v) }
|
197
|
+
value.compact.map { |v| _to_hash(v) }
|
180
198
|
elsif value.is_a?(Hash)
|
181
199
|
{}.tap do |hash|
|
182
200
|
value.each { |k, v| hash[k] = _to_hash(v) }
|
@@ -187,7 +205,5 @@ module AylienNewsApi
|
|
187
205
|
value
|
188
206
|
end
|
189
207
|
end
|
190
|
-
|
191
208
|
end
|
192
|
-
|
193
209
|
end
|
@@ -1,143 +1,125 @@
|
|
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 Category
|
17
|
+
# It defines whether the extracted category is confident or not
|
18
|
+
attr_accessor :confident
|
19
|
+
|
20
20
|
# The ID of the category
|
21
21
|
attr_accessor :id
|
22
22
|
|
23
|
-
# The
|
24
|
-
attr_accessor :
|
23
|
+
# The label of the category
|
24
|
+
attr_accessor :label
|
25
25
|
|
26
26
|
# The level of the category
|
27
27
|
attr_accessor :level
|
28
28
|
|
29
|
-
# The score of the category
|
30
|
-
attr_accessor :score
|
31
|
-
|
32
|
-
# It defines whether the extracted category is confident or not
|
33
|
-
attr_accessor :confident
|
34
|
-
|
35
|
-
# Related links for the category
|
36
29
|
attr_accessor :links
|
37
30
|
|
38
|
-
|
39
|
-
|
40
|
-
attr_reader :allowable_values
|
41
|
-
|
42
|
-
def initialize(datatype, allowable_values)
|
43
|
-
@allowable_values = allowable_values.map do |value|
|
44
|
-
case datatype.to_s
|
45
|
-
when /Integer/i
|
46
|
-
value.to_i
|
47
|
-
when /Float/i
|
48
|
-
value.to_f
|
49
|
-
else
|
50
|
-
value
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
31
|
+
# The score of the category
|
32
|
+
attr_accessor :score
|
54
33
|
|
55
|
-
|
56
|
-
!value || allowable_values.include?(value)
|
57
|
-
end
|
58
|
-
end
|
34
|
+
attr_accessor :taxonomy
|
59
35
|
|
60
36
|
# Attribute mapping from ruby-style variable name to JSON key.
|
61
37
|
def self.attribute_map
|
62
38
|
{
|
39
|
+
:'confident' => :'confident',
|
63
40
|
:'id' => :'id',
|
64
|
-
:'
|
41
|
+
:'label' => :'label',
|
65
42
|
:'level' => :'level',
|
43
|
+
:'links' => :'links',
|
66
44
|
:'score' => :'score',
|
67
|
-
:'
|
68
|
-
:'links' => :'links'
|
45
|
+
:'taxonomy' => :'taxonomy'
|
69
46
|
}
|
70
47
|
end
|
71
48
|
|
72
49
|
# Attribute type mapping.
|
73
|
-
def self.
|
50
|
+
def self.openapi_types
|
74
51
|
{
|
52
|
+
:'confident' => :'Boolean',
|
75
53
|
:'id' => :'String',
|
76
|
-
:'
|
54
|
+
:'label' => :'String',
|
77
55
|
:'level' => :'Integer',
|
56
|
+
:'links' => :'CategoryLinks',
|
78
57
|
:'score' => :'Float',
|
79
|
-
:'
|
80
|
-
:'links' => :'CategoryLinks'
|
58
|
+
:'taxonomy' => :'CategoryTaxonomy'
|
81
59
|
}
|
82
60
|
end
|
83
61
|
|
62
|
+
# List of attributes with nullable: true
|
63
|
+
def self.openapi_nullable
|
64
|
+
Set.new([
|
65
|
+
])
|
66
|
+
end
|
67
|
+
|
84
68
|
# Initializes the object
|
85
69
|
# @param [Hash] attributes Model attributes in the form of hash
|
86
70
|
def initialize(attributes = {})
|
87
|
-
|
71
|
+
if (!attributes.is_a?(Hash))
|
72
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::Category` initialize method"
|
73
|
+
end
|
88
74
|
|
89
|
-
# convert string to symbol for hash key
|
90
|
-
attributes = attributes.each_with_object({}){|(k,v), h|
|
75
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
76
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
77
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
78
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `AylienNewsApi::Category`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
79
|
+
end
|
80
|
+
h[k.to_sym] = v
|
81
|
+
}
|
91
82
|
|
92
|
-
if attributes.
|
83
|
+
if attributes.key?(:'confident')
|
84
|
+
self.confident = attributes[:'confident']
|
85
|
+
end
|
86
|
+
|
87
|
+
if attributes.key?(:'id')
|
93
88
|
self.id = attributes[:'id']
|
94
89
|
end
|
95
90
|
|
96
|
-
if attributes.
|
97
|
-
self.
|
91
|
+
if attributes.key?(:'label')
|
92
|
+
self.label = attributes[:'label']
|
98
93
|
end
|
99
94
|
|
100
|
-
if attributes.
|
95
|
+
if attributes.key?(:'level')
|
101
96
|
self.level = attributes[:'level']
|
102
97
|
end
|
103
98
|
|
104
|
-
if attributes.
|
105
|
-
self.
|
99
|
+
if attributes.key?(:'links')
|
100
|
+
self.links = attributes[:'links']
|
106
101
|
end
|
107
102
|
|
108
|
-
if attributes.
|
109
|
-
self.
|
103
|
+
if attributes.key?(:'score')
|
104
|
+
self.score = attributes[:'score']
|
110
105
|
end
|
111
106
|
|
112
|
-
if attributes.
|
113
|
-
self.
|
107
|
+
if attributes.key?(:'taxonomy')
|
108
|
+
self.taxonomy = attributes[:'taxonomy']
|
114
109
|
end
|
115
|
-
|
116
110
|
end
|
117
111
|
|
118
112
|
# Show invalid properties with the reasons. Usually used together with valid?
|
119
|
-
# @return Array for valid
|
113
|
+
# @return Array for valid properties with the reasons
|
120
114
|
def list_invalid_properties
|
121
115
|
invalid_properties = Array.new
|
122
|
-
|
116
|
+
invalid_properties
|
123
117
|
end
|
124
118
|
|
125
119
|
# Check to see if the all the properties in the model are valid
|
126
120
|
# @return true if the model is valid
|
127
121
|
def valid?
|
128
|
-
|
129
|
-
return false unless taxonomy_validator.valid?(@taxonomy)
|
130
|
-
return true
|
131
|
-
end
|
132
|
-
|
133
|
-
# Custom attribute writer method checking allowed values (enum).
|
134
|
-
# @param [Object] taxonomy Object to be assigned
|
135
|
-
def taxonomy=(taxonomy)
|
136
|
-
validator = EnumAttributeValidator.new('String', ["iab-qag", "iptc-subjectcode"])
|
137
|
-
unless validator.valid?(taxonomy)
|
138
|
-
fail ArgumentError, "invalid value for 'taxonomy', must be one of #{validator.allowable_values}."
|
139
|
-
end
|
140
|
-
@taxonomy = taxonomy
|
122
|
+
true
|
141
123
|
end
|
142
124
|
|
143
125
|
# Checks equality by comparing each attribute.
|
@@ -145,12 +127,13 @@ module AylienNewsApi
|
|
145
127
|
def ==(o)
|
146
128
|
return true if self.equal?(o)
|
147
129
|
self.class == o.class &&
|
130
|
+
confident == o.confident &&
|
148
131
|
id == o.id &&
|
149
|
-
|
132
|
+
label == o.label &&
|
150
133
|
level == o.level &&
|
134
|
+
links == o.links &&
|
151
135
|
score == o.score &&
|
152
|
-
|
153
|
-
links == o.links
|
136
|
+
taxonomy == o.taxonomy
|
154
137
|
end
|
155
138
|
|
156
139
|
# @see the `==` method
|
@@ -160,9 +143,16 @@ module AylienNewsApi
|
|
160
143
|
end
|
161
144
|
|
162
145
|
# Calculates hash code according to all attributes.
|
163
|
-
# @return [
|
146
|
+
# @return [Integer] Hash code
|
164
147
|
def hash
|
165
|
-
[id,
|
148
|
+
[confident, id, label, level, links, score, taxonomy].hash
|
149
|
+
end
|
150
|
+
|
151
|
+
# Builds the object from hash
|
152
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
153
|
+
# @return [Object] Returns the model itself
|
154
|
+
def self.build_from_hash(attributes)
|
155
|
+
new.build_from_hash(attributes)
|
166
156
|
end
|
167
157
|
|
168
158
|
# Builds the object from hash
|
@@ -170,12 +160,12 @@ module AylienNewsApi
|
|
170
160
|
# @return [Object] Returns the model itself
|
171
161
|
def build_from_hash(attributes)
|
172
162
|
return nil unless attributes.is_a?(Hash)
|
173
|
-
self.class.
|
174
|
-
if type =~
|
175
|
-
# check to ensure the input is an array given that the
|
163
|
+
self.class.openapi_types.each_pair do |key, type|
|
164
|
+
if type =~ /\AArray<(.*)>/i
|
165
|
+
# check to ensure the input is an array given that the attribute
|
176
166
|
# is documented as an array but the input is not
|
177
167
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
178
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) }
|
168
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
179
169
|
end
|
180
170
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
181
171
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
@@ -201,8 +191,8 @@ module AylienNewsApi
|
|
201
191
|
value.to_i
|
202
192
|
when :Float
|
203
193
|
value.to_f
|
204
|
-
when :
|
205
|
-
if value.to_s =~
|
194
|
+
when :Boolean
|
195
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
206
196
|
true
|
207
197
|
else
|
208
198
|
false
|
@@ -213,7 +203,7 @@ module AylienNewsApi
|
|
213
203
|
when /\AArray<(?<inner_type>.+)>\z/
|
214
204
|
inner_type = Regexp.last_match[:inner_type]
|
215
205
|
value.map { |v| _deserialize(inner_type, v) }
|
216
|
-
when /\AHash<(?<k_type
|
206
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
217
207
|
k_type = Regexp.last_match[:k_type]
|
218
208
|
v_type = Regexp.last_match[:v_type]
|
219
209
|
{}.tap do |hash|
|
@@ -222,8 +212,7 @@ module AylienNewsApi
|
|
222
212
|
end
|
223
213
|
end
|
224
214
|
else # model
|
225
|
-
|
226
|
-
temp_model.build_from_hash(value)
|
215
|
+
AylienNewsApi.const_get(type).build_from_hash(value)
|
227
216
|
end
|
228
217
|
end
|
229
218
|
|
@@ -245,7 +234,11 @@ module AylienNewsApi
|
|
245
234
|
hash = {}
|
246
235
|
self.class.attribute_map.each_pair do |attr, param|
|
247
236
|
value = self.send(attr)
|
248
|
-
|
237
|
+
if value.nil?
|
238
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
239
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
240
|
+
end
|
241
|
+
|
249
242
|
hash[param] = _to_hash(value)
|
250
243
|
end
|
251
244
|
hash
|
@@ -257,7 +250,7 @@ module AylienNewsApi
|
|
257
250
|
# @return [Hash] Returns the value in the form of hash
|
258
251
|
def _to_hash(value)
|
259
252
|
if value.is_a?(Array)
|
260
|
-
value.compact.map{ |v| _to_hash(v) }
|
253
|
+
value.compact.map { |v| _to_hash(v) }
|
261
254
|
elsif value.is_a?(Hash)
|
262
255
|
{}.tap do |hash|
|
263
256
|
value.each { |k, v| hash[k] = _to_hash(v) }
|
@@ -268,7 +261,5 @@ module AylienNewsApi
|
|
268
261
|
value
|
269
262
|
end
|
270
263
|
end
|
271
|
-
|
272
264
|
end
|
273
|
-
|
274
265
|
end
|