aylien_news_api 0.4.0 → 4.1.1

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 (160) hide show
  1. checksums.yaml +5 -5
  2. data/Gemfile +7 -1
  3. data/README.md +117 -4
  4. data/Rakefile +10 -0
  5. data/aylien_news_api.gemspec +20 -28
  6. data/docs/Author.md +12 -1
  7. data/docs/Autocomplete.md +10 -0
  8. data/docs/Autocompletes.md +9 -0
  9. data/docs/Category.md +19 -3
  10. data/docs/CategoryLinks.md +11 -1
  11. data/docs/CategoryTaxonomy.md +16 -0
  12. data/docs/Cluster.md +29 -0
  13. data/docs/Clusters.md +21 -0
  14. data/docs/Coverages.md +16 -4
  15. data/docs/DefaultApi.md +1299 -826
  16. data/docs/Entities.md +11 -1
  17. data/docs/Entity.md +16 -3
  18. data/docs/EntityLinks.md +9 -0
  19. data/docs/Error.md +16 -2
  20. data/docs/ErrorLinks.md +11 -0
  21. data/docs/Errors.md +9 -0
  22. data/docs/HistogramInterval.md +10 -0
  23. data/docs/Histograms.md +20 -3
  24. data/docs/Location.md +13 -2
  25. data/docs/Media.md +18 -4
  26. data/docs/MediaFormat.md +16 -0
  27. data/docs/MediaType.md +16 -0
  28. data/docs/Rank.md +12 -1
  29. data/docs/Rankings.md +9 -0
  30. data/docs/RelatedStories.md +18 -3
  31. data/docs/RepresentativeStory.md +23 -0
  32. data/docs/Scope.md +15 -3
  33. data/docs/ScopeLevel.md +16 -0
  34. data/docs/Sentiment.md +11 -1
  35. data/docs/SentimentPolarity.md +16 -0
  36. data/docs/Sentiments.md +12 -2
  37. data/docs/ShareCount.md +10 -0
  38. data/docs/ShareCounts.md +12 -0
  39. data/docs/Source.md +27 -8
  40. data/docs/Stories.md +17 -2
  41. data/docs/Story.md +48 -16
  42. data/docs/StoryCluster.md +14 -1
  43. data/docs/StoryLinks.md +14 -1
  44. data/docs/StoryTranslation.md +19 -0
  45. data/docs/StoryTranslations.md +17 -0
  46. data/docs/StoryTranslationsEn.md +21 -0
  47. data/docs/Summary.md +9 -0
  48. data/docs/TimeSeries.md +11 -1
  49. data/docs/TimeSeriesList.md +15 -3
  50. data/docs/Trend.md +11 -1
  51. data/docs/Trends.md +15 -1
  52. data/docs/Warning.md +21 -0
  53. data/git_push.sh +58 -0
  54. data/lib/aylien_news_api.rb +22 -14
  55. data/lib/aylien_news_api/api/default_api.rb +2407 -1520
  56. data/lib/aylien_news_api/api_client.rb +137 -111
  57. data/lib/aylien_news_api/api_error.rb +37 -18
  58. data/lib/aylien_news_api/configuration.rb +74 -36
  59. data/lib/aylien_news_api/models/author.rb +66 -50
  60. data/lib/aylien_news_api/models/autocomplete.rb +52 -36
  61. data/lib/aylien_news_api/models/autocompletes.rb +51 -35
  62. data/lib/aylien_news_api/models/category.rb +85 -94
  63. data/lib/aylien_news_api/models/category_links.rb +63 -47
  64. data/lib/aylien_news_api/models/category_taxonomy.rb +36 -0
  65. data/lib/aylien_news_api/models/cluster.rb +265 -0
  66. data/lib/aylien_news_api/models/clusters.rb +229 -0
  67. data/lib/aylien_news_api/models/coverages.rb +76 -72
  68. data/lib/aylien_news_api/models/entities.rb +64 -48
  69. data/lib/aylien_news_api/models/entity.rb +93 -79
  70. data/lib/aylien_news_api/models/entity_links.rb +51 -35
  71. data/lib/aylien_news_api/models/error.rb +76 -60
  72. data/lib/aylien_news_api/models/error_links.rb +62 -37
  73. data/lib/aylien_news_api/models/errors.rb +51 -35
  74. data/lib/aylien_news_api/models/histogram_interval.rb +52 -36
  75. data/lib/aylien_news_api/models/histograms.rb +96 -60
  76. data/lib/aylien_news_api/models/location.rb +67 -51
  77. data/lib/aylien_news_api/models/media.rb +83 -114
  78. data/lib/aylien_news_api/models/media_format.rb +44 -0
  79. data/lib/aylien_news_api/models/media_type.rb +36 -0
  80. data/lib/aylien_news_api/models/rank.rb +64 -48
  81. data/lib/aylien_news_api/models/rankings.rb +51 -35
  82. data/lib/aylien_news_api/models/related_stories.rb +84 -60
  83. data/lib/aylien_news_api/models/representative_story.rb +237 -0
  84. data/lib/aylien_news_api/models/scope.rb +73 -91
  85. data/lib/aylien_news_api/models/scope_level.rb +37 -0
  86. data/lib/aylien_news_api/models/sentiment.rb +63 -82
  87. data/lib/aylien_news_api/models/sentiment_polarity.rb +37 -0
  88. data/lib/aylien_news_api/models/sentiments.rb +62 -48
  89. data/lib/aylien_news_api/models/share_count.rb +52 -36
  90. data/lib/aylien_news_api/models/share_counts.rb +54 -38
  91. data/lib/aylien_news_api/models/source.rb +111 -96
  92. data/lib/aylien_news_api/models/stories.rb +86 -50
  93. data/lib/aylien_news_api/models/story.rb +188 -158
  94. data/lib/aylien_news_api/models/story_cluster.rb +68 -52
  95. data/lib/aylien_news_api/models/story_links.rb +70 -44
  96. data/lib/aylien_news_api/models/story_translation.rb +217 -0
  97. data/lib/aylien_news_api/models/story_translations.rb +207 -0
  98. data/lib/aylien_news_api/models/story_translations_en.rb +227 -0
  99. data/lib/aylien_news_api/models/summary.rb +51 -35
  100. data/lib/aylien_news_api/models/time_series.rb +63 -47
  101. data/lib/aylien_news_api/models/time_series_list.rb +72 -56
  102. data/lib/aylien_news_api/models/trend.rb +63 -47
  103. data/lib/aylien_news_api/models/trends.rb +77 -41
  104. data/lib/aylien_news_api/models/warning.rb +226 -0
  105. data/lib/aylien_news_api/version.rb +12 -14
  106. data/spec/api/default_api_spec.rb +620 -284
  107. data/spec/api_client_spec.rb +43 -161
  108. data/spec/configuration_spec.rb +22 -19
  109. data/spec/models/author_spec.rb +21 -34
  110. data/spec/models/autocomplete_spec.rb +17 -26
  111. data/spec/models/autocompletes_spec.rb +16 -21
  112. data/spec/models/category_links_spec.rb +19 -28
  113. data/spec/models/category_spec.rb +31 -50
  114. data/spec/models/category_taxonomy_spec.rb +35 -0
  115. data/spec/models/cluster_spec.rb +77 -0
  116. data/spec/models/clusters_spec.rb +53 -0
  117. data/spec/models/coverages_spec.rb +24 -45
  118. data/spec/models/entities_spec.rb +19 -28
  119. data/spec/models/entity_links_spec.rb +16 -21
  120. data/spec/models/entity_spec.rb +25 -46
  121. data/spec/models/error_links_spec.rb +22 -21
  122. data/spec/models/error_spec.rb +27 -52
  123. data/spec/models/errors_spec.rb +16 -21
  124. data/spec/models/histogram_interval_spec.rb +17 -26
  125. data/spec/models/histograms_spec.rb +36 -45
  126. data/spec/models/location_spec.rb +21 -34
  127. data/spec/models/media_format_spec.rb +35 -0
  128. data/spec/models/media_spec.rb +41 -26
  129. data/spec/models/media_type_spec.rb +35 -0
  130. data/spec/models/rank_spec.rb +20 -21
  131. data/spec/models/rankings_spec.rb +15 -16
  132. data/spec/models/related_stories_spec.rb +33 -38
  133. data/spec/models/representative_story_spec.rb +59 -0
  134. data/spec/models/scope_level_spec.rb +35 -0
  135. data/spec/models/scope_spec.rb +23 -40
  136. data/spec/models/sentiment_polarity_spec.rb +35 -0
  137. data/spec/models/sentiment_spec.rb +17 -26
  138. data/spec/models/sentiments_spec.rb +19 -28
  139. data/spec/models/share_count_spec.rb +17 -26
  140. data/spec/models/share_counts_spec.rb +19 -36
  141. data/spec/models/source_spec.rb +54 -49
  142. data/spec/models/stories_spec.rb +32 -33
  143. data/spec/models/story_cluster_spec.rb +23 -44
  144. data/spec/models/story_links_spec.rb +25 -32
  145. data/spec/models/story_spec.rb +65 -134
  146. data/spec/models/story_translation_spec.rb +47 -0
  147. data/spec/models/story_translations_en_spec.rb +53 -0
  148. data/spec/models/story_translations_spec.rb +41 -0
  149. data/spec/models/summary_spec.rb +16 -21
  150. data/spec/models/time_series_list_spec.rb +22 -39
  151. data/spec/models/time_series_spec.rb +19 -28
  152. data/spec/models/trend_spec.rb +19 -28
  153. data/spec/models/trends_spec.rb +30 -27
  154. data/spec/models/warning_spec.rb +53 -0
  155. data/spec/spec_helper.rb +11 -13
  156. metadata +91 -192
  157. data/Gemfile.lock +0 -65
  158. data/LICENSE +0 -13
  159. data/aylien_news_api-0.2.0.gem +0 -0
  160. data/aylien_news_api-0.3.0.gem +0 -0
