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
@@ -0,0 +1,229 @@
|
|
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 Clusters
|
17
|
+
# The total number of clusters
|
18
|
+
attr_accessor :cluster_count
|
19
|
+
|
20
|
+
# An array of clusters
|
21
|
+
attr_accessor :clusters
|
22
|
+
|
23
|
+
# The next page cursor
|
24
|
+
attr_accessor :next_page_cursor
|
25
|
+
|
26
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
27
|
+
def self.attribute_map
|
28
|
+
{
|
29
|
+
:'cluster_count' => :'cluster_count',
|
30
|
+
:'clusters' => :'clusters',
|
31
|
+
:'next_page_cursor' => :'next_page_cursor'
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
# Attribute type mapping.
|
36
|
+
def self.openapi_types
|
37
|
+
{
|
38
|
+
:'cluster_count' => :'Integer',
|
39
|
+
:'clusters' => :'Array<Cluster>',
|
40
|
+
:'next_page_cursor' => :'String'
|
41
|
+
}
|
42
|
+
end
|
43
|
+
|
44
|
+
# List of attributes with nullable: true
|
45
|
+
def self.openapi_nullable
|
46
|
+
Set.new([
|
47
|
+
])
|
48
|
+
end
|
49
|
+
|
50
|
+
# Initializes the object
|
51
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
52
|
+
def initialize(attributes = {})
|
53
|
+
if (!attributes.is_a?(Hash))
|
54
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::Clusters` initialize method"
|
55
|
+
end
|
56
|
+
|
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::Clusters`. 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?(:'cluster_count')
|
66
|
+
self.cluster_count = attributes[:'cluster_count']
|
67
|
+
end
|
68
|
+
|
69
|
+
if attributes.key?(:'clusters')
|
70
|
+
if (value = attributes[:'clusters']).is_a?(Array)
|
71
|
+
self.clusters = value
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
if attributes.key?(:'next_page_cursor')
|
76
|
+
self.next_page_cursor = attributes[:'next_page_cursor']
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
81
|
+
# @return Array for valid properties with the reasons
|
82
|
+
def list_invalid_properties
|
83
|
+
invalid_properties = Array.new
|
84
|
+
invalid_properties
|
85
|
+
end
|
86
|
+
|
87
|
+
# Check to see if the all the properties in the model are valid
|
88
|
+
# @return true if the model is valid
|
89
|
+
def valid?
|
90
|
+
true
|
91
|
+
end
|
92
|
+
|
93
|
+
# Checks equality by comparing each attribute.
|
94
|
+
# @param [Object] Object to be compared
|
95
|
+
def ==(o)
|
96
|
+
return true if self.equal?(o)
|
97
|
+
self.class == o.class &&
|
98
|
+
cluster_count == o.cluster_count &&
|
99
|
+
clusters == o.clusters &&
|
100
|
+
next_page_cursor == o.next_page_cursor
|
101
|
+
end
|
102
|
+
|
103
|
+
# @see the `==` method
|
104
|
+
# @param [Object] Object to be compared
|
105
|
+
def eql?(o)
|
106
|
+
self == o
|
107
|
+
end
|
108
|
+
|
109
|
+
# Calculates hash code according to all attributes.
|
110
|
+
# @return [Integer] Hash code
|
111
|
+
def hash
|
112
|
+
[cluster_count, clusters, next_page_cursor].hash
|
113
|
+
end
|
114
|
+
|
115
|
+
# Builds the object from hash
|
116
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
117
|
+
# @return [Object] Returns the model itself
|
118
|
+
def self.build_from_hash(attributes)
|
119
|
+
new.build_from_hash(attributes)
|
120
|
+
end
|
121
|
+
|
122
|
+
# Builds the object from hash
|
123
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
124
|
+
# @return [Object] Returns the model itself
|
125
|
+
def build_from_hash(attributes)
|
126
|
+
return nil unless attributes.is_a?(Hash)
|
127
|
+
self.class.openapi_types.each_pair do |key, type|
|
128
|
+
if type =~ /\AArray<(.*)>/i
|
129
|
+
# check to ensure the input is an array given that the attribute
|
130
|
+
# is documented as an array but the input is not
|
131
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
132
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
133
|
+
end
|
134
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
135
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
136
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
137
|
+
end
|
138
|
+
|
139
|
+
self
|
140
|
+
end
|
141
|
+
|
142
|
+
# Deserializes the data based on type
|
143
|
+
# @param string type Data type
|
144
|
+
# @param string value Value to be deserialized
|
145
|
+
# @return [Object] Deserialized data
|
146
|
+
def _deserialize(type, value)
|
147
|
+
case type.to_sym
|
148
|
+
when :DateTime
|
149
|
+
DateTime.parse(value)
|
150
|
+
when :Date
|
151
|
+
Date.parse(value)
|
152
|
+
when :String
|
153
|
+
value.to_s
|
154
|
+
when :Integer
|
155
|
+
value.to_i
|
156
|
+
when :Float
|
157
|
+
value.to_f
|
158
|
+
when :Boolean
|
159
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
160
|
+
true
|
161
|
+
else
|
162
|
+
false
|
163
|
+
end
|
164
|
+
when :Object
|
165
|
+
# generic object (usually a Hash), return directly
|
166
|
+
value
|
167
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
168
|
+
inner_type = Regexp.last_match[:inner_type]
|
169
|
+
value.map { |v| _deserialize(inner_type, v) }
|
170
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
171
|
+
k_type = Regexp.last_match[:k_type]
|
172
|
+
v_type = Regexp.last_match[:v_type]
|
173
|
+
{}.tap do |hash|
|
174
|
+
value.each do |k, v|
|
175
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
176
|
+
end
|
177
|
+
end
|
178
|
+
else # model
|
179
|
+
AylienNewsApi.const_get(type).build_from_hash(value)
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
# Returns the string representation of the object
|
184
|
+
# @return [String] String presentation of the object
|
185
|
+
def to_s
|
186
|
+
to_hash.to_s
|
187
|
+
end
|
188
|
+
|
189
|
+
# to_body is an alias to to_hash (backward compatibility)
|
190
|
+
# @return [Hash] Returns the object in the form of hash
|
191
|
+
def to_body
|
192
|
+
to_hash
|
193
|
+
end
|
194
|
+
|
195
|
+
# Returns the object in the form of hash
|
196
|
+
# @return [Hash] Returns the object in the form of hash
|
197
|
+
def to_hash
|
198
|
+
hash = {}
|
199
|
+
self.class.attribute_map.each_pair do |attr, param|
|
200
|
+
value = self.send(attr)
|
201
|
+
if value.nil?
|
202
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
203
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
204
|
+
end
|
205
|
+
|
206
|
+
hash[param] = _to_hash(value)
|
207
|
+
end
|
208
|
+
hash
|
209
|
+
end
|
210
|
+
|
211
|
+
# Outputs non-array value in the form of hash
|
212
|
+
# For object, use to_hash. Otherwise, just return the value
|
213
|
+
# @param [Object] value Any valid value
|
214
|
+
# @return [Hash] Returns the value in the form of hash
|
215
|
+
def _to_hash(value)
|
216
|
+
if value.is_a?(Array)
|
217
|
+
value.compact.map { |v| _to_hash(v) }
|
218
|
+
elsif value.is_a?(Hash)
|
219
|
+
{}.tap do |hash|
|
220
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
221
|
+
end
|
222
|
+
elsif value.respond_to? :to_hash
|
223
|
+
value.to_hash
|
224
|
+
else
|
225
|
+
value
|
226
|
+
end
|
227
|
+
end
|
228
|
+
end
|
229
|
+
end
|
@@ -1,114 +1,111 @@
|
|
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: 4.2.1-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
14
12
|
|
15
13
|
require 'date'
|
16
14
|
|
17
15
|
module AylienNewsApi
|
18
|
-
|
19
16
|
class Coverages
|
20
|
-
#
|
21
|
-
attr_accessor :
|
17
|
+
# An array of coverages for the input story
|
18
|
+
attr_accessor :coverages
|
22
19
|
|
23
20
|
# The input story body
|
24
21
|
attr_accessor :story_body
|
25
22
|
|
26
|
-
# The input story published date
|
27
|
-
attr_accessor :story_published_at
|
28
|
-
|
29
23
|
# The input story language
|
30
24
|
attr_accessor :story_language
|
31
25
|
|
32
|
-
#
|
33
|
-
attr_accessor :
|
34
|
-
|
35
|
-
# An array of clusters
|
36
|
-
attr_accessor :clusters
|
26
|
+
# The input story published date
|
27
|
+
attr_accessor :story_published_at
|
37
28
|
|
29
|
+
# The input story title
|
30
|
+
attr_accessor :story_title
|
38
31
|
|
39
32
|
# Attribute mapping from ruby-style variable name to JSON key.
|
40
33
|
def self.attribute_map
|
41
34
|
{
|
42
|
-
:'
|
35
|
+
:'coverages' => :'coverages',
|
43
36
|
:'story_body' => :'story_body',
|
44
|
-
:'story_published_at' => :'story_published_at',
|
45
37
|
:'story_language' => :'story_language',
|
46
|
-
:'
|
47
|
-
:'
|
38
|
+
:'story_published_at' => :'story_published_at',
|
39
|
+
:'story_title' => :'story_title'
|
48
40
|
}
|
49
41
|
end
|
50
42
|
|
51
43
|
# Attribute type mapping.
|
52
|
-
def self.
|
44
|
+
def self.openapi_types
|
53
45
|
{
|
54
|
-
:'
|
46
|
+
:'coverages' => :'Array<Story>',
|
55
47
|
:'story_body' => :'String',
|
56
|
-
:'story_published_at' => :'DateTime',
|
57
48
|
:'story_language' => :'String',
|
58
|
-
:'
|
59
|
-
:'
|
49
|
+
:'story_published_at' => :'DateTime',
|
50
|
+
:'story_title' => :'String'
|
60
51
|
}
|
61
52
|
end
|
62
53
|
|
54
|
+
# List of attributes with nullable: true
|
55
|
+
def self.openapi_nullable
|
56
|
+
Set.new([
|
57
|
+
])
|
58
|
+
end
|
59
|
+
|
63
60
|
# Initializes the object
|
64
61
|
# @param [Hash] attributes Model attributes in the form of hash
|
65
62
|
def initialize(attributes = {})
|
66
|
-
|
63
|
+
if (!attributes.is_a?(Hash))
|
64
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::Coverages` initialize method"
|
65
|
+
end
|
67
66
|
|
68
|
-
# convert string to symbol for hash key
|
69
|
-
attributes = attributes.each_with_object({}){|(k,v), h|
|
67
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
68
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
69
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
70
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `AylienNewsApi::Coverages`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
71
|
+
end
|
72
|
+
h[k.to_sym] = v
|
73
|
+
}
|
70
74
|
|
71
|
-
if attributes.
|
72
|
-
|
75
|
+
if attributes.key?(:'coverages')
|
76
|
+
if (value = attributes[:'coverages']).is_a?(Array)
|
77
|
+
self.coverages = value
|
78
|
+
end
|
73
79
|
end
|
74
80
|
|
75
|
-
if attributes.
|
81
|
+
if attributes.key?(:'story_body')
|
76
82
|
self.story_body = attributes[:'story_body']
|
77
83
|
end
|
78
84
|
|
79
|
-
if attributes.
|
80
|
-
self.story_published_at = attributes[:'story_published_at']
|
81
|
-
end
|
82
|
-
|
83
|
-
if attributes.has_key?(:'story_language')
|
85
|
+
if attributes.key?(:'story_language')
|
84
86
|
self.story_language = attributes[:'story_language']
|
85
87
|
end
|
86
88
|
|
87
|
-
if attributes.
|
88
|
-
|
89
|
-
self.coverages = value
|
90
|
-
end
|
89
|
+
if attributes.key?(:'story_published_at')
|
90
|
+
self.story_published_at = attributes[:'story_published_at']
|
91
91
|
end
|
92
92
|
|
93
|
-
if attributes.
|
94
|
-
|
95
|
-
self.clusters = value
|
96
|
-
end
|
93
|
+
if attributes.key?(:'story_title')
|
94
|
+
self.story_title = attributes[:'story_title']
|
97
95
|
end
|
98
|
-
|
99
96
|
end
|
100
97
|
|
101
98
|
# Show invalid properties with the reasons. Usually used together with valid?
|
102
|
-
# @return Array for valid
|
99
|
+
# @return Array for valid properties with the reasons
|
103
100
|
def list_invalid_properties
|
104
101
|
invalid_properties = Array.new
|
105
|
-
|
102
|
+
invalid_properties
|
106
103
|
end
|
107
104
|
|
108
105
|
# Check to see if the all the properties in the model are valid
|
109
106
|
# @return true if the model is valid
|
110
107
|
def valid?
|
111
|
-
|
108
|
+
true
|
112
109
|
end
|
113
110
|
|
114
111
|
# Checks equality by comparing each attribute.
|
@@ -116,12 +113,11 @@ module AylienNewsApi
|
|
116
113
|
def ==(o)
|
117
114
|
return true if self.equal?(o)
|
118
115
|
self.class == o.class &&
|
119
|
-
|
116
|
+
coverages == o.coverages &&
|
120
117
|
story_body == o.story_body &&
|
121
|
-
story_published_at == o.story_published_at &&
|
122
118
|
story_language == o.story_language &&
|
123
|
-
|
124
|
-
|
119
|
+
story_published_at == o.story_published_at &&
|
120
|
+
story_title == o.story_title
|
125
121
|
end
|
126
122
|
|
127
123
|
# @see the `==` method
|
@@ -131,9 +127,16 @@ module AylienNewsApi
|
|
131
127
|
end
|
132
128
|
|
133
129
|
# Calculates hash code according to all attributes.
|
134
|
-
# @return [
|
130
|
+
# @return [Integer] Hash code
|
135
131
|
def hash
|
136
|
-
[
|
132
|
+
[coverages, story_body, story_language, story_published_at, story_title].hash
|
133
|
+
end
|
134
|
+
|
135
|
+
# Builds the object from hash
|
136
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
137
|
+
# @return [Object] Returns the model itself
|
138
|
+
def self.build_from_hash(attributes)
|
139
|
+
new.build_from_hash(attributes)
|
137
140
|
end
|
138
141
|
|
139
142
|
# Builds the object from hash
|
@@ -141,12 +144,12 @@ module AylienNewsApi
|
|
141
144
|
# @return [Object] Returns the model itself
|
142
145
|
def build_from_hash(attributes)
|
143
146
|
return nil unless attributes.is_a?(Hash)
|
144
|
-
self.class.
|
145
|
-
if type =~
|
146
|
-
# check to ensure the input is an array given that the
|
147
|
+
self.class.openapi_types.each_pair do |key, type|
|
148
|
+
if type =~ /\AArray<(.*)>/i
|
149
|
+
# check to ensure the input is an array given that the attribute
|
147
150
|
# is documented as an array but the input is not
|
148
151
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
149
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) }
|
152
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
150
153
|
end
|
151
154
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
152
155
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
@@ -172,8 +175,8 @@ module AylienNewsApi
|
|
172
175
|
value.to_i
|
173
176
|
when :Float
|
174
177
|
value.to_f
|
175
|
-
when :
|
176
|
-
if value.to_s =~
|
178
|
+
when :Boolean
|
179
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
177
180
|
true
|
178
181
|
else
|
179
182
|
false
|
@@ -184,7 +187,7 @@ module AylienNewsApi
|
|
184
187
|
when /\AArray<(?<inner_type>.+)>\z/
|
185
188
|
inner_type = Regexp.last_match[:inner_type]
|
186
189
|
value.map { |v| _deserialize(inner_type, v) }
|
187
|
-
when /\AHash<(?<k_type
|
190
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
188
191
|
k_type = Regexp.last_match[:k_type]
|
189
192
|
v_type = Regexp.last_match[:v_type]
|
190
193
|
{}.tap do |hash|
|
@@ -193,8 +196,7 @@ module AylienNewsApi
|
|
193
196
|
end
|
194
197
|
end
|
195
198
|
else # model
|
196
|
-
|
197
|
-
temp_model.build_from_hash(value)
|
199
|
+
AylienNewsApi.const_get(type).build_from_hash(value)
|
198
200
|
end
|
199
201
|
end
|
200
202
|
|
@@ -216,7 +218,11 @@ module AylienNewsApi
|
|
216
218
|
hash = {}
|
217
219
|
self.class.attribute_map.each_pair do |attr, param|
|
218
220
|
value = self.send(attr)
|
219
|
-
|
221
|
+
if value.nil?
|
222
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
223
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
224
|
+
end
|
225
|
+
|
220
226
|
hash[param] = _to_hash(value)
|
221
227
|
end
|
222
228
|
hash
|
@@ -228,7 +234,7 @@ module AylienNewsApi
|
|
228
234
|
# @return [Hash] Returns the value in the form of hash
|
229
235
|
def _to_hash(value)
|
230
236
|
if value.is_a?(Array)
|
231
|
-
value.compact.map{ |v| _to_hash(v) }
|
237
|
+
value.compact.map { |v| _to_hash(v) }
|
232
238
|
elsif value.is_a?(Hash)
|
233
239
|
{}.tap do |hash|
|
234
240
|
value.each { |k, v| hash[k] = _to_hash(v) }
|
@@ -239,7 +245,5 @@ module AylienNewsApi
|
|
239
245
|
value
|
240
246
|
end
|
241
247
|
end
|
242
|
-
|
243
248
|
end
|
244
|
-
|
245
249
|
end
|