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,102 +1,128 @@
|
|
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 Histograms
|
20
|
-
|
21
|
-
attr_accessor :intervals
|
22
|
-
|
23
|
-
# The start interval of the histogram
|
24
|
-
attr_accessor :interval_start
|
17
|
+
attr_accessor :field
|
25
18
|
|
26
19
|
# The end interval of the histogram
|
27
20
|
attr_accessor :interval_end
|
28
21
|
|
22
|
+
# The start interval of the histogram
|
23
|
+
attr_accessor :interval_start
|
24
|
+
|
29
25
|
# The width of the histogram
|
30
26
|
attr_accessor :interval_width
|
31
27
|
|
32
|
-
|
28
|
+
# The intervals of the histograms
|
29
|
+
attr_accessor :intervals
|
33
30
|
|
31
|
+
# The end of a period in which searched stories were published
|
32
|
+
attr_accessor :published_at_end
|
33
|
+
|
34
|
+
# The start of a period in which searched stories were published
|
35
|
+
attr_accessor :published_at_start
|
34
36
|
|
35
37
|
# Attribute mapping from ruby-style variable name to JSON key.
|
36
38
|
def self.attribute_map
|
37
39
|
{
|
38
|
-
:'
|
39
|
-
:'interval_start' => :'interval.start',
|
40
|
+
:'field' => :'field',
|
40
41
|
:'interval_end' => :'interval.end',
|
42
|
+
:'interval_start' => :'interval.start',
|
41
43
|
:'interval_width' => :'interval.width',
|
42
|
-
:'
|
44
|
+
:'intervals' => :'intervals',
|
45
|
+
:'published_at_end' => :'published_at.end',
|
46
|
+
:'published_at_start' => :'published_at.start'
|
43
47
|
}
|
44
48
|
end
|
45
49
|
|
46
50
|
# Attribute type mapping.
|
47
|
-
def self.
|
51
|
+
def self.openapi_types
|
48
52
|
{
|
49
|
-
:'
|
50
|
-
:'interval_start' => :'Integer',
|
53
|
+
:'field' => :'String',
|
51
54
|
:'interval_end' => :'Integer',
|
55
|
+
:'interval_start' => :'Integer',
|
52
56
|
:'interval_width' => :'Integer',
|
53
|
-
:'
|
57
|
+
:'intervals' => :'Array<HistogramInterval>',
|
58
|
+
:'published_at_end' => :'DateTime',
|
59
|
+
:'published_at_start' => :'DateTime'
|
54
60
|
}
|
55
61
|
end
|
56
62
|
|
63
|
+
# List of attributes with nullable: true
|
64
|
+
def self.openapi_nullable
|
65
|
+
Set.new([
|
66
|
+
])
|
67
|
+
end
|
68
|
+
|
57
69
|
# Initializes the object
|
58
70
|
# @param [Hash] attributes Model attributes in the form of hash
|
59
71
|
def initialize(attributes = {})
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
72
|
+
if (!attributes.is_a?(Hash))
|
73
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::Histograms` initialize method"
|
74
|
+
end
|
64
75
|
|
65
|
-
if
|
66
|
-
|
67
|
-
|
76
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
77
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
78
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
79
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `AylienNewsApi::Histograms`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
68
80
|
end
|
81
|
+
h[k.to_sym] = v
|
82
|
+
}
|
83
|
+
|
84
|
+
if attributes.key?(:'field')
|
85
|
+
self.field = attributes[:'field']
|
69
86
|
end
|
70
87
|
|
71
|
-
if attributes.
|
72
|
-
self.
|
88
|
+
if attributes.key?(:'interval_end')
|
89
|
+
self.interval_end = attributes[:'interval_end']
|
73
90
|
end
|
74
91
|
|
75
|
-
if attributes.
|
76
|
-
self.
|
92
|
+
if attributes.key?(:'interval_start')
|
93
|
+
self.interval_start = attributes[:'interval_start']
|
77
94
|
end
|
78
95
|
|
79
|
-
if attributes.
|
80
|
-
self.interval_width = attributes[:'
|
96
|
+
if attributes.key?(:'interval_width')
|
97
|
+
self.interval_width = attributes[:'interval_width']
|
81
98
|
end
|
82
99
|
|
83
|
-
if attributes.
|
84
|
-
|
100
|
+
if attributes.key?(:'intervals')
|
101
|
+
if (value = attributes[:'intervals']).is_a?(Array)
|
102
|
+
self.intervals = value
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
if attributes.key?(:'published_at_end')
|
107
|
+
self.published_at_end = attributes[:'published_at_end']
|
85
108
|
end
|
86
109
|
|
110
|
+
if attributes.key?(:'published_at_start')
|
111
|
+
self.published_at_start = attributes[:'published_at_start']
|
112
|
+
end
|
87
113
|
end
|
88
114
|
|
89
115
|
# Show invalid properties with the reasons. Usually used together with valid?
|
90
|
-
# @return Array for valid
|
116
|
+
# @return Array for valid properties with the reasons
|
91
117
|
def list_invalid_properties
|
92
118
|
invalid_properties = Array.new
|
93
|
-
|
119
|
+
invalid_properties
|
94
120
|
end
|
95
121
|
|
96
122
|
# Check to see if the all the properties in the model are valid
|
97
123
|
# @return true if the model is valid
|
98
124
|
def valid?
|
99
|
-
|
125
|
+
true
|
100
126
|
end
|
101
127
|
|
102
128
|
# Checks equality by comparing each attribute.
|
@@ -104,11 +130,13 @@ module AylienNewsApi
|
|
104
130
|
def ==(o)
|
105
131
|
return true if self.equal?(o)
|
106
132
|
self.class == o.class &&
|
107
|
-
|
108
|
-
interval_start == o.interval_start &&
|
133
|
+
field == o.field &&
|
109
134
|
interval_end == o.interval_end &&
|
135
|
+
interval_start == o.interval_start &&
|
110
136
|
interval_width == o.interval_width &&
|
111
|
-
|
137
|
+
intervals == o.intervals &&
|
138
|
+
published_at_end == o.published_at_end &&
|
139
|
+
published_at_start == o.published_at_start
|
112
140
|
end
|
113
141
|
|
114
142
|
# @see the `==` method
|
@@ -118,9 +146,16 @@ module AylienNewsApi
|
|
118
146
|
end
|
119
147
|
|
120
148
|
# Calculates hash code according to all attributes.
|
121
|
-
# @return [
|
149
|
+
# @return [Integer] Hash code
|
122
150
|
def hash
|
123
|
-
[
|
151
|
+
[field, interval_end, interval_start, interval_width, intervals, published_at_end, published_at_start].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)
|
124
159
|
end
|
125
160
|
|
126
161
|
# Builds the object from hash
|
@@ -128,12 +163,12 @@ module AylienNewsApi
|
|
128
163
|
# @return [Object] Returns the model itself
|
129
164
|
def build_from_hash(attributes)
|
130
165
|
return nil unless attributes.is_a?(Hash)
|
131
|
-
self.class.
|
132
|
-
if type =~
|
133
|
-
# check to ensure the input is an array given that the
|
166
|
+
self.class.openapi_types.each_pair do |key, type|
|
167
|
+
if type =~ /\AArray<(.*)>/i
|
168
|
+
# check to ensure the input is an array given that the attribute
|
134
169
|
# is documented as an array but the input is not
|
135
170
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
136
|
-
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) })
|
137
172
|
end
|
138
173
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
139
174
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
@@ -159,8 +194,8 @@ module AylienNewsApi
|
|
159
194
|
value.to_i
|
160
195
|
when :Float
|
161
196
|
value.to_f
|
162
|
-
when :
|
163
|
-
if value.to_s =~
|
197
|
+
when :Boolean
|
198
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
164
199
|
true
|
165
200
|
else
|
166
201
|
false
|
@@ -171,7 +206,7 @@ module AylienNewsApi
|
|
171
206
|
when /\AArray<(?<inner_type>.+)>\z/
|
172
207
|
inner_type = Regexp.last_match[:inner_type]
|
173
208
|
value.map { |v| _deserialize(inner_type, v) }
|
174
|
-
when /\AHash<(?<k_type
|
209
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
175
210
|
k_type = Regexp.last_match[:k_type]
|
176
211
|
v_type = Regexp.last_match[:v_type]
|
177
212
|
{}.tap do |hash|
|
@@ -180,8 +215,7 @@ module AylienNewsApi
|
|
180
215
|
end
|
181
216
|
end
|
182
217
|
else # model
|
183
|
-
|
184
|
-
temp_model.build_from_hash(value)
|
218
|
+
AylienNewsApi.const_get(type).build_from_hash(value)
|
185
219
|
end
|
186
220
|
end
|
187
221
|
|
@@ -203,7 +237,11 @@ module AylienNewsApi
|
|
203
237
|
hash = {}
|
204
238
|
self.class.attribute_map.each_pair do |attr, param|
|
205
239
|
value = self.send(attr)
|
206
|
-
|
240
|
+
if value.nil?
|
241
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
242
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
243
|
+
end
|
244
|
+
|
207
245
|
hash[param] = _to_hash(value)
|
208
246
|
end
|
209
247
|
hash
|
@@ -215,7 +253,7 @@ module AylienNewsApi
|
|
215
253
|
# @return [Hash] Returns the value in the form of hash
|
216
254
|
def _to_hash(value)
|
217
255
|
if value.is_a?(Array)
|
218
|
-
value.compact.map{ |v| _to_hash(v) }
|
256
|
+
value.compact.map { |v| _to_hash(v) }
|
219
257
|
elsif value.is_a?(Hash)
|
220
258
|
{}.tap do |hash|
|
221
259
|
value.each { |k, v| hash[k] = _to_hash(v) }
|
@@ -226,7 +264,5 @@ module AylienNewsApi
|
|
226
264
|
value
|
227
265
|
end
|
228
266
|
end
|
229
|
-
|
230
267
|
end
|
231
|
-
|
232
268
|
end
|
@@ -1,83 +1,91 @@
|
|
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 Location
|
20
|
-
# The
|
17
|
+
# The city of the location
|
18
|
+
attr_accessor :city
|
19
|
+
|
20
|
+
# The country code of the location. It supports [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country codes.
|
21
21
|
attr_accessor :country
|
22
22
|
|
23
23
|
# The state of the location
|
24
24
|
attr_accessor :state
|
25
25
|
|
26
|
-
# The city of the location
|
27
|
-
attr_accessor :city
|
28
|
-
|
29
|
-
|
30
26
|
# Attribute mapping from ruby-style variable name to JSON key.
|
31
27
|
def self.attribute_map
|
32
28
|
{
|
29
|
+
:'city' => :'city',
|
33
30
|
:'country' => :'country',
|
34
|
-
:'state' => :'state'
|
35
|
-
:'city' => :'city'
|
31
|
+
:'state' => :'state'
|
36
32
|
}
|
37
33
|
end
|
38
34
|
|
39
35
|
# Attribute type mapping.
|
40
|
-
def self.
|
36
|
+
def self.openapi_types
|
41
37
|
{
|
38
|
+
:'city' => :'String',
|
42
39
|
:'country' => :'String',
|
43
|
-
:'state' => :'String'
|
44
|
-
:'city' => :'String'
|
40
|
+
:'state' => :'String'
|
45
41
|
}
|
46
42
|
end
|
47
43
|
|
44
|
+
# List of attributes with nullable: true
|
45
|
+
def self.openapi_nullable
|
46
|
+
Set.new([
|
47
|
+
])
|
48
|
+
end
|
49
|
+
|
48
50
|
# Initializes the object
|
49
51
|
# @param [Hash] attributes Model attributes in the form of hash
|
50
52
|
def initialize(attributes = {})
|
51
|
-
|
53
|
+
if (!attributes.is_a?(Hash))
|
54
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::Location` initialize method"
|
55
|
+
end
|
52
56
|
|
53
|
-
# convert string to symbol for hash key
|
54
|
-
attributes = attributes.each_with_object({}){|(k,v), h|
|
57
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
58
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
59
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
60
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `AylienNewsApi::Location`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
61
|
+
end
|
62
|
+
h[k.to_sym] = v
|
63
|
+
}
|
55
64
|
|
56
|
-
if attributes.
|
57
|
-
self.
|
65
|
+
if attributes.key?(:'city')
|
66
|
+
self.city = attributes[:'city']
|
58
67
|
end
|
59
68
|
|
60
|
-
if attributes.
|
61
|
-
self.
|
69
|
+
if attributes.key?(:'country')
|
70
|
+
self.country = attributes[:'country']
|
62
71
|
end
|
63
72
|
|
64
|
-
if attributes.
|
65
|
-
self.
|
73
|
+
if attributes.key?(:'state')
|
74
|
+
self.state = attributes[:'state']
|
66
75
|
end
|
67
|
-
|
68
76
|
end
|
69
77
|
|
70
78
|
# Show invalid properties with the reasons. Usually used together with valid?
|
71
|
-
# @return Array for valid
|
79
|
+
# @return Array for valid properties with the reasons
|
72
80
|
def list_invalid_properties
|
73
81
|
invalid_properties = Array.new
|
74
|
-
|
82
|
+
invalid_properties
|
75
83
|
end
|
76
84
|
|
77
85
|
# Check to see if the all the properties in the model are valid
|
78
86
|
# @return true if the model is valid
|
79
87
|
def valid?
|
80
|
-
|
88
|
+
true
|
81
89
|
end
|
82
90
|
|
83
91
|
# Checks equality by comparing each attribute.
|
@@ -85,9 +93,9 @@ module AylienNewsApi
|
|
85
93
|
def ==(o)
|
86
94
|
return true if self.equal?(o)
|
87
95
|
self.class == o.class &&
|
96
|
+
city == o.city &&
|
88
97
|
country == o.country &&
|
89
|
-
state == o.state
|
90
|
-
city == o.city
|
98
|
+
state == o.state
|
91
99
|
end
|
92
100
|
|
93
101
|
# @see the `==` method
|
@@ -97,9 +105,16 @@ module AylienNewsApi
|
|
97
105
|
end
|
98
106
|
|
99
107
|
# Calculates hash code according to all attributes.
|
100
|
-
# @return [
|
108
|
+
# @return [Integer] Hash code
|
101
109
|
def hash
|
102
|
-
[country, state
|
110
|
+
[city, country, state].hash
|
111
|
+
end
|
112
|
+
|
113
|
+
# Builds the object from hash
|
114
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
115
|
+
# @return [Object] Returns the model itself
|
116
|
+
def self.build_from_hash(attributes)
|
117
|
+
new.build_from_hash(attributes)
|
103
118
|
end
|
104
119
|
|
105
120
|
# Builds the object from hash
|
@@ -107,12 +122,12 @@ module AylienNewsApi
|
|
107
122
|
# @return [Object] Returns the model itself
|
108
123
|
def build_from_hash(attributes)
|
109
124
|
return nil unless attributes.is_a?(Hash)
|
110
|
-
self.class.
|
111
|
-
if type =~
|
112
|
-
# check to ensure the input is an array given that the
|
125
|
+
self.class.openapi_types.each_pair do |key, type|
|
126
|
+
if type =~ /\AArray<(.*)>/i
|
127
|
+
# check to ensure the input is an array given that the attribute
|
113
128
|
# is documented as an array but the input is not
|
114
129
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
115
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) }
|
130
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
116
131
|
end
|
117
132
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
118
133
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
@@ -138,8 +153,8 @@ module AylienNewsApi
|
|
138
153
|
value.to_i
|
139
154
|
when :Float
|
140
155
|
value.to_f
|
141
|
-
when :
|
142
|
-
if value.to_s =~
|
156
|
+
when :Boolean
|
157
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
143
158
|
true
|
144
159
|
else
|
145
160
|
false
|
@@ -150,7 +165,7 @@ module AylienNewsApi
|
|
150
165
|
when /\AArray<(?<inner_type>.+)>\z/
|
151
166
|
inner_type = Regexp.last_match[:inner_type]
|
152
167
|
value.map { |v| _deserialize(inner_type, v) }
|
153
|
-
when /\AHash<(?<k_type
|
168
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
154
169
|
k_type = Regexp.last_match[:k_type]
|
155
170
|
v_type = Regexp.last_match[:v_type]
|
156
171
|
{}.tap do |hash|
|
@@ -159,8 +174,7 @@ module AylienNewsApi
|
|
159
174
|
end
|
160
175
|
end
|
161
176
|
else # model
|
162
|
-
|
163
|
-
temp_model.build_from_hash(value)
|
177
|
+
AylienNewsApi.const_get(type).build_from_hash(value)
|
164
178
|
end
|
165
179
|
end
|
166
180
|
|
@@ -182,7 +196,11 @@ module AylienNewsApi
|
|
182
196
|
hash = {}
|
183
197
|
self.class.attribute_map.each_pair do |attr, param|
|
184
198
|
value = self.send(attr)
|
185
|
-
|
199
|
+
if value.nil?
|
200
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
201
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
202
|
+
end
|
203
|
+
|
186
204
|
hash[param] = _to_hash(value)
|
187
205
|
end
|
188
206
|
hash
|
@@ -194,7 +212,7 @@ module AylienNewsApi
|
|
194
212
|
# @return [Hash] Returns the value in the form of hash
|
195
213
|
def _to_hash(value)
|
196
214
|
if value.is_a?(Array)
|
197
|
-
value.compact.map{ |v| _to_hash(v) }
|
215
|
+
value.compact.map { |v| _to_hash(v) }
|
198
216
|
elsif value.is_a?(Hash)
|
199
217
|
{}.tap do |hash|
|
200
218
|
value.each { |k, v| hash[k] = _to_hash(v) }
|
@@ -205,7 +223,5 @@ module AylienNewsApi
|
|
205
223
|
value
|
206
224
|
end
|
207
225
|
end
|
208
|
-
|
209
226
|
end
|
210
|
-
|
211
227
|
end
|