@@ -1,25 +1,21 @@
1
- # Copyright 2016 Aylien, Inc. All Rights Reserved.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
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 Errors
20
17
  attr_accessor :errors
21
18
 
22
-
23
19
  # Attribute mapping from ruby-style variable name to JSON key.
24
20
  def self.attribute_map
25
21
  {
@@ -28,39 +24,51 @@ module AylienNewsApi
28
24
  end
29
25
 
30
26
  # Attribute type mapping.
31
- def self.api_types
27
+ def self.openapi_types
32
28
  {
33
29
  :'errors' => :'Array<Error>'
34
30
  }
35
31
  end
36
32
 
33
+ # List of attributes with nullable: true
34
+ def self.openapi_nullable
35
+ Set.new([
36
+ ])
37
+ end
38
+
37
39
  # Initializes the object
38
40
  # @param [Hash] attributes Model attributes in the form of hash
39
41
  def initialize(attributes = {})
40
- return unless attributes.is_a?(Hash)
42
+ if (!attributes.is_a?(Hash))
43
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::Errors` initialize method"
44
+ end
41
45
 
42
- # convert string to symbol for hash key
43
- attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
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::Errors`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
50
+ end
51
+ h[k.to_sym] = v
52
+ }
44
53
 
45
- if attributes.has_key?(:'errors')
54
+ if attributes.key?(:'errors')
46
55
  if (value = attributes[:'errors']).is_a?(Array)
