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
@@ -1,85 +1,85 @@
|
|
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 Location
|
22
|
-
# 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.
|
23
21
|
attr_accessor :country
|
24
22
|
|
25
23
|
# The state of the location
|
26
24
|
attr_accessor :state
|
27
25
|
|
28
|
-
# The city of the location
|
29
|
-
attr_accessor :city
|
30
|
-
|
31
|
-
|
32
26
|
# Attribute mapping from ruby-style variable name to JSON key.
|
33
27
|
def self.attribute_map
|
34
28
|
{
|
29
|
+
:'city' => :'city',
|
35
30
|
:'country' => :'country',
|
36
|
-
:'state' => :'state'
|
37
|
-
:'city' => :'city'
|
31
|
+
:'state' => :'state'
|
38
32
|
}
|
39
33
|
end
|
40
34
|
|
41
35
|
# Attribute type mapping.
|
42
|
-
def self.
|
36
|
+
def self.openapi_types
|
43
37
|
{
|
38
|
+
:'city' => :'String',
|
44
39
|
:'country' => :'String',
|
45
|
-
:'state' => :'String'
|
46
|
-
:'city' => :'String'
|
40
|
+
:'state' => :'String'
|
47
41
|
}
|
48
42
|
end
|
49
43
|
|
50
44
|
# Initializes the object
|
51
45
|
# @param [Hash] attributes Model attributes in the form of hash
|
52
46
|
def initialize(attributes = {})
|
53
|
-
|
47
|
+
if (!attributes.is_a?(Hash))
|
48
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::Location` initialize method"
|
49
|
+
end
|
54
50
|
|
55
|
-
# convert string to symbol for hash key
|
56
|
-
attributes = attributes.each_with_object({}){|(k,v), h|
|
51
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
52
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
53
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
54
|
+
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
|
55
|
+
end
|
56
|
+
h[k.to_sym] = v
|
57
|
+
}
|
57
58
|
|
58
|
-
if attributes.
|
59
|
-
self.
|
59
|
+
if attributes.key?(:'city')
|
60
|
+
self.city = attributes[:'city']
|
60
61
|
end
|
61
62
|
|
62
|
-
if attributes.
|
63
|
-
self.
|
63
|
+
if attributes.key?(:'country')
|
64
|
+
self.country = attributes[:'country']
|
64
65
|
end
|
65
66
|
|
66
|
-
if attributes.
|
67
|
-
self.
|
67
|
+
if attributes.key?(:'state')
|
68
|
+
self.state = attributes[:'state']
|
68
69
|
end
|
69
|
-
|
70
70
|
end
|
71
71
|
|
72
72
|
# Show invalid properties with the reasons. Usually used together with valid?
|
73
|
-
# @return Array for valid
|
73
|
+
# @return Array for valid properties with the reasons
|
74
74
|
def list_invalid_properties
|
75
75
|
invalid_properties = Array.new
|
76
|
-
|
76
|
+
invalid_properties
|
77
77
|
end
|
78
78
|
|
79
79
|
# Check to see if the all the properties in the model are valid
|
80
80
|
# @return true if the model is valid
|
81
81
|
def valid?
|
82
|
-
|
82
|
+
true
|
83
83
|
end
|
84
84
|
|
85
85
|
# Checks equality by comparing each attribute.
|
@@ -87,9 +87,9 @@ module AylienNewsApi
|
|
87
87
|
def ==(o)
|
88
88
|
return true if self.equal?(o)
|
89
89
|
self.class == o.class &&
|
90
|
+
city == o.city &&
|
90
91
|
country == o.country &&
|
91
|
-
state == o.state
|
92
|
-
city == o.city
|
92
|
+
state == o.state
|
93
93
|
end
|
94
94
|
|
95
95
|
# @see the `==` method
|
@@ -99,9 +99,16 @@ module AylienNewsApi
|
|
99
99
|
end
|
100
100
|
|
101
101
|
# Calculates hash code according to all attributes.
|
102
|
-
# @return [
|
102
|
+
# @return [Integer] Hash code
|
103
103
|
def hash
|
104
|
-
[country, state
|
104
|
+
[city, country, state].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)
|
105
112
|
end
|
106
113
|
|
107
114
|
# Builds the object from hash
|
@@ -109,12 +116,12 @@ module AylienNewsApi
|
|
109
116
|
# @return [Object] Returns the model itself
|
110
117
|
def build_from_hash(attributes)
|
111
118
|
return nil unless attributes.is_a?(Hash)
|
112
|
-
self.class.
|
119
|
+
self.class.openapi_types.each_pair do |key, type|
|
113
120
|
if type =~ /\AArray<(.*)>/i
|
114
|
-
# check to ensure the input is an array given that the
|
121
|
+
# check to ensure the input is an array given that the attribute
|
115
122
|
# is documented as an array but the input is not
|
116
123
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
117
|
-
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) })
|
118
125
|
end
|
119
126
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
120
127
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
@@ -140,7 +147,7 @@ module AylienNewsApi
|
|
140
147
|
value.to_i
|
141
148
|
when :Float
|
142
149
|
value.to_f
|
143
|
-
when :
|
150
|
+
when :Boolean
|
144
151
|
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
145
152
|
true
|
146
153
|
else
|
@@ -161,8 +168,7 @@ module AylienNewsApi
|
|
161
168
|
end
|
162
169
|
end
|
163
170
|
else # model
|
164
|
-
|
165
|
-
temp_model.build_from_hash(value)
|
171
|
+
AylienNewsApi.const_get(type).build_from_hash(value)
|
166
172
|
end
|
167
173
|
end
|
168
174
|
|
@@ -196,7 +202,7 @@ module AylienNewsApi
|
|
196
202
|
# @return [Hash] Returns the value in the form of hash
|
197
203
|
def _to_hash(value)
|
198
204
|
if value.is_a?(Array)
|
199
|
-
value.compact.map{ |v| _to_hash(v) }
|
205
|
+
value.compact.map { |v| _to_hash(v) }
|
200
206
|
elsif value.is_a?(Hash)
|
201
207
|
{}.tap do |hash|
|
202
208
|
value.each { |k, v| hash[k] = _to_hash(v) }
|
@@ -207,7 +213,5 @@ module AylienNewsApi
|
|
207
213
|
value
|
208
214
|
end
|
209
215
|
end
|
210
|
-
|
211
216
|
end
|
212
|
-
|
213
217
|
end
|
@@ -1,42 +1,37 @@
|
|
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 Media
|
17
|
+
# The content length of media
|
18
|
+
attr_accessor :content_length
|
19
|
+
|
20
|
+
# The format of media
|
21
|
+
attr_accessor :format
|
22
|
+
|
23
|
+
# The height of media
|
24
|
+
attr_accessor :height
|
25
|
+
|
22
26
|
# The type of media
|
23
27
|
attr_accessor :type
|
24
28
|
|
25
29
|
# A URL which points to the media file
|
26
30
|
attr_accessor :url
|
27
31
|
|
28
|
-
# The format of media
|
29
|
-
attr_accessor :format
|
30
|
-
|
31
|
-
# The content length of media
|
32
|
-
attr_accessor :content_length
|
33
|
-
|
34
32
|
# The width of media
|
35
33
|
attr_accessor :width
|
36
34
|
|
37
|
-
# The height of media
|
38
|
-
attr_accessor :height
|
39
|
-
|
40
35
|
class EnumAttributeValidator
|
41
36
|
attr_reader :datatype
|
42
37
|
attr_reader :allowable_values
|
@@ -62,86 +57,82 @@ module AylienNewsApi
|
|
62
57
|
# Attribute mapping from ruby-style variable name to JSON key.
|
63
58
|
def self.attribute_map
|
64
59
|
{
|
60
|
+
:'content_length' => :'content_length',
|
61
|
+
:'format' => :'format',
|
62
|
+
:'height' => :'height',
|
65
63
|
:'type' => :'type',
|
66
64
|
:'url' => :'url',
|
67
|
-
:'
|
68
|
-
:'content_length' => :'content_length',
|
69
|
-
:'width' => :'width',
|
70
|
-
:'height' => :'height'
|
65
|
+
:'width' => :'width'
|
71
66
|
}
|
72
67
|
end
|
73
68
|
|
74
69
|
# Attribute type mapping.
|
75
|
-
def self.
|
70
|
+
def self.openapi_types
|
76
71
|
{
|
72
|
+
:'content_length' => :'Integer',
|
73
|
+
:'format' => :'String',
|
74
|
+
:'height' => :'Integer',
|
77
75
|
:'type' => :'String',
|
78
76
|
:'url' => :'String',
|
79
|
-
:'
|
80
|
-
:'content_length' => :'Integer',
|
81
|
-
:'width' => :'Integer',
|
82
|
-
:'height' => :'Integer'
|
77
|
+
:'width' => :'Integer'
|
83
78
|
}
|
84
79
|
end
|
85
80
|
|
86
81
|
# Initializes the object
|
87
82
|
# @param [Hash] attributes Model attributes in the form of hash
|
88
83
|
def initialize(attributes = {})
|
89
|
-
|
90
|
-
|
91
|
-
# convert string to symbol for hash key
|
92
|
-
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
93
|
-
|
94
|
-
if attributes.has_key?(:'type')
|
95
|
-
self.type = attributes[:'type']
|
84
|
+
if (!attributes.is_a?(Hash))
|
85
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::Media` initialize method"
|
96
86
|
end
|
97
87
|
|
98
|
-
if
|
99
|
-
|
88
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
89
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
90
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
91
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `AylienNewsApi::Media`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
92
|
+
end
|
93
|
+
h[k.to_sym] = v
|
94
|
+
}
|
95
|
+
|
96
|
+
if attributes.key?(:'content_length')
|
97
|
+
self.content_length = attributes[:'content_length']
|
100
98
|
end
|
101
99
|
|
102
|
-
if attributes.
|
100
|
+
if attributes.key?(:'format')
|
103
101
|
self.format = attributes[:'format']
|
104
102
|
end
|
105
103
|
|
106
|
-
if attributes.
|
107
|
-
self.
|
104
|
+
if attributes.key?(:'height')
|
105
|
+
self.height = attributes[:'height']
|
108
106
|
end
|
109
107
|
|
110
|
-
if attributes.
|
111
|
-
self.
|
108
|
+
if attributes.key?(:'type')
|
109
|
+
self.type = attributes[:'type']
|
112
110
|
end
|
113
111
|
|
114
|
-
if attributes.
|
115
|
-
self.
|
112
|
+
if attributes.key?(:'url')
|
113
|
+
self.url = attributes[:'url']
|
116
114
|
end
|
117
115
|
|
116
|
+
if attributes.key?(:'width')
|
117
|
+
self.width = attributes[:'width']
|
118
|
+
end
|
118
119
|
end
|
119
120
|
|
120
121
|
# Show invalid properties with the reasons. Usually used together with valid?
|
121
|
-
# @return Array for valid
|
122
|
+
# @return Array for valid properties with the reasons
|
122
123
|
def list_invalid_properties
|
123
124
|
invalid_properties = Array.new
|
124
|
-
|
125
|
+
invalid_properties
|
125
126
|
end
|
126
127
|
|
127
128
|
# Check to see if the all the properties in the model are valid
|
128
129
|
# @return true if the model is valid
|
129
130
|
def valid?
|
130
|
-
type_validator = EnumAttributeValidator.new('String', ["image", "video"])
|
131
|
-
return false unless type_validator.valid?(@type)
|
132
131
|
format_validator = EnumAttributeValidator.new('String', ["BMP", "GIF", "JPEG", "PNG", "TIFF", "PSD", "ICO", "CUR", "WEBP", "SVG"])
|
133
132
|
return false unless format_validator.valid?(@format)
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
# Custom attribute writer method checking allowed values (enum).
|
138
|
-
# @param [Object] type Object to be assigned
|
139
|
-
def type=(type)
|
140
|
-
validator = EnumAttributeValidator.new('String', ["image", "video"])
|
141
|
-
unless validator.valid?(type)
|
142
|
-
fail ArgumentError, "invalid value for 'type', must be one of #{validator.allowable_values}."
|
143
|
-
end
|
144
|
-
@type = type
|
133
|
+
type_validator = EnumAttributeValidator.new('String', ["image", "video"])
|
134
|
+
return false unless type_validator.valid?(@type)
|
135
|
+
true
|
145
136
|
end
|
146
137
|
|
147
138
|
# Custom attribute writer method checking allowed values (enum).
|
@@ -149,22 +140,32 @@ module AylienNewsApi
|
|
149
140
|
def format=(format)
|
150
141
|
validator = EnumAttributeValidator.new('String', ["BMP", "GIF", "JPEG", "PNG", "TIFF", "PSD", "ICO", "CUR", "WEBP", "SVG"])
|
151
142
|
unless validator.valid?(format)
|
152
|
-
fail ArgumentError, "invalid value for
|
143
|
+
fail ArgumentError, "invalid value for \"format\", must be one of #{validator.allowable_values}."
|
153
144
|
end
|
154
145
|
@format = format
|
155
146
|
end
|
156
147
|
|
148
|
+
# Custom attribute writer method checking allowed values (enum).
|
149
|
+
# @param [Object] type Object to be assigned
|
150
|
+
def type=(type)
|
151
|
+
validator = EnumAttributeValidator.new('String', ["image", "video"])
|
152
|
+
unless validator.valid?(type)
|
153
|
+
fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
|
154
|
+
end
|
155
|
+
@type = type
|
156
|
+
end
|
157
|
+
|
157
158
|
# Checks equality by comparing each attribute.
|
158
159
|
# @param [Object] Object to be compared
|
159
160
|
def ==(o)
|
160
161
|
return true if self.equal?(o)
|
161
162
|
self.class == o.class &&
|
163
|
+
content_length == o.content_length &&
|
164
|
+
format == o.format &&
|
165
|
+
height == o.height &&
|
162
166
|
type == o.type &&
|
163
167
|
url == o.url &&
|
164
|
-
|
165
|
-
content_length == o.content_length &&
|
166
|
-
width == o.width &&
|
167
|
-
height == o.height
|
168
|
+
width == o.width
|
168
169
|
end
|
169
170
|
|
170
171
|
# @see the `==` method
|
@@ -174,9 +175,16 @@ module AylienNewsApi
|
|
174
175
|
end
|
175
176
|
|
176
177
|
# Calculates hash code according to all attributes.
|
177
|
-
# @return [
|
178
|
+
# @return [Integer] Hash code
|
178
179
|
def hash
|
179
|
-
[
|
180
|
+
[content_length, format, height, type, url, width].hash
|
181
|
+
end
|
182
|
+
|
183
|
+
# Builds the object from hash
|
184
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
185
|
+
# @return [Object] Returns the model itself
|
186
|
+
def self.build_from_hash(attributes)
|
187
|
+
new.build_from_hash(attributes)
|
180
188
|
end
|
181
189
|
|
182
190
|
# Builds the object from hash
|
@@ -184,12 +192,12 @@ module AylienNewsApi
|
|
184
192
|
# @return [Object] Returns the model itself
|
185
193
|
def build_from_hash(attributes)
|
186
194
|
return nil unless attributes.is_a?(Hash)
|
187
|
-
self.class.
|
195
|
+
self.class.openapi_types.each_pair do |key, type|
|
188
196
|
if type =~ /\AArray<(.*)>/i
|
189
|
-
# check to ensure the input is an array given that the
|
197
|
+
# check to ensure the input is an array given that the attribute
|
190
198
|
# is documented as an array but the input is not
|
191
199
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
192
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) }
|
200
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
193
201
|
end
|
194
202
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
195
203
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
@@ -215,7 +223,7 @@ module AylienNewsApi
|
|
215
223
|
value.to_i
|
216
224
|
when :Float
|
217
225
|
value.to_f
|
218
|
-
when :
|
226
|
+
when :Boolean
|
219
227
|
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
220
228
|
true
|
221
229
|
else
|
@@ -236,8 +244,7 @@ module AylienNewsApi
|
|
236
244
|
end
|
237
245
|
end
|
238
246
|
else # model
|
239
|
-
|
240
|
-
temp_model.build_from_hash(value)
|
247
|
+
AylienNewsApi.const_get(type).build_from_hash(value)
|
241
248
|
end
|
242
249
|
end
|
243
250
|
|
@@ -271,7 +278,7 @@ module AylienNewsApi
|
|
271
278
|
# @return [Hash] Returns the value in the form of hash
|
272
279
|
def _to_hash(value)
|
273
280
|
if value.is_a?(Array)
|
274
|
-
value.compact.map{ |v| _to_hash(v) }
|
281
|
+
value.compact.map { |v| _to_hash(v) }
|
275
282
|
elsif value.is_a?(Hash)
|
276
283
|
{}.tap do |hash|
|
277
284
|
value.each { |k, v| hash[k] = _to_hash(v) }
|
@@ -282,7 +289,5 @@ module AylienNewsApi
|
|
282
289
|
value
|
283
290
|
end
|
284
291
|
end
|
285
|
-
|
286
292
|
end
|
287
|
-
|
288
293
|
end
|