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