47
56
  self.errors = value
48
57
  end
49
58
  end
50
-
51
59
  end
52
60
 
53
61
  # Show invalid properties with the reasons. Usually used together with valid?
54
- # @return Array for valid properies with the reasons
62
+ # @return Array for valid properties with the reasons
55
63
  def list_invalid_properties
56
64
  invalid_properties = Array.new
57
- return invalid_properties
65
+ invalid_properties
58
66
  end
59
67
 
60
68
  # Check to see if the all the properties in the model are valid
61
69
  # @return true if the model is valid
62
70
  def valid?
63
- return true
71
+ true
64
72
  end
65
73
 
66
74
  # Checks equality by comparing each attribute.
@@ -78,22 +86,29 @@ module AylienNewsApi
78
86
  end
79
87
 
80
88
  # Calculates hash code according to all attributes.
81
- # @return [Fixnum] Hash code
89
+ # @return [Integer] Hash code
82
90
  def hash
83
91
  [errors].hash
84
92
  end
85
93
 
94
+ # Builds the object from hash
95
+ # @param [Hash] attributes Model attributes in the form of hash
96
+ # @return [Object] Returns the model itself
97
+ def self.build_from_hash(attributes)
98
+ new.build_from_hash(attributes)
99
+ end
100
+
86
101
  # Builds the object from hash
87
102
  # @param [Hash] attributes Model attributes in the form of hash
88
103
  # @return [Object] Returns the model itself
89
104
  def build_from_hash(attributes)
90
105
  return nil unless attributes.is_a?(Hash)
91
- self.class.api_types.each_pair do |key, type|
106
+ self.class.openapi_types.each_pair do |key, type|
92
107
  if type =~ /\AArray<(.*)>/i
