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