aylien_news_api 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -4
- data/README.md +8 -7
- data/aylien_news_api.gemspec +15 -2
- data/docs/CategoryLinks.md +2 -2
- data/docs/Coverages.md +1 -0
- data/docs/DefaultApi.md +315 -252
- data/docs/Media.md +1 -1
- data/docs/RelatedStories.md +1 -0
- data/docs/Scope.md +4 -4
- data/docs/Story.md +5 -5
- data/lib/aylien_news_api/api/default_api.rb +615 -549
- data/lib/aylien_news_api/api_client.rb +2 -2
- data/lib/aylien_news_api/configuration.rb +8 -0
- data/lib/aylien_news_api/models/author.rb +25 -6
- data/lib/aylien_news_api/models/autocomplete.rb +23 -5
- data/lib/aylien_news_api/models/autocompletes.rb +21 -4
- data/lib/aylien_news_api/models/category.rb +57 -12
- data/lib/aylien_news_api/models/category_links.rb +25 -7
- data/lib/aylien_news_api/models/coverages.rb +45 -12
- data/lib/aylien_news_api/models/entities.rb +23 -5
- data/lib/aylien_news_api/models/entity.rb +49 -8
- data/lib/aylien_news_api/models/entity_links.rb +21 -4
- data/lib/aylien_news_api/models/error.rb +31 -9
- data/lib/aylien_news_api/models/error_links.rb +21 -4
- data/lib/aylien_news_api/models/errors.rb +21 -4
- data/lib/aylien_news_api/models/histogram_interval.rb +23 -5
- data/lib/aylien_news_api/models/histograms.rb +29 -8
- data/lib/aylien_news_api/models/location.rb +25 -6
- data/lib/aylien_news_api/models/media.rb +50 -9
- data/lib/aylien_news_api/models/related_stories.rb +43 -11
- data/lib/aylien_news_api/models/scope.rb +57 -14
- data/lib/aylien_news_api/models/sentiment.rb +69 -8
- data/lib/aylien_news_api/models/sentiments.rb +23 -5
- data/lib/aylien_news_api/models/share_count.rb +23 -5
- data/lib/aylien_news_api/models/share_counts.rb +27 -7
- data/lib/aylien_news_api/models/source.rb +31 -9
- data/lib/aylien_news_api/models/stories.rb +25 -6
- data/lib/aylien_news_api/models/story.rb +64 -28
- data/lib/aylien_news_api/models/story_cluster.rb +29 -8
- data/lib/aylien_news_api/models/story_links.rb +25 -6
- data/lib/aylien_news_api/models/summary.rb +21 -4
- data/lib/aylien_news_api/models/time_series.rb +23 -5
- data/lib/aylien_news_api/models/time_series_list.rb +27 -7
- data/lib/aylien_news_api/models/trend.rb +23 -5
- data/lib/aylien_news_api/models/trends.rb +23 -5
- data/lib/aylien_news_api/version.rb +1 -1
- data/spec/api_client_spec.rb +306 -0
- data/spec/configuration_spec.rb +39 -0
- data/spec/spec_helper.rb +113 -0
- metadata +34 -49
- data/Rakefile +0 -8
- data/aylien_news_api-0.0.1.gem +0 -0
@@ -15,6 +15,7 @@
|
|
15
15
|
require 'date'
|
16
16
|
|
17
17
|
module AylienNewsApi
|
18
|
+
|
18
19
|
class RelatedStories
|
19
20
|
# The input story title
|
20
21
|
attr_accessor :story_title
|
@@ -28,13 +29,18 @@ module AylienNewsApi
|
|
28
29
|
# An array of related stories for the input story
|
29
30
|
attr_accessor :related_stories
|
30
31
|
|
32
|
+
# An array of clusters
|
33
|
+
attr_accessor :clusters
|
34
|
+
|
35
|
+
|
31
36
|
# Attribute mapping from ruby-style variable name to JSON key.
|
32
37
|
def self.attribute_map
|
33
38
|
{
|
34
39
|
:'story_title' => :'story_title',
|
35
40
|
:'story_body' => :'story_body',
|
36
41
|
:'story_language' => :'story_language',
|
37
|
-
:'related_stories' => :'related_stories'
|
42
|
+
:'related_stories' => :'related_stories',
|
43
|
+
:'clusters' => :'clusters'
|
38
44
|
}
|
39
45
|
end
|
40
46
|
|
@@ -44,7 +50,8 @@ module AylienNewsApi
|
|
44
50
|
:'story_title' => :'String',
|
45
51
|
:'story_body' => :'String',
|
46
52
|
:'story_language' => :'String',
|
47
|
-
:'related_stories' => :'Array<Story>'
|
53
|
+
:'related_stories' => :'Array<Story>',
|
54
|
+
:'clusters' => :'Array<StoryCluster>'
|
48
55
|
}
|
49
56
|
end
|
50
57
|
|
@@ -56,35 +63,59 @@ module AylienNewsApi
|
|
56
63
|
# convert string to symbol for hash key
|
57
64
|
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
58
65
|
|
59
|
-
if attributes
|
66
|
+
if attributes.has_key?(:'story_title')
|
60
67
|
self.story_title = attributes[:'story_title']
|
61
68
|
end
|
62
|
-
|
69
|
+
|
70
|
+
if attributes.has_key?(:'story_body')
|
63
71
|
self.story_body = attributes[:'story_body']
|
64
72
|
end
|
65
|
-
|
73
|
+
|
74
|
+
if attributes.has_key?(:'story_language')
|
66
75
|
self.story_language = attributes[:'story_language']
|
67
76
|
end
|
68
|
-
|
77
|
+
|
78
|
+
if attributes.has_key?(:'related_stories')
|
69
79
|
if (value = attributes[:'related_stories']).is_a?(Array)
|
70
80
|
self.related_stories = value
|
71
81
|
end
|
72
82
|
end
|
83
|
+
|
84
|
+
if attributes.has_key?(:'clusters')
|
85
|
+
if (value = attributes[:'clusters']).is_a?(Array)
|
86
|
+
self.clusters = value
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
91
|
+
|
92
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
93
|
+
# @return Array for valid properies with the reasons
|
94
|
+
def list_invalid_properties
|
95
|
+
invalid_properties = Array.new
|
96
|
+
return invalid_properties
|
97
|
+
end
|
98
|
+
|
99
|
+
# Check to see if the all the properties in the model are valid
|
100
|
+
# @return true if the model is valid
|
101
|
+
def valid?
|
102
|
+
return true
|
73
103
|
end
|
74
104
|
|
75
105
|
# Checks equality by comparing each attribute.
|
76
|
-
# @param [Object] Object to be compared
|
106
|
+
# @param [Object] Object to be compared
|
77
107
|
def ==(o)
|
78
108
|
return true if self.equal?(o)
|
79
109
|
self.class == o.class &&
|
80
110
|
story_title == o.story_title &&
|
81
111
|
story_body == o.story_body &&
|
82
112
|
story_language == o.story_language &&
|
83
|
-
related_stories == o.related_stories
|
113
|
+
related_stories == o.related_stories &&
|
114
|
+
clusters == o.clusters
|
84
115
|
end
|
85
116
|
|
86
117
|
# @see the `==` method
|
87
|
-
# @param [Object] Object to be compared
|
118
|
+
# @param [Object] Object to be compared
|
88
119
|
def eql?(o)
|
89
120
|
self == o
|
90
121
|
end
|
@@ -92,7 +123,7 @@ module AylienNewsApi
|
|
92
123
|
# Calculates hash code according to all attributes.
|
93
124
|
# @return [Fixnum] Hash code
|
94
125
|
def hash
|
95
|
-
[story_title, story_body, story_language, related_stories].hash
|
126
|
+
[story_title, story_body, story_language, related_stories, clusters].hash
|
96
127
|
end
|
97
128
|
|
98
129
|
# Builds the object from hash
|
@@ -183,7 +214,7 @@ module AylienNewsApi
|
|
183
214
|
|
184
215
|
# Outputs non-array value in the form of hash
|
185
216
|
# For object, use to_hash. Otherwise, just return the value
|
186
|
-
# @param [Object] value Any valid value
|
217
|
+
# @param [Object] value Any valid value
|
187
218
|
# @return [Hash] Returns the value in the form of hash
|
188
219
|
def _to_hash(value)
|
189
220
|
if value.is_a?(Array)
|
@@ -200,4 +231,5 @@ module AylienNewsApi
|
|
200
231
|
end
|
201
232
|
|
202
233
|
end
|
234
|
+
|
203
235
|
end
|
@@ -15,19 +15,42 @@
|
|
15
15
|
require 'date'
|
16
16
|
|
17
17
|
module AylienNewsApi
|
18
|
+
|
18
19
|
class Scope
|
19
|
-
# The
|
20
|
+
# The source scope by country code. It supports [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country codes.
|
20
21
|
attr_accessor :country
|
21
22
|
|
22
|
-
# The
|
23
|
+
# The scope by state
|
23
24
|
attr_accessor :state
|
24
25
|
|
25
|
-
# The
|
26
|
+
# The scope by city
|
26
27
|
attr_accessor :city
|
27
28
|
|
28
|
-
# The
|
29
|
+
# The scope by level
|
29
30
|
attr_accessor :level
|
30
31
|
|
32
|
+
class EnumAttributeValidator
|
33
|
+
attr_reader :datatype
|
34
|
+
attr_reader :allowable_values
|
35
|
+
|
36
|
+
def initialize(datatype, allowable_values)
|
37
|
+
@allowable_values = allowable_values.map do |value|
|
38
|
+
case datatype.to_s
|
39
|
+
when /Integer/i
|
40
|
+
value.to_i
|
41
|
+
when /Float/i
|
42
|
+
value.to_f
|
43
|
+
else
|
44
|
+
value
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def valid?(value)
|
50
|
+
!value || allowable_values.include?(value)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
31
54
|
# Attribute mapping from ruby-style variable name to JSON key.
|
32
55
|
def self.attribute_map
|
33
56
|
{
|
@@ -56,32 +79,51 @@ module AylienNewsApi
|
|
56
79
|
# convert string to symbol for hash key
|
57
80
|
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
58
81
|
|
59
|
-
if attributes
|
82
|
+
if attributes.has_key?(:'country')
|
60
83
|
self.country = attributes[:'country']
|
61
84
|
end
|
62
|
-
|
85
|
+
|
86
|
+
if attributes.has_key?(:'state')
|
63
87
|
self.state = attributes[:'state']
|
64
88
|
end
|
65
|
-
|
89
|
+
|
90
|
+
if attributes.has_key?(:'city')
|
66
91
|
self.city = attributes[:'city']
|
67
92
|
end
|
68
|
-
|
93
|
+
|
94
|
+
if attributes.has_key?(:'level')
|
69
95
|
self.level = attributes[:'level']
|
70
96
|
end
|
97
|
+
|
98
|
+
end
|
99
|
+
|
100
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
101
|
+
# @return Array for valid properies with the reasons
|
102
|
+
def list_invalid_properties
|
103
|
+
invalid_properties = Array.new
|
104
|
+
return invalid_properties
|
105
|
+
end
|
106
|
+
|
107
|
+
# Check to see if the all the properties in the model are valid
|
108
|
+
# @return true if the model is valid
|
109
|
+
def valid?
|
110
|
+
level_validator = EnumAttributeValidator.new('String', ["international", "national", "local"])
|
111
|
+
return false unless level_validator.valid?(@level)
|
112
|
+
return true
|
71
113
|
end
|
72
114
|
|
73
115
|
# Custom attribute writer method checking allowed values (enum).
|
74
116
|
# @param [Object] level Object to be assigned
|
75
117
|
def level=(level)
|
76
|
-
|
77
|
-
|
78
|
-
fail "invalid value for 'level', must be one of #{
|
118
|
+
validator = EnumAttributeValidator.new('String', ["international", "national", "local"])
|
119
|
+
unless validator.valid?(level)
|
120
|
+
fail ArgumentError, "invalid value for 'level', must be one of #{validator.allowable_values}."
|
79
121
|
end
|
80
122
|
@level = level
|
81
123
|
end
|
82
124
|
|
83
125
|
# Checks equality by comparing each attribute.
|
84
|
-
# @param [Object] Object to be compared
|
126
|
+
# @param [Object] Object to be compared
|
85
127
|
def ==(o)
|
86
128
|
return true if self.equal?(o)
|
87
129
|
self.class == o.class &&
|
@@ -92,7 +134,7 @@ module AylienNewsApi
|
|
92
134
|
end
|
93
135
|
|
94
136
|
# @see the `==` method
|
95
|
-
# @param [Object] Object to be compared
|
137
|
+
# @param [Object] Object to be compared
|
96
138
|
def eql?(o)
|
97
139
|
self == o
|
98
140
|
end
|
@@ -191,7 +233,7 @@ module AylienNewsApi
|
|
191
233
|
|
192
234
|
# Outputs non-array value in the form of hash
|
193
235
|
# For object, use to_hash. Otherwise, just return the value
|
194
|
-
# @param [Object] value Any valid value
|
236
|
+
# @param [Object] value Any valid value
|
195
237
|
# @return [Hash] Returns the value in the form of hash
|
196
238
|
def _to_hash(value)
|
197
239
|
if value.is_a?(Array)
|
@@ -208,4 +250,5 @@ module AylienNewsApi
|
|
208
250
|
end
|
209
251
|
|
210
252
|
end
|
253
|
+
|
211
254
|
end
|
@@ -15,6 +15,7 @@
|
|
15
15
|
require 'date'
|
16
16
|
|
17
17
|
module AylienNewsApi
|
18
|
+
|
18
19
|
class Sentiment
|
19
20
|
# Polarity of the sentiment
|
20
21
|
attr_accessor :polarity
|
@@ -22,6 +23,28 @@ module AylienNewsApi
|
|
22
23
|
# Polarity score of the sentiment
|
23
24
|
attr_accessor :score
|
24
25
|
|
26
|
+
class EnumAttributeValidator
|
27
|
+
attr_reader :datatype
|
28
|
+
attr_reader :allowable_values
|
29
|
+
|
30
|
+
def initialize(datatype, allowable_values)
|
31
|
+
@allowable_values = allowable_values.map do |value|
|
32
|
+
case datatype.to_s
|
33
|
+
when /Integer/i
|
34
|
+
value.to_i
|
35
|
+
when /Float/i
|
36
|
+
value.to_f
|
37
|
+
else
|
38
|
+
value
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def valid?(value)
|
44
|
+
!value || allowable_values.include?(value)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
25
48
|
# Attribute mapping from ruby-style variable name to JSON key.
|
26
49
|
def self.attribute_map
|
27
50
|
{
|
@@ -46,26 +69,63 @@ module AylienNewsApi
|
|
46
69
|
# convert string to symbol for hash key
|
47
70
|
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
48
71
|
|
49
|
-
if attributes
|
72
|
+
if attributes.has_key?(:'polarity')
|
50
73
|
self.polarity = attributes[:'polarity']
|
51
74
|
end
|
52
|
-
|
75
|
+
|
76
|
+
if attributes.has_key?(:'score')
|
53
77
|
self.score = attributes[:'score']
|
54
78
|
end
|
79
|
+
|
80
|
+
end
|
81
|
+
|
82
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
83
|
+
# @return Array for valid properies with the reasons
|
84
|
+
def list_invalid_properties
|
85
|
+
invalid_properties = Array.new
|
86
|
+
return invalid_properties
|
87
|
+
end
|
88
|
+
|
89
|
+
# Check to see if the all the properties in the model are valid
|
90
|
+
# @return true if the model is valid
|
91
|
+
def valid?
|
92
|
+
polarity_validator = EnumAttributeValidator.new('String', ["positive", "neutral", "negative"])
|
93
|
+
return false unless polarity_validator.valid?(@polarity)
|
94
|
+
return false if @score > 1.0
|
95
|
+
return false if @score < 0.0
|
96
|
+
return true
|
55
97
|
end
|
56
98
|
|
57
99
|
# Custom attribute writer method checking allowed values (enum).
|
58
100
|
# @param [Object] polarity Object to be assigned
|
59
101
|
def polarity=(polarity)
|
60
|
-
|
61
|
-
|
62
|
-
fail "invalid value for 'polarity', must be one of #{
|
102
|
+
validator = EnumAttributeValidator.new('String', ["positive", "neutral", "negative"])
|
103
|
+
unless validator.valid?(polarity)
|
104
|
+
fail ArgumentError, "invalid value for 'polarity', must be one of #{validator.allowable_values}."
|
63
105
|
end
|
64
106
|
@polarity = polarity
|
65
107
|
end
|
66
108
|
|
109
|
+
# Custom attribute writer method with validation
|
110
|
+
# @param [Object] score Value to be assigned
|
111
|
+
def score=(score)
|
112
|
+
if score.nil?
|
113
|
+
fail ArgumentError, "score cannot be nil"
|
114
|
+
end
|
115
|
+
|
116
|
+
if score > 1.0
|
117
|
+
fail ArgumentError, "invalid value for 'score', must be smaller than or equal to 1.0."
|
118
|
+
end
|
119
|
+
|
120
|
+
if score < 0.0
|
121
|
+
fail ArgumentError, "invalid value for 'score', must be greater than or equal to 0.0."
|
122
|
+
end
|
123
|
+
|
124
|
+
@score = score
|
125
|
+
end
|
126
|
+
|
67
127
|
# Checks equality by comparing each attribute.
|
68
|
-
# @param [Object] Object to be compared
|
128
|
+
# @param [Object] Object to be compared
|
69
129
|
def ==(o)
|
70
130
|
return true if self.equal?(o)
|
71
131
|
self.class == o.class &&
|
@@ -74,7 +134,7 @@ module AylienNewsApi
|
|
74
134
|
end
|
75
135
|
|
76
136
|
# @see the `==` method
|
77
|
-
# @param [Object] Object to be compared
|
137
|
+
# @param [Object] Object to be compared
|
78
138
|
def eql?(o)
|
79
139
|
self == o
|
80
140
|
end
|
@@ -173,7 +233,7 @@ module AylienNewsApi
|
|
173
233
|
|
174
234
|
# Outputs non-array value in the form of hash
|
175
235
|
# For object, use to_hash. Otherwise, just return the value
|
176
|
-
# @param [Object] value Any valid value
|
236
|
+
# @param [Object] value Any valid value
|
177
237
|
# @return [Hash] Returns the value in the form of hash
|
178
238
|
def _to_hash(value)
|
179
239
|
if value.is_a?(Array)
|
@@ -190,4 +250,5 @@ module AylienNewsApi
|
|
190
250
|
end
|
191
251
|
|
192
252
|
end
|
253
|
+
|
193
254
|
end
|
@@ -15,6 +15,7 @@
|
|
15
15
|
require 'date'
|
16
16
|
|
17
17
|
module AylienNewsApi
|
18
|
+
|
18
19
|
class Sentiments
|
19
20
|
# The sentiment for the story title
|
20
21
|
attr_accessor :title
|
@@ -22,6 +23,7 @@ module AylienNewsApi
|
|
22
23
|
# The sentiment for the story body
|
23
24
|
attr_accessor :body
|
24
25
|
|
26
|
+
|
25
27
|
# Attribute mapping from ruby-style variable name to JSON key.
|
26
28
|
def self.attribute_map
|
27
29
|
{
|
@@ -46,16 +48,31 @@ module AylienNewsApi
|
|
46
48
|
# convert string to symbol for hash key
|
47
49
|
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
48
50
|
|
49
|
-
if attributes
|
51
|
+
if attributes.has_key?(:'title')
|
50
52
|
self.title = attributes[:'title']
|
51
53
|
end
|
52
|
-
|
54
|
+
|
55
|
+
if attributes.has_key?(:'body')
|
53
56
|
self.body = attributes[:'body']
|
54
57
|
end
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
62
|
+
# @return Array for valid properies with the reasons
|
63
|
+
def list_invalid_properties
|
64
|
+
invalid_properties = Array.new
|
65
|
+
return invalid_properties
|
66
|
+
end
|
67
|
+
|
68
|
+
# Check to see if the all the properties in the model are valid
|
69
|
+
# @return true if the model is valid
|
70
|
+
def valid?
|
71
|
+
return true
|
55
72
|
end
|
56
73
|
|
57
74
|
# Checks equality by comparing each attribute.
|
58
|
-
# @param [Object] Object to be compared
|
75
|
+
# @param [Object] Object to be compared
|
59
76
|
def ==(o)
|
60
77
|
return true if self.equal?(o)
|
61
78
|
self.class == o.class &&
|
@@ -64,7 +81,7 @@ module AylienNewsApi
|
|
64
81
|
end
|
65
82
|
|
66
83
|
# @see the `==` method
|
67
|
-
# @param [Object] Object to be compared
|
84
|
+
# @param [Object] Object to be compared
|
68
85
|
def eql?(o)
|
69
86
|
self == o
|
70
87
|
end
|
@@ -163,7 +180,7 @@ module AylienNewsApi
|
|
163
180
|
|
164
181
|
# Outputs non-array value in the form of hash
|
165
182
|
# For object, use to_hash. Otherwise, just return the value
|
166
|
-
# @param [Object] value Any valid value
|
183
|
+
# @param [Object] value Any valid value
|
167
184
|
# @return [Hash] Returns the value in the form of hash
|
168
185
|
def _to_hash(value)
|
169
186
|
if value.is_a?(Array)
|
@@ -180,4 +197,5 @@ module AylienNewsApi
|
|
180
197
|
end
|
181
198
|
|
182
199
|
end
|
200
|
+
|
183
201
|
end
|