93
- # check to ensure the input is an array given that the the attribute
108
+ # check to ensure the input is an array given that the attribute
94
109
  # is documented as an array but the input is not
95
110
  if attributes[self.class.attribute_map[key]].is_a?(Array)
96
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
111
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
97
112
  end
98
113
  elsif !attributes[self.class.attribute_map[key]].nil?
99
114
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
@@ -119,7 +134,7 @@ module AylienNewsApi
119
134
  value.to_i
120
135
  when :Float
121
136
  value.to_f
122
- when :BOOLEAN
137
+ when :Boolean
123
138
  if value.to_s =~ /\A(true|t|yes|y|1)\z/i
124
139
  true
125
140
  else
@@ -140,8 +155,7 @@ module AylienNewsApi
140
155
  end
141
156
  end
142
157
  else # model
143
- temp_model = AylienNewsApi.const_get(type).new
144
- temp_model.build_from_hash(value)
158
+ AylienNewsApi.const_get(type).build_from_hash(value)
145
159
  end
146
160
  end
147
161
 
@@ -163,7 +177,11 @@ module AylienNewsApi
163
177
  hash = {}
164
178
  self.class.attribute_map.each_pair do |attr, param|
165
179
  value = self.send(attr)
166
- next if value.nil?
180
+ if value.nil?
181
+ is_nullable = self.class.openapi_nullable.include?(attr)
182
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
183
+ end
184
+
167
185
  hash[param] = _to_hash(value)
168
186
  end
169
187
  hash
@@ -175,7 +193,7 @@ module AylienNewsApi
175
193
  # @return [Hash] Returns the value in the form of hash
176
194
  def _to_hash(value)
177
195
  if value.is_a?(Array)
178
- value.compact.map{ |v| _to_hash(v) }
196
+ value.compact.map { |v| _to_hash(v) }
179
197
  elsif value.is_a?(Hash)
180
198
  {}.tap do |hash|
181
199
  value.each { |k, v| hash[k] = _to_hash(v) }
@@ -186,7 +204,5 @@ module AylienNewsApi
186
204
  value
187
205
  end
188
206
  end
189
-
190
207
  end
191
-
192
208
  end
@@ -1,21 +1,18 @@
1
- # Copyright 2016 Aylien, Inc. All Rights Reserved.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
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 HistogramInterval
20
17
  # Histogram bin
21
18
  attr_accessor :bin
@@ -23,7 +20,6 @@ module AylienNewsApi
23
20
  # Histogram bin size
24
21
  attr_accessor :count
25
22
 
26
-
27
23
  # Attribute mapping from ruby-style variable name to JSON key.
28
24
  def self.attribute_map
29
25
  {
@@ -33,42 +29,54 @@ module AylienNewsApi
33
29
  end
34
30
 
35
31
  # Attribute type mapping.
36
- def self.api_types
32
+ def self.openapi_types
37
33
  {
38
34
  :'bin' => :'Integer',
39
35
  :'count' => :'Integer'
40
36
  }
41
37
  end
42
38
 
39
+ # List of attributes with nullable: true
40
+ def self.openapi_nullable
41
+ Set.new([
42
+ ])
43
+ end
44
+
43
45
  # Initializes the object
44
46
  # @param [Hash] attributes Model attributes in the form of hash
45
47
  def initialize(attributes = {})
46
- return unless attributes.is_a?(Hash)
48
+ if (!attributes.is_a?(Hash))
49
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::HistogramInterval` initialize method"
50
+ end
47
51
 
48
- # convert string to symbol for hash key
49
- attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
52
+ # check to see if the attribute exists and convert string to symbol for hash key
53
+ attributes = attributes.each_with_object({}) { |(k, v), h|
54
+ if (!self.class.attribute_map.key?(k.to_sym))
55
+ fail ArgumentError, "`#{k}` is not a valid attribute in `AylienNewsApi::HistogramInterval`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
+ end
57
+ h[k.to_sym] = v
58
+ }
50
59
 
51
- if attributes.has_key?(:'bin')
60
+ if attributes.key?(:'bin')
52
61
  self.bin = attributes[:'bin']
53
62
  end
54
63
 
55
- if attributes.has_key?(:'count')
64
+ if attributes.key?(:'count')
56
65
  self.count = attributes[:'count']
57
66
  end
58
-
59
67
  end
