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.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +2 -4
  3. data/README.md +8 -7
  4. data/aylien_news_api.gemspec +15 -2
  5. data/docs/CategoryLinks.md +2 -2
  6. data/docs/Coverages.md +1 -0
  7. data/docs/DefaultApi.md +315 -252
  8. data/docs/Media.md +1 -1
  9. data/docs/RelatedStories.md +1 -0
  10. data/docs/Scope.md +4 -4
  11. data/docs/Story.md +5 -5
  12. data/lib/aylien_news_api/api/default_api.rb +615 -549
  13. data/lib/aylien_news_api/api_client.rb +2 -2
  14. data/lib/aylien_news_api/configuration.rb +8 -0
  15. data/lib/aylien_news_api/models/author.rb +25 -6
  16. data/lib/aylien_news_api/models/autocomplete.rb +23 -5
  17. data/lib/aylien_news_api/models/autocompletes.rb +21 -4
  18. data/lib/aylien_news_api/models/category.rb +57 -12
  19. data/lib/aylien_news_api/models/category_links.rb +25 -7
  20. data/lib/aylien_news_api/models/coverages.rb +45 -12
  21. data/lib/aylien_news_api/models/entities.rb +23 -5
  22. data/lib/aylien_news_api/models/entity.rb +49 -8
  23. data/lib/aylien_news_api/models/entity_links.rb +21 -4
  24. data/lib/aylien_news_api/models/error.rb +31 -9
  25. data/lib/aylien_news_api/models/error_links.rb +21 -4
  26. data/lib/aylien_news_api/models/errors.rb +21 -4
  27. data/lib/aylien_news_api/models/histogram_interval.rb +23 -5
  28. data/lib/aylien_news_api/models/histograms.rb +29 -8
  29. data/lib/aylien_news_api/models/location.rb +25 -6
  30. data/lib/aylien_news_api/models/media.rb +50 -9
  31. data/lib/aylien_news_api/models/related_stories.rb +43 -11
  32. data/lib/aylien_news_api/models/scope.rb +57 -14
  33. data/lib/aylien_news_api/models/sentiment.rb +69 -8
  34. data/lib/aylien_news_api/models/sentiments.rb +23 -5
  35. data/lib/aylien_news_api/models/share_count.rb +23 -5
  36. data/lib/aylien_news_api/models/share_counts.rb +27 -7
  37. data/lib/aylien_news_api/models/source.rb +31 -9
  38. data/lib/aylien_news_api/models/stories.rb +25 -6
  39. data/lib/aylien_news_api/models/story.rb +64 -28
  40. data/lib/aylien_news_api/models/story_cluster.rb +29 -8
  41. data/lib/aylien_news_api/models/story_links.rb +25 -6
  42. data/lib/aylien_news_api/models/summary.rb +21 -4
  43. data/lib/aylien_news_api/models/time_series.rb +23 -5
  44. data/lib/aylien_news_api/models/time_series_list.rb +27 -7
  45. data/lib/aylien_news_api/models/trend.rb +23 -5
  46. data/lib/aylien_news_api/models/trends.rb +23 -5
  47. data/lib/aylien_news_api/version.rb +1 -1
  48. data/spec/api_client_spec.rb +306 -0
  49. data/spec/configuration_spec.rb +39 -0
  50. data/spec/spec_helper.rb +113 -0
  51. metadata +34 -49
  52. data/Rakefile +0 -8
  53. 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 Coverages
19
20
  # The input story title
20
21
  attr_accessor :story_title
@@ -31,6 +32,10 @@ module AylienNewsApi
31
32
  # An array of coverages for the input story
32
33
  attr_accessor :coverages
33
34
 
35
+ # An array of clusters
36
+ attr_accessor :clusters
37
+
38
+
34
39
  # Attribute mapping from ruby-style variable name to JSON key.
35
40
  def self.attribute_map
