aylien_news_api 1.0.0 → 3.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 +6 -0
- data/README.md +117 -4
- data/Rakefile +2 -0
- data/aylien_news_api.gemspec +16 -27
- data/docs/Author.md +12 -1
- data/docs/Autocomplete.md +10 -0
- data/docs/Autocompletes.md +9 -0
- data/docs/Category.md +17 -3
- data/docs/CategoryLinks.md +11 -1
- data/docs/Cluster.md +29 -0
- data/docs/Clusters.md +21 -0
- data/docs/Coverages.md +16 -4
- data/docs/DefaultApi.md +1250 -1117
- 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 +16 -3
- data/docs/Location.md +13 -2
- data/docs/Media.md +17 -3
- data/docs/Rank.md +12 -1
- data/docs/Rankings.md +9 -0
- data/docs/RelatedStories.md +14 -3
- data/docs/RepresentativeStory.md +23 -0
- data/docs/Scope.md +14 -2
- data/docs/Sentiment.md +10 -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 +11 -2
- data/docs/Story.md +48 -16
- data/docs/StoryCluster.md +14 -1
- data/docs/StoryLinks.md +14 -2
- 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 +11 -1
- data/git_push.sh +58 -0
- data/lib/aylien_news_api.rb +11 -10
- data/lib/aylien_news_api/api/default_api.rb +2065 -1801
- data/lib/aylien_news_api/api_client.rb +129 -108
- data/lib/aylien_news_api/api_error.rb +25 -10
- data/lib/aylien_news_api/configuration.rb +69 -33
- data/lib/aylien_news_api/models/author.rb +50 -46
- data/lib/aylien_news_api/models/autocomplete.rb +36 -32
- data/lib/aylien_news_api/models/autocompletes.rb +35 -31
- data/lib/aylien_news_api/models/category.rb +63 -59
- data/lib/aylien_news_api/models/category_links.rb +47 -43
- data/lib/aylien_news_api/models/cluster.rb +255 -0
- data/lib/aylien_news_api/models/clusters.rb +219 -0
- data/lib/aylien_news_api/models/coverages.rb +60 -68
- data/lib/aylien_news_api/models/entities.rb +48 -44
- data/lib/aylien_news_api/models/entity.rb +71 -69
- data/lib/aylien_news_api/models/entity_links.rb +35 -31
- data/lib/aylien_news_api/models/error.rb +60 -56
- data/lib/aylien_news_api/models/error_links.rb +35 -31
- data/lib/aylien_news_api/models/errors.rb +35 -31
- data/lib/aylien_news_api/models/histogram_interval.rb +36 -32
- data/lib/aylien_news_api/models/histograms.rb +62 -58
- data/lib/aylien_news_api/models/location.rb +51 -47
- data/lib/aylien_news_api/models/media.rb +81 -76
- data/lib/aylien_news_api/models/rank.rb +48 -44
- data/lib/aylien_news_api/models/rankings.rb +35 -31
- data/lib/aylien_news_api/models/related_stories.rb +53 -61
- data/lib/aylien_news_api/models/representative_story.rb +227 -0
- data/lib/aylien_news_api/models/scope.rb +59 -54
- data/lib/aylien_news_api/models/sentiment.rb +41 -37
- data/lib/aylien_news_api/models/sentiments.rb +46 -44
- data/lib/aylien_news_api/models/share_count.rb +36 -32
- data/lib/aylien_news_api/models/share_counts.rb +38 -34
- data/lib/aylien_news_api/models/source.rb +95 -92
- data/lib/aylien_news_api/models/stories.rb +47 -55
- data/lib/aylien_news_api/models/story.rb +172 -154
- data/lib/aylien_news_api/models/story_cluster.rb +52 -48
- data/lib/aylien_news_api/models/story_links.rb +58 -54
- data/lib/aylien_news_api/models/story_translations.rb +197 -0
- data/lib/aylien_news_api/models/story_translations_en.rb +217 -0
- data/lib/aylien_news_api/models/summary.rb +35 -31
- data/lib/aylien_news_api/models/time_series.rb +47 -43
- data/lib/aylien_news_api/models/time_series_list.rb +56 -52
- data/lib/aylien_news_api/models/trend.rb +47 -43
- data/lib/aylien_news_api/models/trends.rb +48 -44
- data/lib/aylien_news_api/version.rb +7 -11
- data/spec/api/default_api_spec.rb +569 -533
- data/spec/api_client_spec.rb +34 -76
- data/spec/configuration_spec.rb +14 -18
- data/spec/models/author_spec.rb +15 -18
- data/spec/models/autocomplete_spec.rb +11 -14
- data/spec/models/autocompletes_spec.rb +10 -13
- data/spec/models/category_links_spec.rb +13 -16
- data/spec/models/category_spec.rb +24 -27
- data/spec/models/cluster_spec.rb +77 -0
- data/spec/models/clusters_spec.rb +53 -0
- data/spec/models/coverages_spec.rb +17 -26
- data/spec/models/entities_spec.rb +13 -16
- data/spec/models/entity_links_spec.rb +10 -13
- data/spec/models/entity_spec.rb +19 -22
- data/spec/models/error_links_spec.rb +10 -13
- data/spec/models/error_spec.rb +21 -24
- data/spec/models/errors_spec.rb +10 -13
- data/spec/models/histogram_interval_spec.rb +11 -14
- data/spec/models/histograms_spec.rb +18 -21
- data/spec/models/location_spec.rb +15 -18
- data/spec/models/media_spec.rb +29 -32
- data/spec/models/rank_spec.rb +15 -18
- data/spec/models/rankings_spec.rb +10 -13
- data/spec/models/related_stories_spec.rb +15 -24
- data/spec/models/representative_story_spec.rb +59 -0
- data/spec/models/scope_spec.rb +21 -24
- data/spec/models/sentiment_spec.rb +15 -18
- data/spec/models/sentiments_spec.rb +13 -16
- data/spec/models/share_count_spec.rb +11 -14
- data/spec/models/share_counts_spec.rb +13 -16
- data/spec/models/source_spec.rb +29 -32
- data/spec/models/stories_spec.rb +13 -22
- data/spec/models/story_cluster_spec.rb +17 -20
- data/spec/models/story_links_spec.rb +17 -20
- data/spec/models/story_spec.rb +59 -50
- 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 +10 -13
- data/spec/models/time_series_list_spec.rb +16 -19
- data/spec/models/time_series_spec.rb +13 -16
- data/spec/models/trend_spec.rb +13 -16
- data/spec/models/trends_spec.rb +13 -16
- data/spec/spec_helper.rb +6 -10
- metadata +68 -194
@@ -1,80 +1,80 @@
|
|
1
1
|
=begin
|
2
|
-
|
2
|
+
#AYLIEN News API
|
3
3
|
|
4
|
-
|
5
|
-
you may not use this file except in compliance with the License.
|
6
|
-
You may obtain a copy of the License at
|
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.
|
7
5
|
|
8
|
-
|
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: 4.1.3-SNAPSHOT
|
9
10
|
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
See the License for the specific language governing permissions and
|
14
|
-
limitations under the License.
|
15
11
|
=end
|
16
12
|
|
17
13
|
require 'date'
|
18
14
|
|
19
15
|
module AylienNewsApi
|
20
|
-
|
21
16
|
class Entities
|
22
|
-
# An array of extracted entities from the story title
|
23
|
-
attr_accessor :title
|
24
|
-
|
25
17
|
# An array of extracted entities from the story body
|
26
18
|
attr_accessor :body
|
27
19
|
|
20
|
+
# An array of extracted entities from the story title
|
21
|
+
attr_accessor :title
|
28
22
|
|
29
23
|
# Attribute mapping from ruby-style variable name to JSON key.
|
30
24
|
def self.attribute_map
|
31
25
|
{
|
32
|
-
:'
|
33
|
-
:'
|
26
|
+
:'body' => :'body',
|
27
|
+
:'title' => :'title'
|
34
28
|
}
|
35
29
|
end
|
36
30
|
|
37
31
|
# Attribute type mapping.
|
38
|
-
def self.
|
32
|
+
def self.openapi_types
|
39
33
|
{
|
40
|
-
:'
|
41
|
-
:'
|
34
|
+
:'body' => :'Array<Entity>',
|
35
|
+
:'title' => :'Array<Entity>'
|
42
36
|
}
|
43
37
|
end
|
44
38
|
|
45
39
|
# Initializes the object
|
46
40
|
# @param [Hash] attributes Model attributes in the form of hash
|
47
41
|
def initialize(attributes = {})
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
42
|
+
if (!attributes.is_a?(Hash))
|
43
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::Entities` initialize method"
|
44
|
+
end
|
52
45
|
|
53
|
-
if
|
54
|
-
|
55
|
-
|
46
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
47
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
48
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
49
|
+
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
|
56
50
|
end
|
57
|
-
|
51
|
+
h[k.to_sym] = v
|
52
|
+
}
|
58
53
|
|
59
|
-
if attributes.
|
54
|
+
if attributes.key?(:'body')
|
60
55
|
if (value = attributes[:'body']).is_a?(Array)
|
61
56
|
self.body = value
|
62
57
|
end
|
63
58
|
end
|
64
59
|
|
60
|
+
if attributes.key?(:'title')
|
61
|
+
if (value = attributes[:'title']).is_a?(Array)
|
62
|
+
self.title = value
|
63
|
+
end
|
64
|
+
end
|
65
65
|
end
|
66
66
|
|
67
67
|
# Show invalid properties with the reasons. Usually used together with valid?
|
68
|
-
# @return Array for valid
|
68
|
+
# @return Array for valid properties with the reasons
|
69
69
|
def list_invalid_properties
|
70
70
|
invalid_properties = Array.new
|
71
|
-
|
71
|
+
invalid_properties
|
72
72
|
end
|
73
73
|
|
74
74
|
# Check to see if the all the properties in the model are valid
|
75
75
|
# @return true if the model is valid
|
76
76
|
def valid?
|
77
|
-
|
77
|
+
true
|
78
78
|
end
|
79
79
|
|
80
80
|
# Checks equality by comparing each attribute.
|
@@ -82,8 +82,8 @@ module AylienNewsApi
|
|
82
82
|
def ==(o)
|
83
83
|
return true if self.equal?(o)
|
84
84
|
self.class == o.class &&
|
85
|
-
|
86
|
-
|
85
|
+
body == o.body &&
|
86
|
+
title == o.title
|
87
87
|
end
|
88
88
|
|
89
89
|
# @see the `==` method
|
@@ -93,9 +93,16 @@ module AylienNewsApi
|
|
93
93
|
end
|
94
94
|
|
95
95
|
# Calculates hash code according to all attributes.
|
96
|
-
# @return [
|
96
|
+
# @return [Integer] Hash code
|
97
97
|
def hash
|
98
|
-
[
|
98
|
+
[body, title].hash
|
99
|
+
end
|
100
|
+
|
101
|
+
# Builds the object from hash
|
102
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
103
|
+
# @return [Object] Returns the model itself
|
104
|
+
def self.build_from_hash(attributes)
|
105
|
+
new.build_from_hash(attributes)
|
99
106
|
end
|
100
107
|
|
101
108
|
# Builds the object from hash
|
@@ -103,12 +110,12 @@ module AylienNewsApi
|
|
103
110
|
# @return [Object] Returns the model itself
|
104
111
|
def build_from_hash(attributes)
|
105
112
|
return nil unless attributes.is_a?(Hash)
|
106
|
-
self.class.
|
113
|
+
self.class.openapi_types.each_pair do |key, type|
|
107
114
|
if type =~ /\AArray<(.*)>/i
|
108
|
-
# check to ensure the input is an array given that the
|
115
|
+
# check to ensure the input is an array given that the attribute
|
109
116
|
# is documented as an array but the input is not
|
110
117
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
111
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) }
|
118
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
112
119
|
end
|
113
120
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
114
121
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
@@ -134,7 +141,7 @@ module AylienNewsApi
|
|
134
141
|
value.to_i
|
135
142
|
when :Float
|
136
143
|
value.to_f
|
137
|
-
when :
|
144
|
+
when :Boolean
|
138
145
|
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
139
146
|
true
|
140
147
|
else
|
@@ -155,8 +162,7 @@ module AylienNewsApi
|
|
155
162
|
end
|
156
163
|
end
|
157
164
|
else # model
|
158
|
-
|
159
|
-
temp_model.build_from_hash(value)
|
165
|
+
AylienNewsApi.const_get(type).build_from_hash(value)
|
160
166
|
end
|
161
167
|
end
|
162
168
|
|
@@ -190,7 +196,7 @@ module AylienNewsApi
|
|
190
196
|
# @return [Hash] Returns the value in the form of hash
|
191
197
|
def _to_hash(value)
|
192
198
|
if value.is_a?(Array)
|
193
|
-
value.compact.map{ |v| _to_hash(v) }
|
199
|
+
value.compact.map { |v| _to_hash(v) }
|
194
200
|
elsif value.is_a?(Hash)
|
195
201
|
{}.tap do |hash|
|
196
202
|
value.each { |k, v| hash[k] = _to_hash(v) }
|
@@ -201,7 +207,5 @@ module AylienNewsApi
|
|
201
207
|
value
|
202
208
|
end
|
203
209
|
end
|
204
|
-
|
205
210
|
end
|
206
|
-
|
207
211
|
end
|
@@ -1,109 +1,108 @@
|
|
1
1
|
=begin
|
2
|
-
|
2
|
+
#AYLIEN News API
|
3
3
|
|
4
|
-
|
5
|
-
you may not use this file except in compliance with the License.
|
6
|
-
You may obtain a copy of the License at
|
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.
|
7
5
|
|
8
|
-
|
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: 4.1.3-SNAPSHOT
|
9
10
|
|
10
|
-
Unless required by applicable law or agreed to in writing, software
|
11
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
See the License for the specific language governing permissions and
|
14
|
-
limitations under the License.
|
15
11
|
=end
|
16
12
|
|
17
13
|
require 'date'
|
18
14
|
|
19
15
|
module AylienNewsApi
|
20
|
-
|
21
16
|
class Entity
|
22
|
-
# The entity text
|
23
|
-
attr_accessor :
|
17
|
+
# The indices of the entity text
|
18
|
+
attr_accessor :indices
|
19
|
+
|
20
|
+
attr_accessor :links
|
24
21
|
|
25
22
|
# The entity score
|
26
23
|
attr_accessor :score
|
27
24
|
|
25
|
+
# The entity text
|
26
|
+
attr_accessor :text
|
27
|
+
|
28
28
|
# An array of the dbpedia types
|
29
29
|
attr_accessor :types
|
30
30
|
|
31
|
-
# Related links to the entity
|
32
|
-
attr_accessor :links
|
33
|
-
|
34
|
-
# The indices of the entity text
|
35
|
-
attr_accessor :indices
|
36
|
-
|
37
|
-
|
38
31
|
# Attribute mapping from ruby-style variable name to JSON key.
|
39
32
|
def self.attribute_map
|
40
33
|
{
|
41
|
-
:'
|
42
|
-
:'score' => :'score',
|
43
|
-
:'types' => :'types',
|
34
|
+
:'indices' => :'indices',
|
44
35
|
:'links' => :'links',
|
45
|
-
:'
|
36
|
+
:'score' => :'score',
|
37
|
+
:'text' => :'text',
|
38
|
+
:'types' => :'types'
|
46
39
|
}
|
47
40
|
end
|
48
41
|
|
49
42
|
# Attribute type mapping.
|
50
|
-
def self.
|
43
|
+
def self.openapi_types
|
51
44
|
{
|
52
|
-
:'
|
53
|
-
:'score' => :'Float',
|
54
|
-
:'types' => :'Array<String>',
|
45
|
+
:'indices' => :'Array<Array<Integer>>',
|
55
46
|
:'links' => :'EntityLinks',
|
56
|
-
:'
|
47
|
+
:'score' => :'Float',
|
48
|
+
:'text' => :'String',
|
49
|
+
:'types' => :'Array<String>'
|
57
50
|
}
|
58
51
|
end
|
59
52
|
|
60
53
|
# Initializes the object
|
61
54
|
# @param [Hash] attributes Model attributes in the form of hash
|
62
55
|
def initialize(attributes = {})
|
63
|
-
|
56
|
+
if (!attributes.is_a?(Hash))
|
57
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::Entity` initialize method"
|
58
|
+
end
|
64
59
|
|
65
|
-
# convert string to symbol for hash key
|
66
|
-
attributes = attributes.each_with_object({}){|(k,v), h|
|
60
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
61
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
62
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
63
|
+
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
|
64
|
+
end
|
65
|
+
h[k.to_sym] = v
|
66
|
+
}
|
67
67
|
|
68
|
-
if attributes.
|
69
|
-
|
68
|
+
if attributes.key?(:'indices')
|
69
|
+
if (value = attributes[:'indices']).is_a?(Array)
|
70
|
+
self.indices = value
|
71
|
+
end
|
70
72
|
end
|
71
73
|
|
72
|
-
if attributes.
|
73
|
-
self.
|
74
|
+
if attributes.key?(:'links')
|
75
|
+
self.links = attributes[:'links']
|
74
76
|
end
|
75
77
|
|
76
|
-
if attributes.
|
77
|
-
|
78
|
-
self.types = value
|
79
|
-
end
|
78
|
+
if attributes.key?(:'score')
|
79
|
+
self.score = attributes[:'score']
|
80
80
|
end
|
81
81
|
|
82
|
-
if attributes.
|
83
|
-
self.
|
82
|
+
if attributes.key?(:'text')
|
83
|
+
self.text = attributes[:'text']
|
84
84
|
end
|
85
85
|
|
86
|
-
if attributes.
|
87
|
-
if (value = attributes[:'
|
88
|
-
self.
|
86
|
+
if attributes.key?(:'types')
|
87
|
+
if (value = attributes[:'types']).is_a?(Array)
|
88
|
+
self.types = value
|
89
89
|
end
|
90
90
|
end
|
91
|
-
|
92
91
|
end
|
93
92
|
|
94
93
|
# Show invalid properties with the reasons. Usually used together with valid?
|
95
|
-
# @return Array for valid
|
94
|
+
# @return Array for valid properties with the reasons
|
96
95
|
def list_invalid_properties
|
97
96
|
invalid_properties = Array.new
|
98
97
|
if !@score.nil? && @score > 1
|
99
|
-
invalid_properties.push(
|
98
|
+
invalid_properties.push('invalid value for "score", must be smaller than or equal to 1.')
|
100
99
|
end
|
101
100
|
|
102
101
|
if !@score.nil? && @score < 0
|
103
|
-
invalid_properties.push(
|
102
|
+
invalid_properties.push('invalid value for "score", must be greater than or equal to 0.')
|
104
103
|
end
|
105
104
|
|
106
|
-
|
105
|
+
invalid_properties
|
107
106
|
end
|
108
107
|
|
109
108
|
# Check to see if the all the properties in the model are valid
|
@@ -111,19 +110,18 @@ module AylienNewsApi
|
|
111
110
|
def valid?
|
112
111
|
return false if !@score.nil? && @score > 1
|
113
112
|
return false if !@score.nil? && @score < 0
|
114
|
-
|
113
|
+
true
|
115
114
|
end
|
116
115
|
|
117
116
|
# Custom attribute writer method with validation
|
118
117
|
# @param [Object] score Value to be assigned
|
119
118
|
def score=(score)
|
120
|
-
|
121
119
|
if !score.nil? && score > 1
|
122
|
-
fail ArgumentError,
|
120
|
+
fail ArgumentError, 'invalid value for "score", must be smaller than or equal to 1.'
|
123
121
|
end
|
124
122
|
|
125
123
|
if !score.nil? && score < 0
|
126
|
-
fail ArgumentError,
|
124
|
+
fail ArgumentError, 'invalid value for "score", must be greater than or equal to 0.'
|
127
125
|
end
|
128
126
|
|
129
127
|
@score = score
|
@@ -134,11 +132,11 @@ module AylienNewsApi
|
|
134
132
|
def ==(o)
|
135
133
|
return true if self.equal?(o)
|
136
134
|
self.class == o.class &&
|
137
|
-
|
138
|
-
score == o.score &&
|
139
|
-
types == o.types &&
|
135
|
+
indices == o.indices &&
|
140
136
|
links == o.links &&
|
141
|
-
|
137
|
+
score == o.score &&
|
138
|
+
text == o.text &&
|
139
|
+
types == o.types
|
142
140
|
end
|
143
141
|
|
144
142
|
# @see the `==` method
|
@@ -148,9 +146,16 @@ module AylienNewsApi
|
|
148
146
|
end
|
149
147
|
|
150
148
|
# Calculates hash code according to all attributes.
|
151
|
-
# @return [
|
149
|
+
# @return [Integer] Hash code
|
152
150
|
def hash
|
153
|
-
[
|
151
|
+
[indices, links, score, text, types].hash
|
152
|
+
end
|
153
|
+
|
154
|
+
# Builds the object from hash
|
155
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
156
|
+
# @return [Object] Returns the model itself
|
157
|
+
def self.build_from_hash(attributes)
|
158
|
+
new.build_from_hash(attributes)
|
154
159
|
end
|
155
160
|
|
156
161
|
# Builds the object from hash
|
@@ -158,12 +163,12 @@ module AylienNewsApi
|
|
158
163
|
# @return [Object] Returns the model itself
|
159
164
|
def build_from_hash(attributes)
|
160
165
|
return nil unless attributes.is_a?(Hash)
|
161
|
-
self.class.
|
166
|
+
self.class.openapi_types.each_pair do |key, type|
|
162
167
|
if type =~ /\AArray<(.*)>/i
|
163
|
-
# check to ensure the input is an array given that the
|
168
|
+
# check to ensure the input is an array given that the attribute
|
164
169
|
# is documented as an array but the input is not
|
165
170
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
166
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) }
|
171
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
167
172
|
end
|
168
173
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
169
174
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
@@ -189,7 +194,7 @@ module AylienNewsApi
|
|
189
194
|
value.to_i
|
190
195
|
when :Float
|
191
196
|
value.to_f
|
192
|
-
when :
|
197
|
+
when :Boolean
|
193
198
|
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
194
199
|
true
|
195
200
|
else
|
@@ -210,8 +215,7 @@ module AylienNewsApi
|
|
210
215
|
end
|
211
216
|
end
|
212
217
|
else # model
|
213
|
-
|
214
|
-
temp_model.build_from_hash(value)
|
218
|
+
AylienNewsApi.const_get(type).build_from_hash(value)
|
215
219
|
end
|
216
220
|
end
|
217
221
|
|
@@ -245,7 +249,7 @@ module AylienNewsApi
|
|
245
249
|
# @return [Hash] Returns the value in the form of hash
|
246
250
|
def _to_hash(value)
|
247
251
|
if value.is_a?(Array)
|
248
|
-
value.compact.map{ |v| _to_hash(v) }
|
252
|
+
value.compact.map { |v| _to_hash(v) }
|
249
253
|
elsif value.is_a?(Hash)
|
250
254
|
{}.tap do |hash|
|
251
255
|
value.each { |k, v| hash[k] = _to_hash(v) }
|
@@ -256,7 +260,5 @@ module AylienNewsApi
|
|
256
260
|
value
|
257
261
|
end
|
258
262
|
end
|
259
|
-
|
260
263
|
end
|
261
|
-
|
262
264
|
end
|