60
68
 
61
69
  # Show invalid properties with the reasons. Usually used together with valid?
62
- # @return Array for valid properies with the reasons
70
+ # @return Array for valid properties with the reasons
63
71
  def list_invalid_properties
64
72
  invalid_properties = Array.new
65
- return invalid_properties
73
+ invalid_properties
66
74
  end
67
75
 
68
76
  # Check to see if the all the properties in the model are valid
69
77
  # @return true if the model is valid
70
78
  def valid?
71
- return true
79
+ true
72
80
  end
73
81
 
74
82
  # Checks equality by comparing each attribute.
@@ -87,22 +95,29 @@ module AylienNewsApi
87
95
  end
88
96
 
89
97
  # Calculates hash code according to all attributes.
90
- # @return [Fixnum] Hash code
98
+ # @return [Integer] Hash code
91
99
  def hash
92
100
  [bin, count].hash
93
101
  end
94
102
 
103
+ # Builds the object from hash
104
+ # @param [Hash] attributes Model attributes in the form of hash
105
+ # @return [Object] Returns the model itself
106
+ def self.build_from_hash(attributes)
107
+ new.build_from_hash(attributes)
108
+ end
109
+
95
110
  # Builds the object from hash
96
111
  # @param [Hash] attributes Model attributes in the form of hash
97
112
  # @return [Object] Returns the model itself
98
113
  def build_from_hash(attributes)
99
114
  return nil unless attributes.is_a?(Hash)
100
- self.class.api_types.each_pair do |key, type|
115
+ self.class.openapi_types.each_pair do |key, type|
101
116
  if type =~ /\AArray<(.*)>/i
102
- # check to ensure the input is an array given that the the attribute
117
+ # check to ensure the input is an array given that the attribute
103
118
  # is documented as an array but the input is not
104
119
  if attributes[self.class.attribute_map[key]].is_a?(Array)
105
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
120
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
106
121
  end
107
122
  elsif !attributes[self.class.attribute_map[key]].nil?
108
123
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
@@ -128,7 +143,7 @@ module AylienNewsApi
128
143
  value.to_i
129
144
  when :Float
130
145
  value.to_f
131
- when :BOOLEAN
146
+ when :Boolean
132
147
  if value.to_s =~ /\A(true|t|yes|y|1)\z/i
133
148
  true
134
149
  else
@@ -149,8 +164,7 @@ module AylienNewsApi
149
164
  end
150
165
  end
151
166
  else # model
152
- temp_model = AylienNewsApi.const_get(type).new
153
- temp_model.build_from_hash(value)
167
+ AylienNewsApi.const_get(type).build_from_hash(value)
154
168
  end
155
169
  end
156
170
 
@@ -172,7 +186,11 @@ module AylienNewsApi
172
186
  hash = {}
173
187
  self.class.attribute_map.each_pair do |attr, param|
174
188
  value = self.send(attr)
175
- next if value.nil?
189
+ if value.nil?
190
+ is_nullable = self.class.openapi_nullable.include?(attr)
191
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
192
+ end
193
+
176
194
  hash[param] = _to_hash(value)
177
195
  end
178
196
  hash
@@ -184,7 +202,7 @@ module AylienNewsApi
184
202
  # @return [Hash] Returns the value in the form of hash
185
203
  def _to_hash(value)
186
204
  if value.is_a?(Array)
187
- value.compact.map{ |v| _to_hash(v) }
205
+ value.compact.map { |v| _to_hash(v) }
188
206
  elsif value.is_a?(Hash)
189
207
  {}.tap do |hash|
190
208
  value.each { |k, v| hash[k] = _to_hash(v) }
@@ -195,7 +213,5 @@ module AylienNewsApi
195
213
  value
196
214
  end
197
215
  end
198
-
199
216
  end
200
-
201
217
  end
@@ -1,102 +1,128 @@
1
- # Copyright 2016 Aylien, Inc. All Rights Reserved.
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
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 Histograms
20
- # The intervals of the histograms
21
- attr_accessor :intervals
22
-
23
- # The start interval of the histogram
24
- attr_accessor :interval_start
17
+ attr_accessor :field
25
18
 
26
19
  # The end interval of the histogram
27
20
  attr_accessor :interval_end
28
21
 
22
+ # The start interval of the histogram
23
+ attr_accessor :interval_start
24
+
29
25
  # The width of the histogram