36
41
  {
@@ -38,7 +43,8 @@ module AylienNewsApi
38
43
  :'story_body' => :'story_body',
39
44
  :'story_published_at' => :'story_published_at',
40
45
  :'story_language' => :'story_language',
41
- :'coverages' => :'coverages'
46
+ :'coverages' => :'coverages',
47
+ :'clusters' => :'clusters'
42
48
  }
43
49
  end
44
50
 
@@ -49,7 +55,8 @@ module AylienNewsApi
49
55
  :'story_body' => :'String',
50
56
  :'story_published_at' => :'DateTime',
51
57
  :'story_language' => :'String',
52
- :'coverages' => :'Array<Story>'
58
+ :'coverages' => :'Array<Story>',
59
+ :'clusters' => :'Array<StoryCluster>'
53
60
  }
54
61
  end
55
62
 
@@ -61,27 +68,51 @@ module AylienNewsApi
61
68
  # convert string to symbol for hash key
62
69
  attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
63
70
 
64
- if attributes[:'story_title']
71
+ if attributes.has_key?(:'story_title')
65
72
  self.story_title = attributes[:'story_title']
66
73
  end
67
- if attributes[:'story_body']
74
+
75
+ if attributes.has_key?(:'story_body')
68
76
  self.story_body = attributes[:'story_body']
69
77
  end
70
- if attributes[:'story_published_at']
78
+
79
+ if attributes.has_key?(:'story_published_at')
71
80
  self.story_published_at = attributes[:'story_published_at']
72
81
  end
73
- if attributes[:'story_language']
82
+
83
+ if attributes.has_key?(:'story_language')
74
84
  self.story_language = attributes[:'story_language']
75
85
  end
76
- if attributes[:'coverages']
86
+
87
+ if attributes.has_key?(:'coverages')
77
88
  if (value = attributes[:'coverages']).is_a?(Array)
78
89
  self.coverages = value
79
90
  end
80
91
  end
92
+
93
+ if attributes.has_key?(:'clusters')
94
+ if (value = attributes[:'clusters']).is_a?(Array)
95
+ self.clusters = value
96
+ end
97
+ end
98
+
99
+ end
100
+
101
+ # Show invalid properties with the reasons. Usually used together with valid?
102
+ # @return Array for valid properies with the reasons
103
+ def list_invalid_properties
104
+ invalid_properties = Array.new
105
+ return invalid_properties
106
+ end
107
+
108
+ # Check to see if the all the properties in the model are valid
109
+ # @return true if the model is valid
110
+ def valid?
111
+ return true
81
112
  end
82
113
 
83
114
  # Checks equality by comparing each attribute.
84
- # @param [Object] Object to be compared
115
+ # @param [Object] Object to be compared
85
116
  def ==(o)
86
117
  return true if self.equal?(o)
87
118
  self.class == o.class &&
@@ -89,11 +120,12 @@ module AylienNewsApi
89
120
  story_body == o.story_body &&
90
121
  story_published_at == o.story_published_at &&
91
122
  story_language == o.story_language &&
92
- coverages == o.coverages
123
+ coverages == o.coverages &&
124
+ clusters == o.clusters
93
125
  end
94
126
 
95
127
  # @see the `==` method
96
- # @param [Object] Object to be compared
128
+ # @param [Object] Object to be compared
97
129
  def eql?(o)
98
130
  self == o
99
131
  end
@@ -101,7 +133,7 @@ module AylienNewsApi
101
133
  # Calculates hash code according to all attributes.
102
134
  # @return [Fixnum] Hash code
103
135
  def hash
104
- [story_title, story_body, story_published_at, story_language, coverages].hash
136
+ [story_title, story_body, story_published_at, story_language, coverages, clusters].hash
105
137
  end
106
138
 
107
139
  # Builds the object from hash
@@ -192,7 +224,7 @@ module AylienNewsApi
192
224
 
