aylien_news_api 0.1.0 → 0.2.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.
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,9 +15,11 @@
15
15
  require 'date'
16
16
 
17
17
  module AylienNewsApi
18
+
18
19
  class ErrorLinks
19
20
  attr_accessor :about
20
21
 
22
+
21
23
  # Attribute mapping from ruby-style variable name to JSON key.
22
24
  def self.attribute_map
23
25
  {
@@ -40,13 +42,27 @@ module AylienNewsApi
40
42
  # convert string to symbol for hash key
41
43
  attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
42
44
 
43
- if attributes[:'about']
45
+ if attributes.has_key?(:'about')
44
46
  self.about = attributes[:'about']
45
47
  end
48
+
49
+ end
50
+
51
+ # Show invalid properties with the reasons. Usually used together with valid?
52
+ # @return Array for valid properies with the reasons
53
+ def list_invalid_properties
54
+ invalid_properties = Array.new
55
+ return invalid_properties
56
+ end
57
+
58
+ # Check to see if the all the properties in the model are valid
59
+ # @return true if the model is valid
60
+ def valid?
61
+ return true
46
62
  end
47
63
 
48
64
  # Checks equality by comparing each attribute.
49
- # @param [Object] Object to be compared
65
+ # @param [Object] Object to be compared
50
66
  def ==(o)
51
67
  return true if self.equal?(o)
52
68
  self.class == o.class &&
@@ -54,7 +70,7 @@ module AylienNewsApi
54
70
  end
55
71
 
56
72
  # @see the `==` method
57
- # @param [Object] Object to be compared
73
+ # @param [Object] Object to be compared
58
74
  def eql?(o)
59
75
  self == o
60
76
  end
@@ -153,7 +169,7 @@ module AylienNewsApi
153
169
 
154
170
  # Outputs non-array value in the form of hash
155
171
  # For object, use to_hash. Otherwise, just return the value
156
- # @param [Object] value Any valid value
172
+ # @param [Object] value Any valid value
157
173
  # @return [Hash] Returns the value in the form of hash
158
174
  def _to_hash(value)
159
175
  if value.is_a?(Array)
@@ -170,4 +186,5 @@ module AylienNewsApi
170
186
  end
171
187
 
172
188
  end
189
+
173
190
  end
@@ -15,9 +15,11 @@
15
15
  require 'date'
16
16
 
17
17
  module AylienNewsApi
18
+
18
19
  class Errors
19
20
  attr_accessor :errors
20
21
 
22
+
21
23
  # Attribute mapping from ruby-style variable name to JSON key.
22
24
  def self.attribute_map
23
25
  {
@@ -40,15 +42,29 @@ module AylienNewsApi
40
42
  # convert string to symbol for hash key
41
43
  attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
42
44
 
43
- if attributes[:'errors']
45
+ if attributes.has_key?(:'errors')
44
46
  if (value = attributes[:'errors']).is_a?(Array)
45
47
  self.errors = value
46
48
  end
47
49
  end
50
+
51
+ end
52
+
53
+ # Show invalid properties with the reasons. Usually used together with valid?
54
+ # @return Array for valid properies with the reasons
55
+ def list_invalid_properties
56
+ invalid_properties = Array.new
57
+ return invalid_properties
58
+ end
59
+
60
+ # Check to see if the all the properties in the model are valid
61
+ # @return true if the model is valid
62
+ def valid?
63
+ return true
48
64
  end
49
65
 
50
66
  # Checks equality by comparing each attribute.
51
- # @param [Object] Object to be compared
67
+ # @param [Object] Object to be compared
52
68
  def ==(o)
53
69
  return true if self.equal?(o)
54
70
  self.class == o.class &&
@@ -56,7 +72,7 @@ module AylienNewsApi
56
72
  end
57
73
 
58
74
  # @see the `==` method
59
- # @param [Object] Object to be compared
75
+ # @param [Object] Object to be compared
60
76
  def eql?(o)
61
77
  self == o
62
78
  end
@@ -155,7 +171,7 @@ module AylienNewsApi
155
171
 
156
172
  # Outputs non-array value in the form of hash
157
173
  # For object, use to_hash. Otherwise, just return the value
158
- # @param [Object] value Any valid value
174
+ # @param [Object] value Any valid value
159
175
  # @return [Hash] Returns the value in the form of hash
160
176
  def _to_hash(value)
161
177
  if value.is_a?(Array)
@@ -172,4 +188,5 @@ module AylienNewsApi
172
188
  end
173
189
 
174
190
  end
191
+
175
192
  end
@@ -15,6 +15,7 @@
15
15
  require 'date'
16
16
 
17
17
  module AylienNewsApi
18
+
18
19
  class HistogramInterval
19
20
  # Histogram bin
20
21
  attr_accessor :bin
@@ -22,6 +23,7 @@ module AylienNewsApi
22
23
  # Histogram bin size
23
24
  attr_accessor :count
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[:'bin']
51
+ if attributes.has_key?(:'bin')
50
52
  self.bin = attributes[:'bin']
51
53
  end
52
- if attributes[:'count']
54
+
55
+ if attributes.has_key?(:'count')
53
56
  self.count = attributes[:'count']
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
@@ -15,6 +15,7 @@
15
15
  require 'date'
16
16
 
17
17
  module AylienNewsApi
18
+
18
19
  class Histograms
19
20
  # The intervals of the histograms
20
21
  attr_accessor :intervals
@@ -30,6 +31,7 @@ module AylienNewsApi
30
31
 
31
32
  attr_accessor :field
32
33
 
34
+
33
35
  # Attribute mapping from ruby-style variable name to JSON key.
34
36
  def self.attribute_map
35
37
  {
@@ -60,27 +62,45 @@ 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[:'intervals']
65
+ if attributes.has_key?(:'intervals')
64
66
  if (value = attributes[:'intervals']).is_a?(Array)
65
67
  self.intervals = value
66
68
  end
67
69
  end
68
- if attributes[:'interval.start']
70
+
71
+ if attributes.has_key?(:'interval.start')
69
72
  self.interval_start = attributes[:'interval.start']
70
73
  end
71
- if attributes[:'interval.end']
74
+
75
+ if attributes.has_key?(:'interval.end')
72
76
  self.interval_end = attributes[:'interval.end']
73
77
  end
74
- if attributes[:'interval.width']
78
+
79
+ if attributes.has_key?(:'interval.width')
75
80
  self.interval_width = attributes[:'interval.width']
76
81
  end
77
- if attributes[:'field']
82
+
83
+ if attributes.has_key?(:'field')
78
84
  self.field = attributes[:'field']
79
85
  end
86
+
87
+ end
88
+
89
+ # Show invalid properties with the reasons. Usually used together with valid?
90
+ # @return Array for valid properies with the reasons
91
+ def list_invalid_properties
92
+ invalid_properties = Array.new
93
+ return invalid_properties
94
+ end
95
+
96
+ # Check to see if the all the properties in the model are valid
97
+ # @return true if the model is valid
98
+ def valid?
99
+ return true
80
100
  end
81
101
 
82
102
  # Checks equality by comparing each attribute.
83
- # @param [Object] Object to be compared
103
+ # @param [Object] Object to be compared
84
104
  def ==(o)
85
105
  return true if self.equal?(o)
86
106
  self.class == o.class &&
@@ -92,7 +112,7 @@ module AylienNewsApi
92
112
  end
93
113
 
94
114
  # @see the `==` method
95
- # @param [Object] Object to be compared
115
+ # @param [Object] Object to be compared
96
116
  def eql?(o)
97
117
  self == o
98
118
  end
@@ -191,7 +211,7 @@ module AylienNewsApi
191
211
 
192
212
  # Outputs non-array value in the form of hash
193
213
  # For object, use to_hash. Otherwise, just return the value
194
- # @param [Object] value Any valid value
214
+ # @param [Object] value Any valid value
195
215
  # @return [Hash] Returns the value in the form of hash
196
216
  def _to_hash(value)
197
217
  if value.is_a?(Array)
@@ -208,4 +228,5 @@ module AylienNewsApi
208
228
  end
209
229
 
210
230
  end
231
+
211
232
  end
@@ -15,6 +15,7 @@
15
15
  require 'date'
16
16
 
17
17
  module AylienNewsApi
18
+
18
19
  class Location
19
20
  # The country code of the location. It supports [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country codes.
20
21
  attr_accessor :country
@@ -25,6 +26,7 @@ module AylienNewsApi
25
26
  # The city of the location
26
27
  attr_accessor :city
27
28
 
29
+
28
30
  # Attribute mapping from ruby-style variable name to JSON key.
29
31
  def self.attribute_map
30
32
  {
@@ -51,19 +53,35 @@ module AylienNewsApi
51
53
  # convert string to symbol for hash key
52
54
  attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
53
55
 
54
- if attributes[:'country']
56
+ if attributes.has_key?(:'country')
55
57
  self.country = attributes[:'country']
56
58
  end
57
- if attributes[:'state']
59
+
60
+ if attributes.has_key?(:'state')
58
61
  self.state = attributes[:'state']
59
62
  end
60
- if attributes[:'city']
63
+
64
+ if attributes.has_key?(:'city')
61
65
  self.city = attributes[:'city']
62
66
  end
67
+
68
+ end
69
+
70
+ # Show invalid properties with the reasons. Usually used together with valid?
71
+ # @return Array for valid properies with the reasons
72
+ def list_invalid_properties
73
+ invalid_properties = Array.new
74
+ return invalid_properties
75
+ end
76
+
77
+ # Check to see if the all the properties in the model are valid
78
+ # @return true if the model is valid
79
+ def valid?
80
+ return true
63
81
  end
64
82
 
65
83
  # Checks equality by comparing each attribute.
66
- # @param [Object] Object to be compared
84
+ # @param [Object] Object to be compared
67
85
  def ==(o)
68
86
  return true if self.equal?(o)
69
87
  self.class == o.class &&
@@ -73,7 +91,7 @@ module AylienNewsApi
73
91
  end
74
92
 
75
93
  # @see the `==` method
76
- # @param [Object] Object to be compared
94
+ # @param [Object] Object to be compared
77
95
  def eql?(o)
78
96
  self == o
79
97
  end
@@ -172,7 +190,7 @@ module AylienNewsApi
172
190
 
173
191
  # Outputs non-array value in the form of hash
174
192
  # For object, use to_hash. Otherwise, just return the value
175
- # @param [Object] value Any valid value
193
+ # @param [Object] value Any valid value
176
194
  # @return [Hash] Returns the value in the form of hash
177
195
  def _to_hash(value)
178
196
  if value.is_a?(Array)
@@ -189,4 +207,5 @@ module AylienNewsApi
189
207
  end
190
208
 
191
209
  end
210
+
192
211
  end
@@ -15,13 +15,36 @@
15
15
  require 'date'
16
16
 
17
17
  module AylienNewsApi
18
+
18
19
  class Media
19
- # Type of the media
20
+ # The type of media
20
21
  attr_accessor :type
21
22
 
22
23
  # A URL which points to the media file
23
24
  attr_accessor :url
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,43 @@ 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[:'type']
72
+ if attributes.has_key?(:'type')
50
73
  self.type = attributes[:'type']
51
74
  end
52
- if attributes[:'url']
75
+
76
+ if attributes.has_key?(:'url')
53
77
  self.url = attributes[:'url']
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
+ type_validator = EnumAttributeValidator.new('String', ["image", "video"])
93
+ return false unless type_validator.valid?(@type)
94
+ return true
55
95
  end
56
96
 
57
97
  # Custom attribute writer method checking allowed values (enum).
58
98
  # @param [Object] type Object to be assigned
59
99
  def type=(type)
60
- allowed_values = ["image", "video"]
61
- if type && !allowed_values.include?(type)
62
- fail "invalid value for 'type', must be one of #{allowed_values}"
100
+ validator = EnumAttributeValidator.new('String', ["image", "video"])
101
+ unless validator.valid?(type)
102
+ fail ArgumentError, "invalid value for 'type', must be one of #{validator.allowable_values}."
63
103
  end
64
104
  @type = type
65
105
  end
66
106
 
67
107
  # Checks equality by comparing each attribute.
68
- # @param [Object] Object to be compared
108
+ # @param [Object] Object to be compared
69
109
  def ==(o)
70
110
  return true if self.equal?(o)
71
111
  self.class == o.class &&
@@ -74,7 +114,7 @@ module AylienNewsApi
74
114
  end
75
115
 
76
116
  # @see the `==` method
77
- # @param [Object] Object to be compared
117
+ # @param [Object] Object to be compared
78
118
  def eql?(o)
79
119
  self == o
80
120
  end
@@ -173,7 +213,7 @@ module AylienNewsApi
173
213
 
174
214
  # Outputs non-array value in the form of hash
175
215
  # For object, use to_hash. Otherwise, just return the value
176
- # @param [Object] value Any valid value
216
+ # @param [Object] value Any valid value
177
217
  # @return [Hash] Returns the value in the form of hash
178
218
  def _to_hash(value)
179
219
  if value.is_a?(Array)
@@ -190,4 +230,5 @@ module AylienNewsApi
190
230
  end
191
231
 
192
232
  end
233
+
193
234
  end