30
26
  attr_accessor :interval_width
31
27
 
32
- attr_accessor :field
28
+ # The intervals of the histograms
29
+ attr_accessor :intervals
33
30
 
31
+ # The end of a period in which searched stories were published
32
+ attr_accessor :published_at_end
33
+
34
+ # The start of a period in which searched stories were published
35
+ attr_accessor :published_at_start
34
36
 
35
37
  # Attribute mapping from ruby-style variable name to JSON key.
36
38
  def self.attribute_map
37
39
  {
38
- :'intervals' => :'intervals',
39
- :'interval_start' => :'interval.start',
40
+ :'field' => :'field',
40
41
  :'interval_end' => :'interval.end',
42
+ :'interval_start' => :'interval.start',
41
43
  :'interval_width' => :'interval.width',
42
- :'field' => :'field'
44
+ :'intervals' => :'intervals',
45
+ :'published_at_end' => :'published_at.end',
46
+ :'published_at_start' => :'published_at.start'
43
47
  }
44
48
  end
45
49
 
46
50
  # Attribute type mapping.
47
- def self.api_types
51
+ def self.openapi_types
48
52
  {
49
- :'intervals' => :'Array<HistogramInterval>',
50
- :'interval_start' => :'Integer',
53
+ :'field' => :'String',
51
54
  :'interval_end' => :'Integer',
55
+ :'interval_start' => :'Integer',
52
56
  :'interval_width' => :'Integer',
53
- :'field' => :'String'
57
+ :'intervals' => :'Array<HistogramInterval>',
58
+ :'published_at_end' => :'DateTime',
59
+ :'published_at_start' => :'DateTime'
54
60
  }
55
61
  end
56
62
 
63
+ # List of attributes with nullable: true
64
+ def self.openapi_nullable
65
+ Set.new([
66
+ ])
67
+ end
68
+
57
69
  # Initializes the object
58
70
  # @param [Hash] attributes Model attributes in the form of hash
59
71
  def initialize(attributes = {})
60
- return unless attributes.is_a?(Hash)
61
-
62
- # convert string to symbol for hash key
63
- attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
72
+ if (!attributes.is_a?(Hash))
73
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::Histograms` initialize method"
74
+ end
64
75
 
65
- if attributes.has_key?(:'intervals')
66
- if (value = attributes[:'intervals']).is_a?(Array)
67
- self.intervals = value
76
+ # check to see if the attribute exists and convert string to symbol for hash key
77
+ attributes = attributes.each_with_object({}) { |(k, v), h|
78
+ if (!self.class.attribute_map.key?(k.to_sym))
79
+ fail ArgumentError, "`#{k}` is not a valid attribute in `AylienNewsApi::Histograms`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
68
80
  end
81
+ h[k.to_sym] = v
82
+ }
83
+
84
+ if attributes.key?(:'field')
85
+ self.field = attributes[:'field']
69
86
  end
70
87
 
71
- if attributes.has_key?(:'interval.start')
72
- self.interval_start = attributes[:'interval.start']
88
+ if attributes.key?(:'interval_end')
89
+ self.interval_end = attributes[:'interval_end']
73
90
  end
74
91
 
75
- if attributes.has_key?(:'interval.end')
76
- self.interval_end = attributes[:'interval.end']
92
+ if attributes.key?(:'interval_start')
93
+ self.interval_start = attributes[:'interval_start']
77
94
  end
78
95
 
79
- if attributes.has_key?(:'interval.width')
80
- self.interval_width = attributes[:'interval.width']
96
+ if attributes.key?(:'interval_width')
97
+ self.interval_width = attributes[:'interval_width']
81
98
  end
82
99
 
83
- if attributes.has_key?(:'field')
84
- self.field = attributes[:'field']
100
+ if attributes.key?(:'intervals')
101
+ if (value = attributes[:'intervals']).is_a?(Array)
102
+ self.intervals = value
103
+ end
104
+ end
105
+
106
+ if attributes.key?(:'published_at_end')
107
+ self.published_at_end = attributes[:'published_at_end']
85
108
  end
86
109
 
110
+ if attributes.key?(:'published_at_start')
111
+ self.published_at_start = attributes[:'published_at_start']
112
+ end
87
113
  end
88
114
 
89
115
  # Show invalid properties with the reasons. Usually used together with valid?
90
- # @return Array for valid properies with the reasons
116
+ # @return Array for valid properties with the reasons
91
117
  def list_invalid_properties