193
225
  # Outputs non-array value in the form of hash
194
226
  # For object, use to_hash. Otherwise, just return the value
195
- # @param [Object] value Any valid value
227
+ # @param [Object] value Any valid value
196
228
  # @return [Hash] Returns the value in the form of hash
197
229
  def _to_hash(value)
198
230
  if value.is_a?(Array)
@@ -209,4 +241,5 @@ module AylienNewsApi
209
241
  end
210
242
 
211
243
  end
244
+
212
245
  end
@@ -15,6 +15,7 @@
15
15
  require 'date'
16
16
 
17
17
  module AylienNewsApi
18
+
18
19
  class Entities
19
20
  # An array of extracted entities from the story title
20
21
  attr_accessor :title
@@ -22,6 +23,7 @@ module AylienNewsApi
22
23
  # An array of extracted entities from 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,20 +48,35 @@ 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[:'title']
51
+ if attributes.has_key?(:'title')
50
52
  if (value = attributes[:'title']).is_a?(Array)
51
53
  self.title = value
52
54
  end
53
55
  end
54
- if attributes[:'body']
56
+
57
+ if attributes.has_key?(:'body')
55
58
  if (value = attributes[:'body']).is_a?(Array)
56
59
  self.body = value
57
60
  end
58
61
  end
62
+
63
+ end
64
+
65
+ # Show invalid properties with the reasons. Usually used together with valid?
66
+ # @return Array for valid properies with the reasons
67
+ def list_invalid_properties
68
+ invalid_properties = Array.new
69
+ return invalid_properties
70
+ end
71
+
72
+ # Check to see if the all the properties in the model are valid
73
+ # @return true if the model is valid
74
+ def valid?
75
+ return true
59
76
  end
60
77
 
61
78
  # Checks equality by comparing each attribute.
62
- # @param [Object] Object to be compared
79
+ # @param [Object] Object to be compared
63
80
  def ==(o)
64
81
  return true if self.equal?(o)
65
82
  self.class == o.class &&
@@ -68,7 +85,7 @@ module AylienNewsApi
68
85
  end
69
86
 
70
87
  # @see the `==` method
71
- # @param [Object] Object to be compared
88
+ # @param [Object] Object to be compared
72
89
  def eql?(o)
73
90
  self == o
74
91
  end
@@ -167,7 +184,7 @@ module AylienNewsApi
167
184
 
168
185
  # Outputs non-array value in the form of hash
169
186
  # For object, use to_hash. Otherwise, just return the value
170
- # @param [Object] value Any valid value
187
+ # @param [Object] value Any valid value
171
188
  # @return [Hash] Returns the value in the form of hash
172
189
  def _to_hash(value)
173
190
  if value.is_a?(Array)
@@ -184,4 +201,5 @@ module AylienNewsApi
184
201
  end
185
202
 
186
203
  end
204
+
187
205
  end
@@ -15,6 +15,7 @@
15
15
  require 'date'
16
16
 
17
17
  module AylienNewsApi
18
+
18
19
  class Entity
19
20
  # The entity text
20
21
  attr_accessor :text
@@ -31,6 +32,7 @@ module AylienNewsApi
31
32
  # The indices of the entity text
32
33
  attr_accessor :indices
33
34
 
35
+
34
36
  # Attribute mapping from ruby-style variable name to JSON key.
35
37
  def self.attribute_map
