aylien_news_api 0.3.0 → 4.1.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 +117 -4
- data/Rakefile +10 -0
- data/aylien_news_api.gemspec +24 -31
- 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 -636
- 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 +19 -1
- 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 +2631 -1120
- data/lib/aylien_news_api/api_client.rb +139 -105
- data/lib/aylien_news_api/api_error.rb +37 -18
- data/lib/aylien_news_api/configuration.rb +80 -42
- 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 +96 -83
- 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 +65 -40
- 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 +67 -51
- data/lib/aylien_news_api/models/rankings.rb +54 -38
- data/lib/aylien_news_api/models/related_stories.rb +87 -63
- 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 +66 -86
- 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 +114 -99
- data/lib/aylien_news_api/models/stories.rb +89 -53
- 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/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 +92 -195
- data/Gemfile.lock +0 -65
- data/LICENSE +0 -13
- data/aylien_news_api-0.2.0.gem +0 -0
@@ -1,87 +1,113 @@
|
|
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 Stories
|
17
|
+
# The next page cursor
|
18
|
+
attr_accessor :next_page_cursor
|
19
|
+
|
20
20
|
# An array of stories
|
21
21
|
attr_accessor :stories
|
22
22
|
|
23
|
-
#
|
24
|
-
attr_accessor :
|
23
|
+
# The end of a period in which searched stories were published
|
24
|
+
attr_accessor :published_at_end
|
25
25
|
|
26
|
-
# The
|
27
|
-
attr_accessor :
|
26
|
+
# The start of a period in which searched stories were published
|
27
|
+
attr_accessor :published_at_start
|
28
28
|
|
29
|
+
# Notifies about possible issues that occurred when searching for stories
|
30
|
+
attr_accessor :warnings
|
29
31
|
|
30
32
|
# Attribute mapping from ruby-style variable name to JSON key.
|
31
33
|
def self.attribute_map
|
32
34
|
{
|
35
|
+
:'next_page_cursor' => :'next_page_cursor',
|
33
36
|
:'stories' => :'stories',
|
34
|
-
:'
|
35
|
-
:'
|
37
|
+
:'published_at_end' => :'published_at.end',
|
38
|
+
:'published_at_start' => :'published_at.start',
|
39
|
+
:'warnings' => :'warnings'
|
36
40
|
}
|
37
41
|
end
|
38
42
|
|
39
43
|
# Attribute type mapping.
|
40
|
-
def self.
|
44
|
+
def self.openapi_types
|
41
45
|
{
|
46
|
+
:'next_page_cursor' => :'String',
|
42
47
|
:'stories' => :'Array<Story>',
|
43
|
-
:'
|
44
|
-
:'
|
48
|
+
:'published_at_end' => :'DateTime',
|
49
|
+
:'published_at_start' => :'DateTime',
|
50
|
+
:'warnings' => :'Array<Warning>'
|
45
51
|
}
|
46
52
|
end
|
47
53
|
|
54
|
+
# List of attributes with nullable: true
|
55
|
+
def self.openapi_nullable
|
56
|
+
Set.new([
|
57
|
+
])
|
58
|
+
end
|
59
|
+
|
48
60
|
# Initializes the object
|
49
61
|
# @param [Hash] attributes Model attributes in the form of hash
|
50
62
|
def initialize(attributes = {})
|
51
|
-
|
63
|
+
if (!attributes.is_a?(Hash))
|
64
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::Stories` initialize method"
|
65
|
+
end
|
52
66
|
|
53
|
-
# convert string to symbol for hash key
|
54
|
-
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::Stories`. 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
|
+
}
|
55
74
|
|
56
|
-
if attributes.
|
75
|
+
if attributes.key?(:'next_page_cursor')
|
76
|
+
self.next_page_cursor = attributes[:'next_page_cursor']
|
77
|
+
end
|
78
|
+
|
79
|
+
if attributes.key?(:'stories')
|
57
80
|
if (value = attributes[:'stories']).is_a?(Array)
|
58
81
|
self.stories = value
|
59
82
|
end
|
60
83
|
end
|
61
84
|
|
62
|
-
if attributes.
|
63
|
-
|
64
|
-
self.clusters = value
|
65
|
-
end
|
85
|
+
if attributes.key?(:'published_at_end')
|
86
|
+
self.published_at_end = attributes[:'published_at_end']
|
66
87
|
end
|
67
88
|
|
68
|
-
if attributes.
|
69
|
-
self.
|
89
|
+
if attributes.key?(:'published_at_start')
|
90
|
+
self.published_at_start = attributes[:'published_at_start']
|
70
91
|
end
|
71
92
|
|
93
|
+
if attributes.key?(:'warnings')
|
94
|
+
if (value = attributes[:'warnings']).is_a?(Array)
|
95
|
+
self.warnings = value
|
96
|
+
end
|
97
|
+
end
|
72
98
|
end
|
73
99
|
|
74
100
|
# Show invalid properties with the reasons. Usually used together with valid?
|
75
|
-
# @return Array for valid
|
101
|
+
# @return Array for valid properties with the reasons
|
76
102
|
def list_invalid_properties
|
77
103
|
invalid_properties = Array.new
|
78
|
-
|
104
|
+
invalid_properties
|
79
105
|
end
|
80
106
|
|
81
107
|
# Check to see if the all the properties in the model are valid
|
82
108
|
# @return true if the model is valid
|
83
109
|
def valid?
|
84
|
-
|
110
|
+
true
|
85
111
|
end
|
86
112
|
|
87
113
|
# Checks equality by comparing each attribute.
|
@@ -89,9 +115,11 @@ module AylienNewsApi
|
|
89
115
|
def ==(o)
|
90
116
|
return true if self.equal?(o)
|
91
117
|
self.class == o.class &&
|
118
|
+
next_page_cursor == o.next_page_cursor &&
|
92
119
|
stories == o.stories &&
|
93
|
-
|
94
|
-
|
120
|
+
published_at_end == o.published_at_end &&
|
121
|
+
published_at_start == o.published_at_start &&
|
122
|
+
warnings == o.warnings
|
95
123
|
end
|
96
124
|
|
97
125
|
# @see the `==` method
|
@@ -101,9 +129,16 @@ module AylienNewsApi
|
|
101
129
|
end
|
102
130
|
|
103
131
|
# Calculates hash code according to all attributes.
|
104
|
-
# @return [
|
132
|
+
# @return [Integer] Hash code
|
105
133
|
def hash
|
106
|
-
[stories,
|
134
|
+
[next_page_cursor, stories, published_at_end, published_at_start, warnings].hash
|
135
|
+
end
|
136
|
+
|
137
|
+
# Builds the object from hash
|
138
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
139
|
+
# @return [Object] Returns the model itself
|
140
|
+
def self.build_from_hash(attributes)
|
141
|
+
new.build_from_hash(attributes)
|
107
142
|
end
|
108
143
|
|
109
144
|
# Builds the object from hash
|
@@ -111,12 +146,12 @@ module AylienNewsApi
|
|
111
146
|
# @return [Object] Returns the model itself
|
112
147
|
def build_from_hash(attributes)
|
113
148
|
return nil unless attributes.is_a?(Hash)
|
114
|
-
self.class.
|
115
|
-
if type =~
|
116
|
-
# check to ensure the input is an array given that the
|
149
|
+
self.class.openapi_types.each_pair do |key, type|
|
150
|
+
if type =~ /\AArray<(.*)>/i
|
151
|
+
# check to ensure the input is an array given that the attribute
|
117
152
|
# is documented as an array but the input is not
|
118
153
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
119
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) }
|
154
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
120
155
|
end
|
121
156
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
122
157
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
@@ -142,8 +177,8 @@ module AylienNewsApi
|
|
142
177
|
value.to_i
|
143
178
|
when :Float
|
144
179
|
value.to_f
|
145
|
-
when :
|
146
|
-
if value.to_s =~
|
180
|
+
when :Boolean
|
181
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
147
182
|
true
|
148
183
|
else
|
149
184
|
false
|
@@ -154,7 +189,7 @@ module AylienNewsApi
|
|
154
189
|
when /\AArray<(?<inner_type>.+)>\z/
|
155
190
|
inner_type = Regexp.last_match[:inner_type]
|
156
191
|
value.map { |v| _deserialize(inner_type, v) }
|
157
|
-
when /\AHash<(?<k_type
|
192
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
158
193
|
k_type = Regexp.last_match[:k_type]
|
159
194
|
v_type = Regexp.last_match[:v_type]
|
160
195
|
{}.tap do |hash|
|
@@ -163,8 +198,7 @@ module AylienNewsApi
|
|
163
198
|
end
|
164
199
|
end
|
165
200
|
else # model
|
166
|
-
|
167
|
-
temp_model.build_from_hash(value)
|
201
|
+
AylienNewsApi.const_get(type).build_from_hash(value)
|
168
202
|
end
|
169
203
|
end
|
170
204
|
|
@@ -186,7 +220,11 @@ module AylienNewsApi
|
|
186
220
|
hash = {}
|
187
221
|
self.class.attribute_map.each_pair do |attr, param|
|
188
222
|
value = self.send(attr)
|
189
|
-
|
223
|
+
if value.nil?
|
224
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
225
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
226
|
+
end
|
227
|
+
|
190
228
|
hash[param] = _to_hash(value)
|
191
229
|
end
|
192
230
|
hash
|
@@ -198,7 +236,7 @@ module AylienNewsApi
|
|
198
236
|
# @return [Hash] Returns the value in the form of hash
|
199
237
|
def _to_hash(value)
|
200
238
|
if value.is_a?(Array)
|
201
|
-
value.compact.map{ |v| _to_hash(v) }
|
239
|
+
value.compact.map { |v| _to_hash(v) }
|
202
240
|
elsif value.is_a?(Hash)
|
203
241
|
{}.tap do |hash|
|
204
242
|
value.each { |k, v| hash[k] = _to_hash(v) }
|
@@ -209,7 +247,5 @@ module AylienNewsApi
|
|
209
247
|
value
|
210
248
|
end
|
211
249
|
end
|
212
|
-
|
213
250
|
end
|
214
|
-
|
215
251
|
end
|
@@ -1,244 +1,264 @@
|
|
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 Story
|
20
|
-
|
21
|
-
attr_accessor :id
|
22
|
-
|
23
|
-
# Title of the story
|
24
|
-
attr_accessor :title
|
17
|
+
attr_accessor :author
|
25
18
|
|
26
19
|
# Body of the story
|
27
20
|
attr_accessor :body
|
28
21
|
|
29
|
-
#
|
30
|
-
attr_accessor :
|
22
|
+
# Suggested categories for the story
|
23
|
+
attr_accessor :categories
|
31
24
|
|
32
|
-
#
|
33
|
-
attr_accessor :
|
25
|
+
# Character count of the story body
|
26
|
+
attr_accessor :characters_count
|
34
27
|
|
35
|
-
#
|
36
|
-
attr_accessor :
|
28
|
+
# An array of clusters the story is associated with
|
29
|
+
attr_accessor :clusters
|
37
30
|
|
38
|
-
# Extracted entities from the story title or body
|
39
31
|
attr_accessor :entities
|
40
32
|
|
41
|
-
# Extracted keywords mentioned in the story title or body
|
42
|
-
attr_accessor :keywords
|
43
|
-
|
44
33
|
# An array of suggested Story hashtags
|
45
34
|
attr_accessor :hashtags
|
46
35
|
|
47
|
-
#
|
48
|
-
attr_accessor :
|
36
|
+
# ID of the story which is a unique identification
|
37
|
+
attr_accessor :id
|
49
38
|
|
50
|
-
#
|
51
|
-
attr_accessor :
|
39
|
+
# Extracted keywords mentioned in the story title or body
|
40
|
+
attr_accessor :keywords
|
52
41
|
|
53
|
-
#
|
54
|
-
attr_accessor :
|
42
|
+
# Language of the story
|
43
|
+
attr_accessor :language
|
44
|
+
|
45
|
+
attr_accessor :links
|
46
|
+
|
47
|
+
# An array of extracted media such as images and videos
|
48
|
+
attr_accessor :media
|
55
49
|
|
56
50
|
# Paragraph count of the story body
|
57
51
|
attr_accessor :paragraphs_count
|
58
52
|
|
59
|
-
#
|
60
|
-
attr_accessor :
|
61
|
-
|
62
|
-
# Social shares count for the story
|
63
|
-
attr_accessor :social_shares_count
|
53
|
+
# Published date of the story
|
54
|
+
attr_accessor :published_at
|
64
55
|
|
65
|
-
#
|
66
|
-
attr_accessor :
|
56
|
+
# Sentence count of the story body
|
57
|
+
attr_accessor :sentences_count
|
67
58
|
|
68
|
-
# Suggested sentiments for the story title or body
|
69
59
|
attr_accessor :sentiment
|
70
60
|
|
71
|
-
|
72
|
-
attr_accessor :language
|
61
|
+
attr_accessor :social_shares_count
|
73
62
|
|
74
|
-
|
75
|
-
attr_accessor :published_at
|
63
|
+
attr_accessor :source
|
76
64
|
|
77
|
-
|
78
|
-
attr_accessor :links
|
65
|
+
attr_accessor :summary
|
79
66
|
|
67
|
+
# Title of the story
|
68
|
+
attr_accessor :title
|
69
|
+
|
70
|
+
attr_accessor :translations
|
71
|
+
|
72
|
+
# Word count of the story body
|
73
|
+
attr_accessor :words_count
|
80
74
|
|
81
75
|
# Attribute mapping from ruby-style variable name to JSON key.
|
82
76
|
def self.attribute_map
|
83
77
|
{
|
84
|
-
:'id' => :'id',
|
85
|
-
:'title' => :'title',
|
86
|
-
:'body' => :'body',
|
87
|
-
:'summary' => :'summary',
|
88
|
-
:'source' => :'source',
|
89
78
|
:'author' => :'author',
|
79
|
+
:'body' => :'body',
|
80
|
+
:'categories' => :'categories',
|
81
|
+
:'characters_count' => :'characters_count',
|
82
|
+
:'clusters' => :'clusters',
|
90
83
|
:'entities' => :'entities',
|
91
|
-
:'keywords' => :'keywords',
|
92
84
|
:'hashtags' => :'hashtags',
|
93
|
-
:'
|
94
|
-
:'
|
95
|
-
:'sentences_count' => :'sentences_count',
|
96
|
-
:'paragraphs_count' => :'paragraphs_count',
|
97
|
-
:'categories' => :'categories',
|
98
|
-
:'social_shares_count' => :'social_shares_count',
|
99
|
-
:'media' => :'media',
|
100
|
-
:'sentiment' => :'sentiment',
|
85
|
+
:'id' => :'id',
|
86
|
+
:'keywords' => :'keywords',
|
101
87
|
:'language' => :'language',
|
88
|
+
:'links' => :'links',
|
89
|
+
:'media' => :'media',
|
90
|
+
:'paragraphs_count' => :'paragraphs_count',
|
102
91
|
:'published_at' => :'published_at',
|
103
|
-
:'
|
92
|
+
:'sentences_count' => :'sentences_count',
|
93
|
+
:'sentiment' => :'sentiment',
|
94
|
+
:'social_shares_count' => :'social_shares_count',
|
95
|
+
:'source' => :'source',
|
96
|
+
:'summary' => :'summary',
|
97
|
+
:'title' => :'title',
|
98
|
+
:'translations' => :'translations',
|
99
|
+
:'words_count' => :'words_count'
|
104
100
|
}
|
105
101
|
end
|
106
102
|
|
107
103
|
# Attribute type mapping.
|
108
|
-
def self.
|
104
|
+
def self.openapi_types
|
109
105
|
{
|
110
|
-
:'id' => :'Integer',
|
111
|
-
:'title' => :'String',
|
112
|
-
:'body' => :'String',
|
113
|
-
:'summary' => :'Summary',
|
114
|
-
:'source' => :'Source',
|
115
106
|
:'author' => :'Author',
|
107
|
+
:'body' => :'String',
|
108
|
+
:'categories' => :'Array<Category>',
|
109
|
+
:'characters_count' => :'Integer',
|
110
|
+
:'clusters' => :'Array<Integer>',
|
116
111
|
:'entities' => :'Entities',
|
117
|
-
:'keywords' => :'Array<String>',
|
118
112
|
:'hashtags' => :'Array<String>',
|
119
|
-
:'
|
120
|
-
:'
|
121
|
-
:'sentences_count' => :'Integer',
|
122
|
-
:'paragraphs_count' => :'Integer',
|
123
|
-
:'categories' => :'Array<Category>',
|
124
|
-
:'social_shares_count' => :'ShareCounts',
|
125
|
-
:'media' => :'Array<Media>',
|
126
|
-
:'sentiment' => :'Sentiments',
|
113
|
+
:'id' => :'Integer',
|
114
|
+
:'keywords' => :'Array<String>',
|
127
115
|
:'language' => :'String',
|
116
|
+
:'links' => :'StoryLinks',
|
117
|
+
:'media' => :'Array<Media>',
|
118
|
+
:'paragraphs_count' => :'Integer',
|
128
119
|
:'published_at' => :'DateTime',
|
129
|
-
:'
|
120
|
+
:'sentences_count' => :'Integer',
|
121
|
+
:'sentiment' => :'Sentiments',
|
122
|
+
:'social_shares_count' => :'ShareCounts',
|
123
|
+
:'source' => :'Source',
|
124
|
+
:'summary' => :'Summary',
|
125
|
+
:'title' => :'String',
|
126
|
+
:'translations' => :'StoryTranslations',
|
127
|
+
:'words_count' => :'Integer'
|
130
128
|
}
|
131
129
|
end
|
132
130
|
|
131
|
+
# List of attributes with nullable: true
|
132
|
+
def self.openapi_nullable
|
133
|
+
Set.new([
|
134
|
+
])
|
135
|
+
end
|
136
|
+
|
133
137
|
# Initializes the object
|
134
138
|
# @param [Hash] attributes Model attributes in the form of hash
|
135
139
|
def initialize(attributes = {})
|
136
|
-
|
137
|
-
|
138
|
-
# convert string to symbol for hash key
|
139
|
-
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
140
|
-
|
141
|
-
if attributes.has_key?(:'id')
|
142
|
-
self.id = attributes[:'id']
|
140
|
+
if (!attributes.is_a?(Hash))
|
141
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::Story` initialize method"
|
143
142
|
end
|
144
143
|
|
145
|
-
if
|
146
|
-
|
144
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
145
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
146
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
147
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `AylienNewsApi::Story`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
148
|
+
end
|
149
|
+
h[k.to_sym] = v
|
150
|
+
}
|
151
|
+
|
152
|
+
if attributes.key?(:'author')
|
153
|
+
self.author = attributes[:'author']
|
147
154
|
end
|
148
155
|
|
149
|
-
if attributes.
|
156
|
+
if attributes.key?(:'body')
|
150
157
|
self.body = attributes[:'body']
|
151
158
|
end
|
152
159
|
|
153
|
-
if attributes.
|
154
|
-
|
160
|
+
if attributes.key?(:'categories')
|
161
|
+
if (value = attributes[:'categories']).is_a?(Array)
|
162
|
+
self.categories = value
|
163
|
+
end
|
155
164
|
end
|
156
165
|
|
157
|
-
if attributes.
|
158
|
-
self.
|
166
|
+
if attributes.key?(:'characters_count')
|
167
|
+
self.characters_count = attributes[:'characters_count']
|
159
168
|
end
|
160
169
|
|
161
|
-
if attributes.
|
162
|
-
|
170
|
+
if attributes.key?(:'clusters')
|
171
|
+
if (value = attributes[:'clusters']).is_a?(Array)
|
172
|
+
self.clusters = value
|
173
|
+
end
|
163
174
|
end
|
164
175
|
|
165
|
-
if attributes.
|
176
|
+
if attributes.key?(:'entities')
|
166
177
|
self.entities = attributes[:'entities']
|
167
178
|
end
|
168
179
|
|
169
|
-
if attributes.
|
170
|
-
if (value = attributes[:'keywords']).is_a?(Array)
|
171
|
-
self.keywords = value
|
172
|
-
end
|
173
|
-
end
|
174
|
-
|
175
|
-
if attributes.has_key?(:'hashtags')
|
180
|
+
if attributes.key?(:'hashtags')
|
176
181
|
if (value = attributes[:'hashtags']).is_a?(Array)
|
177
182
|
self.hashtags = value
|
178
183
|
end
|
179
184
|
end
|
180
185
|
|
181
|
-
if attributes.
|
182
|
-
self.
|
186
|
+
if attributes.key?(:'id')
|
187
|
+
self.id = attributes[:'id']
|
183
188
|
end
|
184
189
|
|
185
|
-
if attributes.
|
186
|
-
|
190
|
+
if attributes.key?(:'keywords')
|
191
|
+
if (value = attributes[:'keywords']).is_a?(Array)
|
192
|
+
self.keywords = value
|
193
|
+
end
|
187
194
|
end
|
188
195
|
|
189
|
-
if attributes.
|
190
|
-
self.
|
196
|
+
if attributes.key?(:'language')
|
197
|
+
self.language = attributes[:'language']
|
191
198
|
end
|
192
199
|
|
193
|
-
if attributes.
|
194
|
-
self.
|
200
|
+
if attributes.key?(:'links')
|
201
|
+
self.links = attributes[:'links']
|
195
202
|
end
|
196
203
|
|
197
|
-
if attributes.
|
198
|
-
if (value = attributes[:'
|
199
|
-
self.
|
204
|
+
if attributes.key?(:'media')
|
205
|
+
if (value = attributes[:'media']).is_a?(Array)
|
206
|
+
self.media = value
|
200
207
|
end
|
201
208
|
end
|
202
209
|
|
203
|
-
if attributes.
|
204
|
-
self.
|
210
|
+
if attributes.key?(:'paragraphs_count')
|
211
|
+
self.paragraphs_count = attributes[:'paragraphs_count']
|
205
212
|
end
|
206
213
|
|
207
|
-
if attributes.
|
208
|
-
|
209
|
-
|
210
|
-
|
214
|
+
if attributes.key?(:'published_at')
|
215
|
+
self.published_at = attributes[:'published_at']
|
216
|
+
end
|
217
|
+
|
218
|
+
if attributes.key?(:'sentences_count')
|
219
|
+
self.sentences_count = attributes[:'sentences_count']
|
211
220
|
end
|
212
221
|
|
213
|
-
if attributes.
|
222
|
+
if attributes.key?(:'sentiment')
|
214
223
|
self.sentiment = attributes[:'sentiment']
|
215
224
|
end
|
216
225
|
|
217
|
-
if attributes.
|
218
|
-
self.
|
226
|
+
if attributes.key?(:'social_shares_count')
|
227
|
+
self.social_shares_count = attributes[:'social_shares_count']
|
219
228
|
end
|
220
229
|
|
221
|
-
if attributes.
|
222
|
-
self.
|
230
|
+
if attributes.key?(:'source')
|
231
|
+
self.source = attributes[:'source']
|
223
232
|
end
|
224
233
|
|
225
|
-
if attributes.
|
226
|
-
self.
|
234
|
+
if attributes.key?(:'summary')
|
235
|
+
self.summary = attributes[:'summary']
|
236
|
+
end
|
237
|
+
|
238
|
+
if attributes.key?(:'title')
|
239
|
+
self.title = attributes[:'title']
|
227
240
|
end
|
228
241
|
|
242
|
+
if attributes.key?(:'translations')
|
243
|
+
self.translations = attributes[:'translations']
|
244
|
+
end
|
245
|
+
|
246
|
+
if attributes.key?(:'words_count')
|
247
|
+
self.words_count = attributes[:'words_count']
|
248
|
+
end
|
229
249
|
end
|
230
250
|
|
231
251
|
# Show invalid properties with the reasons. Usually used together with valid?
|
232
|
-
# @return Array for valid
|
252
|
+
# @return Array for valid properties with the reasons
|
233
253
|
def list_invalid_properties
|
234
254
|
invalid_properties = Array.new
|
235
|
-
|
255
|
+
invalid_properties
|
236
256
|
end
|
237
257
|
|
238
258
|
# Check to see if the all the properties in the model are valid
|
239
259
|
# @return true if the model is valid
|
240
260
|
def valid?
|
241
|
-
|
261
|
+
true
|
242
262
|
end
|
243
263
|
|
244
264
|
# Checks equality by comparing each attribute.
|
@@ -246,26 +266,28 @@ module AylienNewsApi
|
|
246
266
|
def ==(o)
|
247
267
|
return true if self.equal?(o)
|
248
268
|
self.class == o.class &&
|
249
|
-
id == o.id &&
|
250
|
-
title == o.title &&
|
251
|
-
body == o.body &&
|
252
|
-
summary == o.summary &&
|
253
|
-
source == o.source &&
|
254
269
|
author == o.author &&
|
270
|
+
body == o.body &&
|
271
|
+
categories == o.categories &&
|
272
|
+
characters_count == o.characters_count &&
|
273
|
+
clusters == o.clusters &&
|
255
274
|
entities == o.entities &&
|
256
|
-
keywords == o.keywords &&
|
257
275
|
hashtags == o.hashtags &&
|
258
|
-
|
259
|
-
|
260
|
-
sentences_count == o.sentences_count &&
|
261
|
-
paragraphs_count == o.paragraphs_count &&
|
262
|
-
categories == o.categories &&
|
263
|
-
social_shares_count == o.social_shares_count &&
|
264
|
-
media == o.media &&
|
265
|
-
sentiment == o.sentiment &&
|
276
|
+
id == o.id &&
|
277
|
+
keywords == o.keywords &&
|
266
278
|
language == o.language &&
|
279
|
+
links == o.links &&
|
280
|
+
media == o.media &&
|
281
|
+
paragraphs_count == o.paragraphs_count &&
|
267
282
|
published_at == o.published_at &&
|
268
|
-
|
283
|
+
sentences_count == o.sentences_count &&
|
284
|
+
sentiment == o.sentiment &&
|
285
|
+
social_shares_count == o.social_shares_count &&
|
286
|
+
source == o.source &&
|
287
|
+
summary == o.summary &&
|
288
|
+
title == o.title &&
|
289
|
+
translations == o.translations &&
|
290
|
+
words_count == o.words_count
|
269
291
|
end
|
270
292
|
|
271
293
|
# @see the `==` method
|
@@ -275,9 +297,16 @@ module AylienNewsApi
|
|
275
297
|
end
|
276
298
|
|
277
299
|
# Calculates hash code according to all attributes.
|
278
|
-
# @return [
|
300
|
+
# @return [Integer] Hash code
|
279
301
|
def hash
|
280
|
-
[
|
302
|
+
[author, body, categories, characters_count, clusters, entities, hashtags, id, keywords, language, links, media, paragraphs_count, published_at, sentences_count, sentiment, social_shares_count, source, summary, title, translations, words_count].hash
|
303
|
+
end
|
304
|
+
|
305
|
+
# Builds the object from hash
|
306
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
307
|
+
# @return [Object] Returns the model itself
|
308
|
+
def self.build_from_hash(attributes)
|
309
|
+
new.build_from_hash(attributes)
|
281
310
|
end
|
282
311
|
|
283
312
|
# Builds the object from hash
|
@@ -285,12 +314,12 @@ module AylienNewsApi
|
|
285
314
|
# @return [Object] Returns the model itself
|
286
315
|
def build_from_hash(attributes)
|
287
316
|
return nil unless attributes.is_a?(Hash)
|
288
|
-
self.class.
|
289
|
-
if type =~
|
290
|
-
# check to ensure the input is an array given that the
|
317
|
+
self.class.openapi_types.each_pair do |key, type|
|
318
|
+
if type =~ /\AArray<(.*)>/i
|
319
|
+
# check to ensure the input is an array given that the attribute
|
291
320
|
# is documented as an array but the input is not
|
292
321
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
293
|
-
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) }
|
322
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
294
323
|
end
|
295
324
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
296
325
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
@@ -316,8 +345,8 @@ module AylienNewsApi
|
|
316
345
|
value.to_i
|
317
346
|
when :Float
|
318
347
|
value.to_f
|
319
|
-
when :
|
320
|
-
if value.to_s =~
|
348
|
+
when :Boolean
|
349
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
321
350
|
true
|
322
351
|
else
|
323
352
|
false
|
@@ -328,7 +357,7 @@ module AylienNewsApi
|
|
328
357
|
when /\AArray<(?<inner_type>.+)>\z/
|
329
358
|
inner_type = Regexp.last_match[:inner_type]
|
330
359
|
value.map { |v| _deserialize(inner_type, v) }
|
331
|
-
when /\AHash<(?<k_type
|
360
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
332
361
|
k_type = Regexp.last_match[:k_type]
|
333
362
|
v_type = Regexp.last_match[:v_type]
|
334
363
|
{}.tap do |hash|
|
@@ -337,8 +366,7 @@ module AylienNewsApi
|
|
337
366
|
end
|
338
367
|
end
|
339
368
|
else # model
|
340
|
-
|
341
|
-
temp_model.build_from_hash(value)
|
369
|
+
AylienNewsApi.const_get(type).build_from_hash(value)
|
342
370
|
end
|
343
371
|
end
|
344
372
|
|
@@ -360,7 +388,11 @@ module AylienNewsApi
|
|
360
388
|
hash = {}
|
361
389
|
self.class.attribute_map.each_pair do |attr, param|
|
362
390
|
value = self.send(attr)
|
363
|
-
|
391
|
+
if value.nil?
|
392
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
393
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
394
|
+
end
|
395
|
+
|
364
396
|
hash[param] = _to_hash(value)
|
365
397
|
end
|
366
398
|
hash
|
@@ -372,7 +404,7 @@ module AylienNewsApi
|
|
372
404
|
# @return [Hash] Returns the value in the form of hash
|
373
405
|
def _to_hash(value)
|
374
406
|
if value.is_a?(Array)
|
375
|
-
value.compact.map{ |v| _to_hash(v) }
|
407
|
+
value.compact.map { |v| _to_hash(v) }
|
376
408
|
elsif value.is_a?(Hash)
|
377
409
|
{}.tap do |hash|
|
378
410
|
value.each { |k, v| hash[k] = _to_hash(v) }
|
@@ -383,7 +415,5 @@ module AylienNewsApi
|
|
383
415
|
value
|
384
416
|
end
|
385
417
|
end
|
386
|
-
|
387
418
|
end
|
388
|
-
|
389
419
|
end
|