aylien_news_api 1.0.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -0,0 +1,227 @@
|
|
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: 4.1.3-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module AylienNewsApi
|
16
|
+
class RepresentativeStory
|
17
|
+
# ID of the story which is a unique identification
|
18
|
+
attr_accessor :id
|
19
|
+
|
20
|
+
# The story permalink URL
|
21
|
+
attr_accessor :permalink
|
22
|
+
|
23
|
+
# Published date of the story
|
24
|
+
attr_accessor :published_at
|
25
|
+
|
26
|
+
# Title of the story
|
27
|
+
attr_accessor :title
|
28
|
+
|
29
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
30
|
+
def self.attribute_map
|
31
|
+
{
|
32
|
+
:'id' => :'id',
|
33
|
+
:'permalink' => :'permalink',
|
34
|
+
:'published_at' => :'published_at',
|
35
|
+
:'title' => :'title'
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
# Attribute type mapping.
|
40
|
+
def self.openapi_types
|
41
|
+
{
|
42
|
+
:'id' => :'Integer',
|
43
|
+
:'permalink' => :'String',
|
44
|
+
:'published_at' => :'DateTime',
|
45
|
+
:'title' => :'String'
|
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::RepresentativeStory` 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::RepresentativeStory`. 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?(:'permalink')
|
69
|
+
self.permalink = attributes[:'permalink']
|
70
|
+
end
|
71
|
+
|
72
|
+
if attributes.key?(:'published_at')
|
73
|
+
self.published_at = attributes[:'published_at']
|
74
|
+
end
|
75
|
+
|
76
|
+
if attributes.key?(:'title')
|
77
|
+
self.title = attributes[:'title']
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
82
|
+
# @return Array for valid properties with the reasons
|
83
|
+
def list_invalid_properties
|
84
|
+
invalid_properties = Array.new
|
85
|
+
invalid_properties
|
86
|
+
end
|
87
|
+
|
88
|
+
# Check to see if the all the properties in the model are valid
|
89
|
+
# @return true if the model is valid
|
90
|
+
def valid?
|
91
|
+
true
|
92
|
+
end
|
93
|
+
|
94
|
+
# Checks equality by comparing each attribute.
|
95
|
+
# @param [Object] Object to be compared
|
96
|
+
def ==(o)
|
97
|
+
return true if self.equal?(o)
|
98
|
+
self.class == o.class &&
|
99
|
+
id == o.id &&
|
100
|
+
permalink == o.permalink &&
|
101
|
+
published_at == o.published_at &&
|
102
|
+
title == o.title
|
103
|
+
end
|
104
|
+
|
105
|
+
# @see the `==` method
|
106
|
+
# @param [Object] Object to be compared
|
107
|
+
def eql?(o)
|
108
|
+
self == o
|
109
|
+
end
|
110
|
+
|
111
|
+
# Calculates hash code according to all attributes.
|
112
|
+
# @return [Integer] Hash code
|
113
|
+
def hash
|
114
|
+
[id, permalink, published_at, title].hash
|
115
|
+
end
|
116
|
+
|
117
|
+
# Builds the object from hash
|
118
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
119
|
+
# @return [Object] Returns the model itself
|
120
|
+
def self.build_from_hash(attributes)
|
121
|
+
new.build_from_hash(attributes)
|
122
|
+
end
|
123
|
+
|
124
|
+
# Builds the object from hash
|
125
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
126
|
+
# @return [Object] Returns the model itself
|
127
|
+
def build_from_hash(attributes)
|
128
|
+
return nil unless attributes.is_a?(Hash)
|
129
|
+
self.class.openapi_types.each_pair do |key, type|
|
130
|
+
if type =~ /\AArray<(.*)>/i
|
131
|
+
# check to ensure the input is an array given that the attribute
|
132
|
+
# is documented as an array but the input is not
|
133
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
134
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
135
|
+
end
|
136
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
137
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
138
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
139
|
+
end
|
140
|
+
|
141
|
+
self
|
142
|
+
end
|
143
|
+
|
144
|
+
# Deserializes the data based on type
|
145
|
+
# @param string type Data type
|
146
|
+
# @param string value Value to be deserialized
|
147
|
+
# @return [Object] Deserialized data
|
148
|
+
def _deserialize(type, value)
|
149
|
+
case type.to_sym
|
150
|
+
when :DateTime
|
151
|
+
DateTime.parse(value)
|
152
|
+
when :Date
|
153
|
+
Date.parse(value)
|
154
|
+
when :String
|
155
|
+
value.to_s
|
156
|
+
when :Integer
|
157
|
+
value.to_i
|
158
|
+
when :Float
|
159
|
+
value.to_f
|
160
|
+
when :Boolean
|
161
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
162
|
+
true
|
163
|
+
else
|
164
|
+
false
|
165
|
+
end
|
166
|
+
when :Object
|
167
|
+
# generic object (usually a Hash), return directly
|
168
|
+
value
|
169
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
170
|
+
inner_type = Regexp.last_match[:inner_type]
|
171
|
+
value.map { |v| _deserialize(inner_type, v) }
|
172
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
173
|
+
k_type = Regexp.last_match[:k_type]
|
174
|
+
v_type = Regexp.last_match[:v_type]
|
175
|
+
{}.tap do |hash|
|
176
|
+
value.each do |k, v|
|
177
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
178
|
+
end
|
179
|
+
end
|
180
|
+
else # model
|
181
|
+
AylienNewsApi.const_get(type).build_from_hash(value)
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
# Returns the string representation of the object
|
186
|
+
# @return [String] String presentation of the object
|
187
|
+
def to_s
|
188
|
+
to_hash.to_s
|
189
|
+
end
|
190
|
+
|
191
|
+
# to_body is an alias to to_hash (backward compatibility)
|
192
|
+
# @return [Hash] Returns the object in the form of hash
|
193
|
+
def to_body
|
194
|
+
to_hash
|
195
|
+
end
|
196
|
+
|
197
|
+
# Returns the object in the form of hash
|
198
|
+
# @return [Hash] Returns the object in the form of hash
|
199
|
+
def to_hash
|
200
|
+
hash = {}
|
201
|
+
self.class.attribute_map.each_pair do |attr, param|
|
202
|
+
value = self.send(attr)
|
203
|
+
next if value.nil?
|
204
|
+
hash[param] = _to_hash(value)
|
205
|
+
end
|
206
|
+
hash
|
207
|
+
end
|
208
|
+
|
209
|
+
# Outputs non-array value in the form of hash
|
210
|
+
# For object, use to_hash. Otherwise, just return the value
|
211
|
+
# @param [Object] value Any valid value
|
212
|
+
# @return [Hash] Returns the value in the form of hash
|
213
|
+
def _to_hash(value)
|
214
|
+
if value.is_a?(Array)
|
215
|
+
value.compact.map { |v| _to_hash(v) }
|
216
|
+
elsif value.is_a?(Hash)
|
217
|
+
{}.tap do |hash|
|
218
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
219
|
+
end
|
220
|
+
elsif value.respond_to? :to_hash
|
221
|
+
value.to_hash
|
222
|
+
else
|
223
|
+
value
|
224
|
+
end
|
225
|
+
end
|
226
|
+
end
|
227
|
+
end
|
@@ -1,36 +1,31 @@
|
|
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 Scope
|
22
|
-
# The source scope by country code. It supports [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country codes.
|
23
|
-
attr_accessor :country
|
24
|
-
|
25
|
-
# The scope by state
|
26
|
-
attr_accessor :state
|
27
|
-
|
28
17
|
# The scope by city
|
29
18
|
attr_accessor :city
|
30
19
|
|
20
|
+
# The source scope by country code. It supports [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country codes.
|
21
|
+
attr_accessor :country
|
22
|
+
|
31
23
|
# The scope by level
|
32
24
|
attr_accessor :level
|
33
25
|
|
26
|
+
# The scope by state
|
27
|
+
attr_accessor :state
|
28
|
+
|
34
29
|
class EnumAttributeValidator
|
35
30
|
attr_reader :datatype
|
36
31
|
attr_reader :allowable_values
|
@@ -56,54 +51,60 @@ module AylienNewsApi
|
|
56
51
|
# Attribute mapping from ruby-style variable name to JSON key.
|
57
52
|
def self.attribute_map
|
58
53
|
{
|
59
|
-
:'country' => :'country',
|
60
|
-
:'state' => :'state',
|
61
54
|
:'city' => :'city',
|
62
|
-
:'
|
55
|
+
:'country' => :'country',
|
56
|
+
:'level' => :'level',
|
57
|
+
:'state' => :'state'
|
63
58
|
}
|
64
59
|
end
|
65
60
|
|
66
61
|
# Attribute type mapping.
|
67
|
-
def self.
|
62
|
+
def self.openapi_types
|
68
63
|
{
|
69
|
-
:'country' => :'String',
|
70
|
-
:'state' => :'String',
|
71
64
|
:'city' => :'String',
|
72
|
-
:'
|
65
|
+
:'country' => :'String',
|
66
|
+
:'level' => :'String',
|
67
|
+
:'state' => :'String'
|
73
68
|
}
|
74
69
|
end
|
75
70
|
|
76
71
|
# Initializes the object
|
77
72
|
# @param [Hash] attributes Model attributes in the form of hash
|
78
73
|
def initialize(attributes = {})
|
79
|
-
|
80
|
-
|
81
|
-
# convert string to symbol for hash key
|
82
|
-
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
83
|
-
|
84
|
-
if attributes.has_key?(:'country')
|
85
|
-
self.country = attributes[:'country']
|
74
|
+
if (!attributes.is_a?(Hash))
|
75
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::Scope` initialize method"
|
86
76
|
end
|
87
77
|
|
88
|
-
if
|
89
|
-
|
90
|
-
|
78
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
79
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
80
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
81
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `AylienNewsApi::Scope`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
82
|
+
end
|
83
|
+
h[k.to_sym] = v
|
84
|
+
}
|
91
85
|
|
92
|
-
if attributes.
|
86
|
+
if attributes.key?(:'city')
|
93
87
|
self.city = attributes[:'city']
|
94
88
|
end
|
95
89
|
|
96
|
-
if attributes.
|
90
|
+
if attributes.key?(:'country')
|
91
|
+
self.country = attributes[:'country']
|
92
|
+
end
|
93
|
+
|
94
|
+
if attributes.key?(:'level')
|
97
95
|
self.level = attributes[:'level']
|
98
96
|
end
|
99
97
|
|
98
|
+
if attributes.key?(:'state')
|
99
|
+
self.state = attributes[:'state']
|
100
|
+
end
|
100
101
|
end
|
101
102
|
|
102
103
|
# Show invalid properties with the reasons. Usually used together with valid?
|
103
|
-
# @return Array for valid
|
104
|
+
# @return Array for valid properties with the reasons
|
104
105
|
def list_invalid_properties
|
105
106
|
invalid_properties = Array.new
|
106
|
-
|
107
|
+
invalid_properties
|
107
108
|
end
|
108
109
|
|
109
110
|
# Check to see if the all the properties in the model are valid
|
@@ -111,7 +112,7 @@ module AylienNewsApi
|
|
111
112
|
def valid?
|
112
113
|
level_validator = EnumAttributeValidator.new('String', ["international", "national", "local"])
|
113
114
|
return false unless level_validator.valid?(@level)
|
114
|
-
|
115
|
+
true
|
115
116
|
end
|
116
117
|
|
117
118
|
# Custom attribute writer method checking allowed values (enum).
|
@@ -119,7 +120,7 @@ module AylienNewsApi
|
|
119
120
|
def level=(level)
|
120
121
|
validator = EnumAttributeValidator.new('String', ["international", "national", "local"])
|
121
122
|
unless validator.valid?(level)
|
122
|
-
fail ArgumentError, "invalid value for
|
123
|
+
fail ArgumentError, "invalid value for \"level\", must be one of #{validator.allowable_values}."
|
123
124
|
end
|
124
125
|
@level = level
|
125
126
|
end
|
@@ -129,10 +130,10 @@ module AylienNewsApi
|
|
129
130
|
def ==(o)
|
130
131
|
return true if self.equal?(o)
|
131
132
|
self.class == o.class &&
|
132
|
-
country == o.country &&
|
133
|
-
state == o.state &&
|
134
133
|
city == o.city &&
|
135
|
-
|
134
|
+
country == o.country &&
|
135
|
+
level == o.level &&
|
136
|
+
state == o.state
|
136
137
|
end
|
137
138
|
|
138
139
|
# @see the `==` method
|
@@ -142,9 +143,16 @@ module AylienNewsApi
|
|
142
143
|
end
|
143
144
|
|
144
145
|
# Calculates hash code according to all attributes.
|
145
|
-
# @return [
|
146
|
+
# @return [Integer] Hash code
|
146
147
|
def hash
|
147
|
-
[
|
148
|
+
[city, country, level, state].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)
|
148
156
|
end
|
149
157
|
|
150
158
|
# Builds the object from hash
|
@@ -152,12 +160,12 @@ module AylienNewsApi
|
|
152
160
|
# @return [Object] Returns the model itself
|
153
161
|
def build_from_hash(attributes)
|
154
162
|
return nil unless attributes.is_a?(Hash)
|
155
|
-
self.class.
|
163
|
+
self.class.openapi_types.each_pair do |key, type|
|
156
164
|
if type =~ /\AArray<(.*)>/i
|
157
|
-
# check to ensure the input is an array given that the
|
165
|
+
# check to ensure the input is an array given that the attribute
|
158
166
|
# is documented as an array but the input is not
|
159
167
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
160
|
-
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) })
|
161
169
|
end
|
162
170
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
163
171
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
@@ -183,7 +191,7 @@ module AylienNewsApi
|
|
183
191
|
value.to_i
|
184
192
|
when :Float
|
185
193
|
value.to_f
|
186
|
-
when :
|
194
|
+
when :Boolean
|
187
195
|
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
188
196
|
true
|
189
197
|
else
|
@@ -204,8 +212,7 @@ module AylienNewsApi
|
|
204
212
|
end
|
205
213
|
end
|
206
214
|
else # model
|
207
|
-
|
208
|
-
temp_model.build_from_hash(value)
|
215
|
+
AylienNewsApi.const_get(type).build_from_hash(value)
|
209
216
|
end
|
210
217
|
end
|
211
218
|
|
@@ -239,7 +246,7 @@ module AylienNewsApi
|
|
239
246
|
# @return [Hash] Returns the value in the form of hash
|
240
247
|
def _to_hash(value)
|
241
248
|
if value.is_a?(Array)
|
242
|
-
value.compact.map{ |v| _to_hash(v) }
|
249
|
+
value.compact.map { |v| _to_hash(v) }
|
243
250
|
elsif value.is_a?(Hash)
|
244
251
|
{}.tap do |hash|
|
245
252
|
value.each { |k, v| hash[k] = _to_hash(v) }
|
@@ -250,7 +257,5 @@ module AylienNewsApi
|
|
250
257
|
value
|
251
258
|
end
|
252
259
|
end
|
253
|
-
|
254
260
|
end
|
255
|
-
|
256
261
|
end
|