36
38
  {
@@ -61,29 +63,67 @@ module AylienNewsApi
61
63
  # convert string to symbol for hash key
62
64
  attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
63
65
 
64
- if attributes[:'text']
66
+ if attributes.has_key?(:'text')
65
67
  self.text = attributes[:'text']
66
68
  end
67
- if attributes[:'score']
69
+
70
+ if attributes.has_key?(:'score')
68
71
  self.score = attributes[:'score']
69
72
  end
70
- if attributes[:'types']
73
+
74
+ if attributes.has_key?(:'types')
71
75
  if (value = attributes[:'types']).is_a?(Array)
72
76
  self.types = value
73
77
  end
74
78
  end
75
- if attributes[:'links']
79
+
80
+ if attributes.has_key?(:'links')
76
81
  self.links = attributes[:'links']
77
82
  end
78
- if attributes[:'indices']
83
+
84
+ if attributes.has_key?(:'indices')
79
85
  if (value = attributes[:'indices']).is_a?(Array)
80
86
  self.indices = value
81
87
  end
82
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 false if @score > 1.0
103
+ return false if @score < 0.0
104
+ return true
105
+ end
106
+
107
+ # Custom attribute writer method with validation
108
+ # @param [Object] score Value to be assigned
109
+ def score=(score)
110
+ if score.nil?
111
+ fail ArgumentError, "score cannot be nil"
112
+ end
113
+
114
+ if score > 1.0
115
+ fail ArgumentError, "invalid value for 'score', must be smaller than or equal to 1.0."
116
+ end
117
+
118
+ if score < 0.0
119
+ fail ArgumentError, "invalid value for 'score', must be greater than or equal to 0.0."
120
+ end
121
+
122
+ @score = score
83
123
  end
84
124
 
85
125
  # Checks equality by comparing each attribute.
86
- # @param [Object] Object to be compared
126
+ # @param [Object] Object to be compared
87
127
  def ==(o)
88
128
  return true if self.equal?(o)
89
129
  self.class == o.class &&
@@ -95,7 +135,7 @@ module AylienNewsApi
95
135
  end
96
136
 
97
137
  # @see the `==` method
98
- # @param [Object] Object to be compared
138
+ # @param [Object] Object to be compared
99
139
  def eql?(o)
100
140
  self == o
101
141
  end
@@ -194,7 +234,7 @@ module AylienNewsApi
194
234
 
195
235
  # Outputs non-array value in the form of hash
196
236
  # For object, use to_hash. Otherwise, just return the value
197
- # @param [Object] value Any valid value
237
+ # @param [Object] value Any valid value
198
238
  # @return [Hash] Returns the value in the form of hash
199
239
  def _to_hash(value)
200
240
  if value.is_a?(Array)
@@ -211,4 +251,5 @@ module AylienNewsApi
211
251
  end
212
252
 
213
253
  end
254
+
214
255
  end
@@ -15,10 +15,12 @@
15
15
  require 'date'
16
16
 
17
17
  module AylienNewsApi
18
+
18
19
  class EntityLinks
19
20
  # A dbpedia resource URL
20
21
  attr_accessor :dbpedia
21
22
 
23
+
22
24
  # Attribute mapping from ruby-style variable name to JSON key.
23
25
  def self.attribute_map
24
26
  {
@@ -41,13 +43,27 @@ module AylienNewsApi
41
43
  # convert string to symbol for hash key
42
44
  attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
43
45
 
44
- if attributes[:'dbpedia']
46
+ if attributes.has_key?(:'dbpedia')
45
47
  self.dbpedia = attributes[:'dbpedia']
46
48
  end
49
+
50
+ end
51
+
52
+ # Show invalid properties with the reasons. Usually used together with valid?
53
+ # @return Array for valid properies with the reasons
54
+ def list_invalid_properties
55
+ invalid_properties = Array.new
56
+ return invalid_properties
57
+ end
58
+
59
+ # Check to see if the all the properties in the model are valid
60
+ # @return true if the model is valid
61
+ def valid?
62
+ return true
47
63
  end
48
64
 
49
65
  # Checks equality by comparing each attribute.
50
- # @param [Object] Object to be compared
66
+ # @param [Object] Object to be compared
51
67
  def ==(o)
52
68
  return true if self.equal?(o)
53
69
  self.class == o.class &&
@@ -55,7 +71,7 @@ module AylienNewsApi
55
71
  end
56
72
 
57
73
  # @see the `==` method
58
- # @param [Object] Object to be compared
74
+ # @param [Object] Object to be compared
59
75
  def eql?(o)
60
76
  self == o
61
77
  end
@@ -154,7 +170,7 @@ module AylienNewsApi
154
170
 
155
171
  # Outputs non-array value in the form of hash
156
172
  # For object, use to_hash. Otherwise, just return the value
157
- # @param [Object] value Any valid value
173
+ # @param [Object] value Any valid value
158
174
  # @return [Hash] Returns the value in the form of hash
159
175
  def _to_hash(value)
160
176
  if value.is_a?(Array)
@@ -171,4 +187,5 @@ module AylienNewsApi
171
187
  end
172
188
 
173
189
  end
190
+
174
191
  end
@@ -15,6 +15,7 @@
15
15
  require 'date'
16
16
 
17
17
  module AylienNewsApi
18
+
18
19
  class Error
19
20
  attr_accessor :id
20
21
 
@@ -28,6 +29,7 @@ module AylienNewsApi
28
29
 
29
30
  attr_accessor :detail
30
31
 
32
+
31
33
  # Attribute mapping from ruby-style variable name to JSON key.
32
34
  def self.attribute_map
33
35
  {
@@ -60,28 +62,47 @@ module AylienNewsApi
60
62
  # convert string to symbol for hash key
61
63
  attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
62
64
 
63
- if attributes[:'id']
65
+ if attributes.has_key?(:'id')
64
66
  self.id = attributes[:'id']
65
67
  end
66
- if attributes[:'links']
68
+
69
+ if attributes.has_key?(:'links')
67
70
  self.links = attributes[:'links']
68
71
  end
69
- if attributes[:'status']
72
+
73
+ if attributes.has_key?(:'status')
70
74
  self.status = attributes[:'status']
71
75
  end
72
- if attributes[:'code']
76
+
77
+ if attributes.has_key?(:'code')
73
78
  self.code = attributes[:'code']
74
79
  end
75
- if attributes[:'title']
80
+
81
+ if attributes.has_key?(:'title')
76
82
  self.title = attributes[:'title']
77
83
  end
78
- if attributes[:'detail']
84
+
85
+ if attributes.has_key?(:'detail')
79
86
  self.detail = attributes[:'detail']
80
87
  end
88
+
89
+ end
90
+
91
+ # Show invalid properties with the reasons. Usually used together with valid?
92
+ # @return Array for valid properies with the reasons
93
+ def list_invalid_properties
94
+ invalid_properties = Array.new
95
+ return invalid_properties
96
+ end
97
+
98
+ # Check to see if the all the properties in the model are valid
99
+ # @return true if the model is valid
100
+ def valid?
101
+ return true
81
102
  end
82
103
 
83
104
  # Checks equality by comparing each attribute.
84
- # @param [Object] Object to be compared
105
+ # @param [Object] Object to be compared
85
106
  def ==(o)
86
107
  return true if self.equal?(o)
87
108
  self.class == o.class &&
@@ -94,7 +115,7 @@ module AylienNewsApi
94
115
  end
95
116
 
96
117
  # @see the `==` method
97
- # @param [Object] Object to be compared
118
+ # @param [Object] Object to be compared
98
119
  def eql?(o)
99
120
  self == o
100
121
  end
@@ -193,7 +214,7 @@ module AylienNewsApi
193
214
 
194
215
  # Outputs non-array value in the form of hash
195
216
  # For object, use to_hash. Otherwise, just return the value
196
- # @param [Object] value Any valid value
217
+ # @param [Object] value Any valid value
197
218
  # @return [Hash] Returns the value in the form of hash
198
219
  def _to_hash(value)
199
220
  if value.is_a?(Array)
@@ -210,4 +231,5 @@ module AylienNewsApi
210
231
  end
211
232
 
212
233
  end
234
+
213
235
  end