92
118
  invalid_properties = Array.new
93
- return invalid_properties
119
+ invalid_properties
94
120
  end
95
121
 
96
122
  # Check to see if the all the properties in the model are valid
97
123
  # @return true if the model is valid
98
124
  def valid?
99
- return true
125
+ true
100
126
  end
101
127
 
102
128
  # Checks equality by comparing each attribute.
@@ -104,11 +130,13 @@ module AylienNewsApi
104
130
  def ==(o)
105
131
  return true if self.equal?(o)
106
132
  self.class == o.class &&
107
- intervals == o.intervals &&
108
- interval_start == o.interval_start &&
133
+ field == o.field &&
109
134
  interval_end == o.interval_end &&
135
+ interval_start == o.interval_start &&
110
136
  interval_width == o.interval_width &&
111
- field == o.field
137
+ intervals == o.intervals &&
138
+ published_at_end == o.published_at_end &&
139
+ published_at_start == o.published_at_start
112
140
  end
113
141
 
114
142
  # @see the `==` method
@@ -118,9 +146,16 @@ module AylienNewsApi
118
146
  end
119
147
 
120
148
  # Calculates hash code according to all attributes.
121
- # @return [Fixnum] Hash code
149
+ # @return [Integer] Hash code
122
150
  def hash
123
- [intervals, interval_start, interval_end, interval_width, field].hash
151
+ [field, interval_end, interval_start, interval_width, intervals, published_at_end, published_at_start].hash
152
+ end
153
+
154
+ # Builds the object from hash
155
+ # @param [Hash] attributes Model attributes in the form of hash
156
+ # @return [Object] Returns the model itself
157
+ def self.build_from_hash(attributes)
158
+ new.build_from_hash(attributes)
124
159
  end
125
160
 
126
161
  # Builds the object from hash
@@ -128,12 +163,12 @@ module AylienNewsApi
128
163
  # @return [Object] Returns the model itself
129
164
  def build_from_hash(attributes)
130
165
  return nil unless attributes.is_a?(Hash)
131
- self.class.api_types.each_pair do |key, type|
166
+ self.class.openapi_types.each_pair do |key, type|
132
167
  if type =~ /\AArray<(.*)>/i
133
- # check to ensure the input is an array given that the the attribute
168
+ # check to ensure the input is an array given that the attribute
134
169
  # is documented as an array but the input is not
135
170
  if attributes[self.class.attribute_map[key]].is_a?(Array)
136
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
171
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
137
172
  end
138
173
  elsif !attributes[self.class.attribute_map[key]].nil?
139
174
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
@@ -159,7 +194,7 @@ module AylienNewsApi
159
194
  value.to_i
160
195
  when :Float
161
196
  value.to_f
162
- when :BOOLEAN
197
+ when :Boolean
163
198
  if value.to_s =~ /\A(true|t|yes|y|1)\z/i
164
199
  true
165
200
  else
@@ -180,8 +215,7 @@ module AylienNewsApi
180
215
  end
181
216
  end
182
217
  else # model
183
- temp_model = AylienNewsApi.const_get(type).new
184
- temp_model.build_from_hash(value)
218
+ AylienNewsApi.const_get(type).build_from_hash(value)
185
219
  end
186
220
  end
187
221
 
@@ -203,7 +237,11 @@ module AylienNewsApi
203
237
  hash = {}
204
238
  self.class.attribute_map.each_pair do |attr, param|
205
239
  value = self.send(attr)
206
- next if value.nil?
240
+ if value.nil?
241
+ is_nullable = self.class.openapi_nullable.include?(attr)
242
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
243
+ end
244
+
207
245
  hash[param] = _to_hash(value)
208
246
  end
209
247
  hash
@@ -215,7 +253,7 @@ module AylienNewsApi
215
253
  # @return [Hash] Returns the value in the form of hash
216
254
  def _to_hash(value)
217
255
  if value.is_a?(Array)
218
- value.compact.map{ |v| _to_hash(v) }
256
+ value.compact.map { |v| _to_hash(v) }
219
257
  elsif value.is_a?(Hash)
220
258
  {}.tap do |hash|
221
259
  value.each { |k, v| hash[k] = _to_hash(v) }
@@ -226,7 +264,5 @@ module AylienNewsApi
226
264
  value
227
265
  end
228
266
  end
229
-
230
267
  end
231
-
232
268
  end