aylien_news_api 0.4.0 → 4.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/Gemfile +7 -1
- data/README.md +117 -4
- data/Rakefile +10 -0
- data/aylien_news_api.gemspec +20 -28
- 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 +1299 -826
- data/docs/Entities.md +11 -1
- data/docs/Entity.md +16 -3
- data/docs/EntityLinks.md +9 -0
- data/docs/Error.md +16 -2
- data/docs/ErrorLinks.md +11 -0
- data/docs/Errors.md +9 -0
- data/docs/HistogramInterval.md +10 -0
- data/docs/Histograms.md +20 -3
- data/docs/Location.md +13 -2
- data/docs/Media.md +18 -4
- data/docs/MediaFormat.md +16 -0
- data/docs/MediaType.md +16 -0
- data/docs/Rank.md +12 -1
- data/docs/Rankings.md +9 -0
- data/docs/RelatedStories.md +18 -3
- data/docs/RepresentativeStory.md +23 -0
- data/docs/Scope.md +15 -3
- data/docs/ScopeLevel.md +16 -0
- data/docs/Sentiment.md +11 -1
- data/docs/SentimentPolarity.md +16 -0
- data/docs/Sentiments.md +12 -2
- data/docs/ShareCount.md +10 -0
- data/docs/ShareCounts.md +12 -0
- data/docs/Source.md +27 -8
- data/docs/Stories.md +17 -2
- data/docs/Story.md +48 -16
- data/docs/StoryCluster.md +14 -1
- data/docs/StoryLinks.md +14 -1
- data/docs/StoryTranslation.md +19 -0
- data/docs/StoryTranslations.md +17 -0
- data/docs/StoryTranslationsEn.md +21 -0
- data/docs/Summary.md +9 -0
- data/docs/TimeSeries.md +11 -1
- data/docs/TimeSeriesList.md +15 -3
- data/docs/Trend.md +11 -1
- data/docs/Trends.md +15 -1
- data/docs/Warning.md +21 -0
- data/git_push.sh +58 -0
- data/lib/aylien_news_api.rb +22 -14
- data/lib/aylien_news_api/api/default_api.rb +2407 -1520
- data/lib/aylien_news_api/api_client.rb +137 -111
- data/lib/aylien_news_api/api_error.rb +37 -18
- data/lib/aylien_news_api/configuration.rb +74 -36
- data/lib/aylien_news_api/models/author.rb +66 -50
- data/lib/aylien_news_api/models/autocomplete.rb +52 -36
- data/lib/aylien_news_api/models/autocompletes.rb +51 -35
- data/lib/aylien_news_api/models/category.rb +85 -94
- data/lib/aylien_news_api/models/category_links.rb +63 -47
- 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 +76 -72
- data/lib/aylien_news_api/models/entities.rb +64 -48
- data/lib/aylien_news_api/models/entity.rb +93 -79
- data/lib/aylien_news_api/models/entity_links.rb +51 -35
- data/lib/aylien_news_api/models/error.rb +76 -60
- data/lib/aylien_news_api/models/error_links.rb +62 -37
- data/lib/aylien_news_api/models/errors.rb +51 -35
- data/lib/aylien_news_api/models/histogram_interval.rb +52 -36
- data/lib/aylien_news_api/models/histograms.rb +96 -60
- data/lib/aylien_news_api/models/location.rb +67 -51
- data/lib/aylien_news_api/models/media.rb +83 -114
- 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 +64 -48
- data/lib/aylien_news_api/models/rankings.rb +51 -35
- data/lib/aylien_news_api/models/related_stories.rb +84 -60
- data/lib/aylien_news_api/models/representative_story.rb +237 -0
- data/lib/aylien_news_api/models/scope.rb +73 -91
- data/lib/aylien_news_api/models/scope_level.rb +37 -0
- data/lib/aylien_news_api/models/sentiment.rb +63 -82
- data/lib/aylien_news_api/models/sentiment_polarity.rb +37 -0
- data/lib/aylien_news_api/models/sentiments.rb +62 -48
- data/lib/aylien_news_api/models/share_count.rb +52 -36
- data/lib/aylien_news_api/models/share_counts.rb +54 -38
- data/lib/aylien_news_api/models/source.rb +111 -96
- data/lib/aylien_news_api/models/stories.rb +86 -50
- data/lib/aylien_news_api/models/story.rb +188 -158
- data/lib/aylien_news_api/models/story_cluster.rb +68 -52
- data/lib/aylien_news_api/models/story_links.rb +70 -44
- 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 +51 -35
- data/lib/aylien_news_api/models/time_series.rb +63 -47
- data/lib/aylien_news_api/models/time_series_list.rb +72 -56
- data/lib/aylien_news_api/models/trend.rb +63 -47
- data/lib/aylien_news_api/models/trends.rb +77 -41
- data/lib/aylien_news_api/models/warning.rb +226 -0
- data/lib/aylien_news_api/version.rb +12 -14
- data/spec/api/default_api_spec.rb +620 -284
- data/spec/api_client_spec.rb +43 -161
- data/spec/configuration_spec.rb +22 -19
- data/spec/models/author_spec.rb +21 -34
- data/spec/models/autocomplete_spec.rb +17 -26
- data/spec/models/autocompletes_spec.rb +16 -21
- data/spec/models/category_links_spec.rb +19 -28
- data/spec/models/category_spec.rb +31 -50
- data/spec/models/category_taxonomy_spec.rb +35 -0
- data/spec/models/cluster_spec.rb +77 -0
- data/spec/models/clusters_spec.rb +53 -0
- data/spec/models/coverages_spec.rb +24 -45
- data/spec/models/entities_spec.rb +19 -28
- data/spec/models/entity_links_spec.rb +16 -21
- data/spec/models/entity_spec.rb +25 -46
- data/spec/models/error_links_spec.rb +22 -21
- data/spec/models/error_spec.rb +27 -52
- data/spec/models/errors_spec.rb +16 -21
- data/spec/models/histogram_interval_spec.rb +17 -26
- data/spec/models/histograms_spec.rb +36 -45
- data/spec/models/location_spec.rb +21 -34
- data/spec/models/media_format_spec.rb +35 -0
- data/spec/models/media_spec.rb +41 -26
- data/spec/models/media_type_spec.rb +35 -0
- data/spec/models/rank_spec.rb +20 -21
- data/spec/models/rankings_spec.rb +15 -16
- data/spec/models/related_stories_spec.rb +33 -38
- data/spec/models/representative_story_spec.rb +59 -0
- data/spec/models/scope_level_spec.rb +35 -0
- data/spec/models/scope_spec.rb +23 -40
- data/spec/models/sentiment_polarity_spec.rb +35 -0
- data/spec/models/sentiment_spec.rb +17 -26
- data/spec/models/sentiments_spec.rb +19 -28
- data/spec/models/share_count_spec.rb +17 -26
- data/spec/models/share_counts_spec.rb +19 -36
- data/spec/models/source_spec.rb +54 -49
- data/spec/models/stories_spec.rb +32 -33
- data/spec/models/story_cluster_spec.rb +23 -44
- data/spec/models/story_links_spec.rb +25 -32
- data/spec/models/story_spec.rb +65 -134
- data/spec/models/story_translation_spec.rb +47 -0
- data/spec/models/story_translations_en_spec.rb +53 -0
- data/spec/models/story_translations_spec.rb +41 -0
- data/spec/models/summary_spec.rb +16 -21
- data/spec/models/time_series_list_spec.rb +22 -39
- data/spec/models/time_series_spec.rb +19 -28
- data/spec/models/trend_spec.rb +19 -28
- data/spec/models/trends_spec.rb +30 -27
- data/spec/models/warning_spec.rb +53 -0
- data/spec/spec_helper.rb +11 -13
- metadata +91 -192
- data/Gemfile.lock +0 -65
- data/LICENSE +0 -13
- data/aylien_news_api-0.2.0.gem +0 -0
- data/aylien_news_api-0.3.0.gem +0 -0
@@ -0,0 +1,44 @@
|
|
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
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module AylienNewsApi
|
16
|
+
class MediaFormat
|
17
|
+
BMP = "BMP".freeze
|
18
|
+
GIF = "GIF".freeze
|
19
|
+
JPEG = "JPEG".freeze
|
20
|
+
PNG = "PNG".freeze
|
21
|
+
TIFF = "TIFF".freeze
|
22
|
+
PSD = "PSD".freeze
|
23
|
+
ICO = "ICO".freeze
|
24
|
+
CUR = "CUR".freeze
|
25
|
+
WEBP = "WEBP".freeze
|
26
|
+
SVG = "SVG".freeze
|
27
|
+
|
28
|
+
# Builds the enum from string
|
29
|
+
# @param [String] The enum value in the form of the string
|
30
|
+
# @return [String] The enum value
|
31
|
+
def self.build_from_hash(value)
|
32
|
+
new.build_from_hash(value)
|
33
|
+
end
|
34
|
+
|
35
|
+
# Builds the enum from string
|
36
|
+
# @param [String] The enum value in the form of the string
|
37
|
+
# @return [String] The enum value
|
38
|
+
def build_from_hash(value)
|
39
|
+
constantValues = MediaFormat.constants.select { |c| MediaFormat::const_get(c) == value }
|
40
|
+
raise "Invalid ENUM value #{value} for class #MediaFormat" if constantValues.empty?
|
41
|
+
value
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,36 @@
|
|
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
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module AylienNewsApi
|
16
|
+
class MediaType
|
17
|
+
IMAGE = "image".freeze
|
18
|
+
VIDEO = "video".freeze
|
19
|
+
|
20
|
+
# Builds the enum from string
|
21
|
+
# @param [String] The enum value in the form of the string
|
22
|
+
# @return [String] The enum value
|
23
|
+
def self.build_from_hash(value)
|
24
|
+
new.build_from_hash(value)
|
25
|
+
end
|
26
|
+
|
27
|
+
# Builds the enum from string
|
28
|
+
# @param [String] The enum value in the form of the string
|
29
|
+
# @return [String] The enum value
|
30
|
+
def build_from_hash(value)
|
31
|
+
constantValues = MediaType.constants.select { |c| MediaType::const_get(c) == value }
|
32
|
+
raise "Invalid ENUM value #{value} for class #MediaType" if constantValues.empty?
|
33
|
+
value
|
34
|
+
end
|
35
|
+
end
|
36
|
+
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 Rank
|
20
|
-
# The rank
|
21
|
-
attr_accessor :rank
|
22
|
-
|
23
17
|
# The country code which the rank is in it
|
24
18
|
attr_accessor :country
|
25
19
|
|
26
20
|
# The fetched date of the rank
|
27
21
|
attr_accessor :fetched_at
|
28
22
|
|
23
|
+
# The rank
|
24
|
+
attr_accessor :rank
|
29
25
|
|
30
26
|
# Attribute mapping from ruby-style variable name to JSON key.
|
31
27
|
def self.attribute_map
|
32
28
|
{
|
33
|
-
:'rank' => :'rank',
|
34
29
|
:'country' => :'country',
|
35
|
-
:'fetched_at' => :'fetched_at'
|
30
|
+
:'fetched_at' => :'fetched_at',
|
31
|
+
:'rank' => :'rank'
|
36
32
|
}
|
37
33
|
end
|
38
34
|
|
39
35
|
# Attribute type mapping.
|
40
|
-
def self.
|
36
|
+
def self.openapi_types
|
41
37
|
{
|
42
|
-
:'rank' => :'Integer',
|
43
38
|
:'country' => :'String',
|
44
|
-
:'fetched_at' => :'DateTime'
|
39
|
+
:'fetched_at' => :'DateTime',
|
40
|
+
:'rank' => :'Integer'
|
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
|
-
|
52
|
-
|
53
|
-
# convert string to symbol for hash key
|
54
|
-
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
55
|
-
|
56
|
-
if attributes.has_key?(:'rank')
|
57
|
-
self.rank = attributes[:'rank']
|
53
|
+
if (!attributes.is_a?(Hash))
|
54
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::Rank` initialize method"
|
58
55
|
end
|
59
56
|
|
60
|
-
if
|
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::Rank`. 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
|
+
}
|
64
|
+
|
65
|
+
if attributes.key?(:'country')
|
61
66
|
self.country = attributes[:'country']
|
62
67
|
end
|
63
68
|
|
64
|
-
if attributes.
|
69
|
+
if attributes.key?(:'fetched_at')
|
65
70
|
self.fetched_at = attributes[:'fetched_at']
|
66
71
|
end
|
67
72
|
|
73
|
+
if attributes.key?(:'rank')
|
74
|
+
self.rank = attributes[:'rank']
|
75
|
+
end
|
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 &&
|
88
|
-
rank == o.rank &&
|
89
96
|
country == o.country &&
|
90
|
-
fetched_at == o.fetched_at
|
97
|
+
fetched_at == o.fetched_at &&
|
98
|
+
rank == o.rank
|
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
|
-
[
|
110
|
+
[country, fetched_at, rank].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.
|
125
|
+
self.class.openapi_types.each_pair do |key, type|
|
111
126
|
if type =~ /\AArray<(.*)>/i
|
112
|
-
# check to ensure the input is an array given that the
|
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,7 +153,7 @@ module AylienNewsApi
|
|
138
153
|
value.to_i
|
139
154
|
when :Float
|
140
155
|
value.to_f
|
141
|
-
when :
|
156
|
+
when :Boolean
|
142
157
|
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
143
158
|
true
|
144
159
|
else
|
@@ -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
|
@@ -1,25 +1,21 @@
|
|
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 Rankings
|
20
17
|
attr_accessor :alexa
|
21
18
|
|
22
|
-
|
23
19
|
# Attribute mapping from ruby-style variable name to JSON key.
|
24
20
|
def self.attribute_map
|
25
21
|
{
|
@@ -28,39 +24,51 @@ module AylienNewsApi
|
|
28
24
|
end
|
29
25
|
|
30
26
|
# Attribute type mapping.
|
31
|
-
def self.
|
27
|
+
def self.openapi_types
|
32
28
|
{
|
33
29
|
:'alexa' => :'Array<Rank>'
|
34
30
|
}
|
35
31
|
end
|
36
32
|
|
33
|
+
# List of attributes with nullable: true
|
34
|
+
def self.openapi_nullable
|
35
|
+
Set.new([
|
36
|
+
])
|
37
|
+
end
|
38
|
+
|
37
39
|
# Initializes the object
|
38
40
|
# @param [Hash] attributes Model attributes in the form of hash
|
39
41
|
def initialize(attributes = {})
|
40
|
-
|
42
|
+
if (!attributes.is_a?(Hash))
|
43
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::Rankings` initialize method"
|
44
|
+
end
|
41
45
|
|
42
|
-
# convert string to symbol for hash key
|
43
|
-
attributes = attributes.each_with_object({}){|(k,v), h|
|
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::Rankings`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
50
|
+
end
|
51
|
+
h[k.to_sym] = v
|
52
|
+
}
|
44
53
|
|
45
|
-
if attributes.
|
54
|
+
if attributes.key?(:'alexa')
|
46
55
|
if (value = attributes[:'alexa']).is_a?(Array)
|
47
56
|
self.alexa = value
|
48
57
|
end
|
49
58
|
end
|
50
|
-
|
51
59
|
end
|
52
60
|
|
53
61
|
# Show invalid properties with the reasons. Usually used together with valid?
|
54
|
-
# @return Array for valid
|
62
|
+
# @return Array for valid properties with the reasons
|
55
63
|
def list_invalid_properties
|
56
64
|
invalid_properties = Array.new
|
57
|
-
|
65
|
+
invalid_properties
|
58
66
|
end
|
59
67
|
|
60
68
|
# Check to see if the all the properties in the model are valid
|
61
69
|
# @return true if the model is valid
|
62
70
|
def valid?
|
63
|
-
|
71
|
+
true
|
64
72
|
end
|
65
73
|
|
66
74
|
# Checks equality by comparing each attribute.
|
@@ -78,22 +86,29 @@ module AylienNewsApi
|
|
78
86
|
end
|
79
87
|
|
80
88
|
# Calculates hash code according to all attributes.
|
81
|
-
# @return [
|
89
|
+
# @return [Integer] Hash code
|
82
90
|
def hash
|
83
91
|
[alexa].hash
|
84
92
|
end
|
85
93
|
|
94
|
+
# Builds the object from hash
|
95
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
96
|
+
# @return [Object] Returns the model itself
|
97
|
+
def self.build_from_hash(attributes)
|
98
|
+
new.build_from_hash(attributes)
|
99
|
+
end
|
100
|
+
|
86
101
|
# Builds the object from hash
|
87
102
|
# @param [Hash] attributes Model attributes in the form of hash
|
88
103
|
# @return [Object] Returns the model itself
|
89
104
|
def build_from_hash(attributes)
|
90
105
|
return nil unless attributes.is_a?(Hash)
|
91
|
-
self.class.
|
106
|
+
self.class.openapi_types.each_pair do |key, type|
|
92
107
|
if type =~ /\AArray<(.*)>/i
|
93
|
-
# check to ensure the input is an array given that the
|
108
|
+
# check to ensure the input is an array given that the attribute
|
94
109
|
# is documented as an array but the input is not
|
95
110
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
96
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) }
|
111
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
97
112
|
end
|
98
113
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
99
114
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
@@ -119,7 +134,7 @@ module AylienNewsApi
|
|
119
134
|
value.to_i
|
120
135
|
when :Float
|
121
136
|
value.to_f
|
122
|
-
when :
|
137
|
+
when :Boolean
|
123
138
|
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
124
139
|
true
|
125
140
|
else
|
@@ -140,8 +155,7 @@ module AylienNewsApi
|
|
140
155
|
end
|
141
156
|
end
|
142
157
|
else # model
|
143
|
-
|
144
|
-
temp_model.build_from_hash(value)
|
158
|
+
AylienNewsApi.const_get(type).build_from_hash(value)
|
145
159
|
end
|
146
160
|
end
|
147
161
|
|
@@ -163,7 +177,11 @@ module AylienNewsApi
|
|
163
177
|
hash = {}
|
164
178
|
self.class.attribute_map.each_pair do |attr, param|
|
165
179
|
value = self.send(attr)
|
166
|
-
|
180
|
+
if value.nil?
|
181
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
182
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
183
|
+
end
|
184
|
+
|
167
185
|
hash[param] = _to_hash(value)
|
168
186
|
end
|
169
187
|
hash
|
@@ -175,7 +193,7 @@ module AylienNewsApi
|
|
175
193
|
# @return [Hash] Returns the value in the form of hash
|
176
194
|
def _to_hash(value)
|
177
195
|
if value.is_a?(Array)
|
178
|
-
value.compact.map{ |v| _to_hash(v) }
|
196
|
+
value.compact.map { |v| _to_hash(v) }
|
179
197
|
elsif value.is_a?(Hash)
|
180
198
|
{}.tap do |hash|
|
181
199
|
value.each { |k, v| hash[k] = _to_hash(v) }
|
@@ -186,7 +204,5 @@ module AylienNewsApi
|
|
186
204
|
value
|
187
205
|
end
|
188
206
|
end
|
189
|
-
|
190
207
|
end
|
191
|
-
|
192
208
|
end
|