aylien_news_api 1.0.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (135) hide show
  1. checksums.yaml +5 -5
  2. data/Gemfile +6 -0
  3. data/README.md +117 -4
  4. data/Rakefile +2 -0
  5. data/aylien_news_api.gemspec +16 -27
  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 +17 -3
  10. data/docs/CategoryLinks.md +11 -1
  11. data/docs/Cluster.md +29 -0
  12. data/docs/Clusters.md +21 -0
  13. data/docs/Coverages.md +16 -4
  14. data/docs/DefaultApi.md +1250 -1117
  15. data/docs/Entities.md +11 -1
  16. data/docs/Entity.md +16 -3
  17. data/docs/EntityLinks.md +9 -0
  18. data/docs/Error.md +16 -2
  19. data/docs/ErrorLinks.md +9 -0
  20. data/docs/Errors.md +9 -0
  21. data/docs/HistogramInterval.md +10 -0
  22. data/docs/Histograms.md +16 -3
  23. data/docs/Location.md +13 -2
  24. data/docs/Media.md +17 -3
  25. data/docs/Rank.md +12 -1
  26. data/docs/Rankings.md +9 -0
  27. data/docs/RelatedStories.md +14 -3
  28. data/docs/RepresentativeStory.md +23 -0
  29. data/docs/Scope.md +14 -2
  30. data/docs/Sentiment.md +10 -0
  31. data/docs/Sentiments.md +12 -2
  32. data/docs/ShareCount.md +10 -0
  33. data/docs/ShareCounts.md +12 -0
  34. data/docs/Source.md +27 -8
  35. data/docs/Stories.md +11 -2
  36. data/docs/Story.md +48 -16
  37. data/docs/StoryCluster.md +14 -1
  38. data/docs/StoryLinks.md +14 -2
  39. data/docs/StoryTranslations.md +17 -0
  40. data/docs/StoryTranslationsEn.md +21 -0
  41. data/docs/Summary.md +9 -0
  42. data/docs/TimeSeries.md +11 -1
  43. data/docs/TimeSeriesList.md +15 -3
  44. data/docs/Trend.md +11 -1
  45. data/docs/Trends.md +11 -1
  46. data/git_push.sh +58 -0
  47. data/lib/aylien_news_api.rb +11 -10
  48. data/lib/aylien_news_api/api/default_api.rb +2065 -1801
  49. data/lib/aylien_news_api/api_client.rb +129 -108
  50. data/lib/aylien_news_api/api_error.rb +25 -10
  51. data/lib/aylien_news_api/configuration.rb +69 -33
  52. data/lib/aylien_news_api/models/author.rb +50 -46
  53. data/lib/aylien_news_api/models/autocomplete.rb +36 -32
  54. data/lib/aylien_news_api/models/autocompletes.rb +35 -31
  55. data/lib/aylien_news_api/models/category.rb +63 -59
  56. data/lib/aylien_news_api/models/category_links.rb +47 -43
  57. data/lib/aylien_news_api/models/cluster.rb +255 -0
  58. data/lib/aylien_news_api/models/clusters.rb +219 -0
  59. data/lib/aylien_news_api/models/coverages.rb +60 -68
  60. data/lib/aylien_news_api/models/entities.rb +48 -44
  61. data/lib/aylien_news_api/models/entity.rb +71 -69
  62. data/lib/aylien_news_api/models/entity_links.rb +35 -31
  63. data/lib/aylien_news_api/models/error.rb +60 -56
  64. data/lib/aylien_news_api/models/error_links.rb +35 -31
  65. data/lib/aylien_news_api/models/errors.rb +35 -31
  66. data/lib/aylien_news_api/models/histogram_interval.rb +36 -32
  67. data/lib/aylien_news_api/models/histograms.rb +62 -58
  68. data/lib/aylien_news_api/models/location.rb +51 -47
  69. data/lib/aylien_news_api/models/media.rb +81 -76
  70. data/lib/aylien_news_api/models/rank.rb +48 -44
  71. data/lib/aylien_news_api/models/rankings.rb +35 -31
  72. data/lib/aylien_news_api/models/related_stories.rb +53 -61
  73. data/lib/aylien_news_api/models/representative_story.rb +227 -0
  74. data/lib/aylien_news_api/models/scope.rb +59 -54
  75. data/lib/aylien_news_api/models/sentiment.rb +41 -37
  76. data/lib/aylien_news_api/models/sentiments.rb +46 -44
  77. data/lib/aylien_news_api/models/share_count.rb +36 -32
  78. data/lib/aylien_news_api/models/share_counts.rb +38 -34
  79. data/lib/aylien_news_api/models/source.rb +95 -92
  80. data/lib/aylien_news_api/models/stories.rb +47 -55
  81. data/lib/aylien_news_api/models/story.rb +172 -154
  82. data/lib/aylien_news_api/models/story_cluster.rb +52 -48
  83. data/lib/aylien_news_api/models/story_links.rb +58 -54
  84. data/lib/aylien_news_api/models/story_translations.rb +197 -0
  85. data/lib/aylien_news_api/models/story_translations_en.rb +217 -0
  86. data/lib/aylien_news_api/models/summary.rb +35 -31
  87. data/lib/aylien_news_api/models/time_series.rb +47 -43
  88. data/lib/aylien_news_api/models/time_series_list.rb +56 -52
  89. data/lib/aylien_news_api/models/trend.rb +47 -43
  90. data/lib/aylien_news_api/models/trends.rb +48 -44
  91. data/lib/aylien_news_api/version.rb +7 -11
  92. data/spec/api/default_api_spec.rb +569 -533
  93. data/spec/api_client_spec.rb +34 -76
  94. data/spec/configuration_spec.rb +14 -18
  95. data/spec/models/author_spec.rb +15 -18
  96. data/spec/models/autocomplete_spec.rb +11 -14
  97. data/spec/models/autocompletes_spec.rb +10 -13
  98. data/spec/models/category_links_spec.rb +13 -16
  99. data/spec/models/category_spec.rb +24 -27
  100. data/spec/models/cluster_spec.rb +77 -0
  101. data/spec/models/clusters_spec.rb +53 -0
  102. data/spec/models/coverages_spec.rb +17 -26
  103. data/spec/models/entities_spec.rb +13 -16
  104. data/spec/models/entity_links_spec.rb +10 -13
  105. data/spec/models/entity_spec.rb +19 -22
  106. data/spec/models/error_links_spec.rb +10 -13
  107. data/spec/models/error_spec.rb +21 -24
  108. data/spec/models/errors_spec.rb +10 -13
  109. data/spec/models/histogram_interval_spec.rb +11 -14
  110. data/spec/models/histograms_spec.rb +18 -21
  111. data/spec/models/location_spec.rb +15 -18
  112. data/spec/models/media_spec.rb +29 -32
  113. data/spec/models/rank_spec.rb +15 -18
  114. data/spec/models/rankings_spec.rb +10 -13
  115. data/spec/models/related_stories_spec.rb +15 -24
  116. data/spec/models/representative_story_spec.rb +59 -0
  117. data/spec/models/scope_spec.rb +21 -24
  118. data/spec/models/sentiment_spec.rb +15 -18
  119. data/spec/models/sentiments_spec.rb +13 -16
  120. data/spec/models/share_count_spec.rb +11 -14
  121. data/spec/models/share_counts_spec.rb +13 -16
  122. data/spec/models/source_spec.rb +29 -32
  123. data/spec/models/stories_spec.rb +13 -22
  124. data/spec/models/story_cluster_spec.rb +17 -20
  125. data/spec/models/story_links_spec.rb +17 -20
  126. data/spec/models/story_spec.rb +59 -50
  127. data/spec/models/story_translations_en_spec.rb +53 -0
  128. data/spec/models/story_translations_spec.rb +41 -0
  129. data/spec/models/summary_spec.rb +10 -13
  130. data/spec/models/time_series_list_spec.rb +16 -19
  131. data/spec/models/time_series_spec.rb +13 -16
  132. data/spec/models/trend_spec.rb +13 -16
  133. data/spec/models/trends_spec.rb +13 -16
  134. data/spec/spec_helper.rb +6 -10
  135. metadata +68 -194
@@ -1,27 +1,21 @@
1
1
  =begin
2
- Copyright 2017 Aylien, Inc. All Rights Reserved.
2
+ #AYLIEN News API
3
3
 
4
- Licensed under the Apache License, Version 2.0 (the "License");
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
- http://www.apache.org/licenses/LICENSE-2.0
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 Errors
22
17
  attr_accessor :errors
23
18
 
24
-
25
19
  # Attribute mapping from ruby-style variable name to JSON key.
26
20
  def self.attribute_map
27
21
  {
@@ -30,7 +24,7 @@ module AylienNewsApi
30
24
  end
31
25
 
32
26
  # Attribute type mapping.
33
- def self.api_types
27
+ def self.openapi_types
34
28
  {
35
29
  :'errors' => :'Array<Error>'
36
30
  }
@@ -39,30 +33,36 @@ module AylienNewsApi
39
33
  # Initializes the object
40
34
  # @param [Hash] attributes Model attributes in the form of hash
41
35
  def initialize(attributes = {})
42
- return unless attributes.is_a?(Hash)
36
+ if (!attributes.is_a?(Hash))
37
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::Errors` initialize method"
38
+ end
43
39
 
44
- # convert string to symbol for hash key
45
- attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
40
+ # check to see if the attribute exists and convert string to symbol for hash key
41
+ attributes = attributes.each_with_object({}) { |(k, v), h|
42
+ if (!self.class.attribute_map.key?(k.to_sym))
43
+ 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
44
+ end
45
+ h[k.to_sym] = v
46
+ }
46
47
 
47
- if attributes.has_key?(:'errors')
48
+ if attributes.key?(:'errors')
48
49
  if (value = attributes[:'errors']).is_a?(Array)
49
50
  self.errors = value
50
51
  end
51
52
  end
52
-
53
53
  end
54
54
 
55
55
  # Show invalid properties with the reasons. Usually used together with valid?
56
- # @return Array for valid properies with the reasons
56
+ # @return Array for valid properties with the reasons
57
57
  def list_invalid_properties
58
58
  invalid_properties = Array.new
59
- return invalid_properties
59
+ invalid_properties
60
60
  end
61
61
 
62
62
  # Check to see if the all the properties in the model are valid
63
63
  # @return true if the model is valid
64
64
  def valid?
65
- return true
65
+ true
66
66
  end
67
67
 
68
68
  # Checks equality by comparing each attribute.
@@ -80,22 +80,29 @@ module AylienNewsApi
80
80
  end
81
81
 
82
82
  # Calculates hash code according to all attributes.
83
- # @return [Fixnum] Hash code
83
+ # @return [Integer] Hash code
84
84
  def hash
85
85
  [errors].hash
86
86
  end
87
87
 
88
+ # Builds the object from hash
89
+ # @param [Hash] attributes Model attributes in the form of hash
90
+ # @return [Object] Returns the model itself
91
+ def self.build_from_hash(attributes)
92
+ new.build_from_hash(attributes)
93
+ end
94
+
88
95
  # Builds the object from hash
89
96
  # @param [Hash] attributes Model attributes in the form of hash
90
97
  # @return [Object] Returns the model itself
91
98
  def build_from_hash(attributes)
92
99
  return nil unless attributes.is_a?(Hash)
93
- self.class.api_types.each_pair do |key, type|
100
+ self.class.openapi_types.each_pair do |key, type|
94
101
  if type =~ /\AArray<(.*)>/i
95
- # check to ensure the input is an array given that the the attribute
102
+ # check to ensure the input is an array given that the attribute
96
103
  # is documented as an array but the input is not
97
104
  if attributes[self.class.attribute_map[key]].is_a?(Array)
98
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
105
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
99
106
  end
100
107
  elsif !attributes[self.class.attribute_map[key]].nil?
101
108
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
@@ -121,7 +128,7 @@ module AylienNewsApi
121
128
  value.to_i
122
129
  when :Float
123
130
  value.to_f
124
- when :BOOLEAN
131
+ when :Boolean
125
132
  if value.to_s =~ /\A(true|t|yes|y|1)\z/i
126
133
  true
127
134
  else
@@ -142,8 +149,7 @@ module AylienNewsApi
142
149
  end
143
150
  end
144
151
  else # model
145
- temp_model = AylienNewsApi.const_get(type).new
146
- temp_model.build_from_hash(value)
152
+ AylienNewsApi.const_get(type).build_from_hash(value)
147
153
  end
148
154
  end
149
155
 
@@ -177,7 +183,7 @@ module AylienNewsApi
177
183
  # @return [Hash] Returns the value in the form of hash
178
184
  def _to_hash(value)
179
185
  if value.is_a?(Array)
180
- value.compact.map{ |v| _to_hash(v) }
186
+ value.compact.map { |v| _to_hash(v) }
181
187
  elsif value.is_a?(Hash)
182
188
  {}.tap do |hash|
183
189
  value.each { |k, v| hash[k] = _to_hash(v) }
@@ -188,7 +194,5 @@ module AylienNewsApi
188
194
  value
189
195
  end
190
196
  end
191
-
192
197
  end
193
-
194
198
  end
@@ -1,23 +1,18 @@
1
1
  =begin
2
- Copyright 2017 Aylien, Inc. All Rights Reserved.
2
+ #AYLIEN News API
3
3
 
4
- Licensed under the Apache License, Version 2.0 (the "License");
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
- http://www.apache.org/licenses/LICENSE-2.0
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 HistogramInterval
22
17
  # Histogram bin
23
18
  attr_accessor :bin
@@ -25,7 +20,6 @@ module AylienNewsApi
25
20
  # Histogram bin size
26
21
  attr_accessor :count
27
22
 
28
-
29
23
  # Attribute mapping from ruby-style variable name to JSON key.
30
24
  def self.attribute_map
31
25
  {
@@ -35,7 +29,7 @@ module AylienNewsApi
35
29
  end
36
30
 
37
31
  # Attribute type mapping.
38
- def self.api_types
32
+ def self.openapi_types
39
33
  {
40
34
  :'bin' => :'Integer',
41
35
  :'count' => :'Integer'
@@ -45,32 +39,38 @@ module AylienNewsApi
45
39
  # Initializes the object
46
40
  # @param [Hash] attributes Model attributes in the form of hash
47
41
  def initialize(attributes = {})
48
- 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::HistogramInterval` initialize method"
44
+ end
49
45
 
50
- # convert string to symbol for hash key
51
- 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::HistogramInterval`. 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
+ }
52
53
 
53
- if attributes.has_key?(:'bin')
54
+ if attributes.key?(:'bin')
54
55
  self.bin = attributes[:'bin']
55
56
  end
56
57
 
57
- if attributes.has_key?(:'count')
58
+ if attributes.key?(:'count')
58
59
  self.count = attributes[:'count']
59
60
  end
60
-
61
61
  end
62
62
 
63
63
  # Show invalid properties with the reasons. Usually used together with valid?
64
- # @return Array for valid properies with the reasons
64
+ # @return Array for valid properties with the reasons
65
65
  def list_invalid_properties
66
66
  invalid_properties = Array.new
67
- return invalid_properties
67
+ invalid_properties
68
68
  end
69
69
 
70
70
  # Check to see if the all the properties in the model are valid
71
71
  # @return true if the model is valid
72
72
  def valid?
73
- return true
73
+ true
74
74
  end
75
75
 
76
76
  # Checks equality by comparing each attribute.
@@ -89,22 +89,29 @@ module AylienNewsApi
89
89
  end
90
90
 
91
91
  # Calculates hash code according to all attributes.
92
- # @return [Fixnum] Hash code
92
+ # @return [Integer] Hash code
93
93
  def hash
94
94
  [bin, count].hash
95
95
  end
96
96
 
97
+ # Builds the object from hash
98
+ # @param [Hash] attributes Model attributes in the form of hash
99
+ # @return [Object] Returns the model itself
100
+ def self.build_from_hash(attributes)
101
+ new.build_from_hash(attributes)
102
+ end
103
+
97
104
  # Builds the object from hash
98
105
  # @param [Hash] attributes Model attributes in the form of hash
99
106
  # @return [Object] Returns the model itself
100
107
  def build_from_hash(attributes)
101
108
  return nil unless attributes.is_a?(Hash)
102
- self.class.api_types.each_pair do |key, type|
109
+ self.class.openapi_types.each_pair do |key, type|
103
110
  if type =~ /\AArray<(.*)>/i
104
- # check to ensure the input is an array given that the the attribute
111
+ # check to ensure the input is an array given that the attribute
105
112
  # is documented as an array but the input is not
106
113
  if attributes[self.class.attribute_map[key]].is_a?(Array)
107
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
114
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
108
115
  end
109
116
  elsif !attributes[self.class.attribute_map[key]].nil?
110
117
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
@@ -130,7 +137,7 @@ module AylienNewsApi
130
137
  value.to_i
131
138
  when :Float
132
139
  value.to_f
133
- when :BOOLEAN
140
+ when :Boolean
134
141
  if value.to_s =~ /\A(true|t|yes|y|1)\z/i
135
142
  true
136
143
  else
@@ -151,8 +158,7 @@ module AylienNewsApi
151
158
  end
152
159
  end
153
160
  else # model
154
- temp_model = AylienNewsApi.const_get(type).new
155
- temp_model.build_from_hash(value)
161
+ AylienNewsApi.const_get(type).build_from_hash(value)
156
162
  end
157
163
  end
158
164
 
@@ -186,7 +192,7 @@ module AylienNewsApi
186
192
  # @return [Hash] Returns the value in the form of hash
187
193
  def _to_hash(value)
188
194
  if value.is_a?(Array)
189
- value.compact.map{ |v| _to_hash(v) }
195
+ value.compact.map { |v| _to_hash(v) }
190
196
  elsif value.is_a?(Hash)
191
197
  {}.tap do |hash|
192
198
  value.each { |k, v| hash[k] = _to_hash(v) }
@@ -197,7 +203,5 @@ module AylienNewsApi
197
203
  value
198
204
  end
199
205
  end
200
-
201
206
  end
202
-
203
207
  end
@@ -1,104 +1,104 @@
1
1
  =begin
2
- Copyright 2017 Aylien, Inc. All Rights Reserved.
2
+ #AYLIEN News API
3
3
 
4
- Licensed under the Apache License, Version 2.0 (the "License");
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
- http://www.apache.org/licenses/LICENSE-2.0
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 Histograms
22
- # The intervals of the histograms
23
- attr_accessor :intervals
24
-
25
- # The start interval of the histogram
26
- attr_accessor :interval_start
17
+ attr_accessor :field
27
18
 
28
19
  # The end interval of the histogram
29
20
  attr_accessor :interval_end
30
21
 
22
+ # The start interval of the histogram
23
+ attr_accessor :interval_start
24
+
31
25
  # The width of the histogram
32
26
  attr_accessor :interval_width
33
27
 
34
- attr_accessor :field
35
-
28
+ # The intervals of the histograms
29
+ attr_accessor :intervals
36
30
 
37
31
  # Attribute mapping from ruby-style variable name to JSON key.
38
32
  def self.attribute_map
39
33
  {
40
- :'intervals' => :'intervals',
41
- :'interval_start' => :'interval.start',
34
+ :'field' => :'field',
42
35
  :'interval_end' => :'interval.end',
36
+ :'interval_start' => :'interval.start',
43
37
  :'interval_width' => :'interval.width',
44
- :'field' => :'field'
38
+ :'intervals' => :'intervals'
45
39
  }
46
40
  end
47
41
 
48
42
  # Attribute type mapping.
49
- def self.api_types
43
+ def self.openapi_types
50
44
  {
51
- :'intervals' => :'Array<HistogramInterval>',
52
- :'interval_start' => :'Integer',
45
+ :'field' => :'String',
53
46
  :'interval_end' => :'Integer',
47
+ :'interval_start' => :'Integer',
54
48
  :'interval_width' => :'Integer',
55
- :'field' => :'String'
49
+ :'intervals' => :'Array<HistogramInterval>'
56
50
  }
57
51
  end
58
52
 
59
53
  # Initializes the object
60
54
  # @param [Hash] attributes Model attributes in the form of hash
61
55
  def initialize(attributes = {})
62
- return unless attributes.is_a?(Hash)
63
-
64
- # convert string to symbol for hash key
65
- attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
56
+ if (!attributes.is_a?(Hash))
57
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::Histograms` initialize method"
58
+ end
66
59
 
67
- if attributes.has_key?(:'intervals')
68
- if (value = attributes[:'intervals']).is_a?(Array)
69
- self.intervals = value
60
+ # check to see if the attribute exists and convert string to symbol for hash key
61
+ attributes = attributes.each_with_object({}) { |(k, v), h|
62
+ if (!self.class.attribute_map.key?(k.to_sym))
63
+ 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
70
64
  end
71
- end
65
+ h[k.to_sym] = v
66
+ }
72
67
 
73
- if attributes.has_key?(:'interval.start')
74
- self.interval_start = attributes[:'interval.start']
68
+ if attributes.key?(:'field')
69
+ self.field = attributes[:'field']
75
70
  end
76
71
 
77
- if attributes.has_key?(:'interval.end')
78
- self.interval_end = attributes[:'interval.end']
72
+ if attributes.key?(:'interval_end')
73
+ self.interval_end = attributes[:'interval_end']
79
74
  end
80
75
 
81
- if attributes.has_key?(:'interval.width')
82
- self.interval_width = attributes[:'interval.width']
76
+ if attributes.key?(:'interval_start')
77
+ self.interval_start = attributes[:'interval_start']
83
78
  end
84
79
 
85
- if attributes.has_key?(:'field')
86
- self.field = attributes[:'field']
80
+ if attributes.key?(:'interval_width')
81
+ self.interval_width = attributes[:'interval_width']
87
82
  end
88
83
 
84
+ if attributes.key?(:'intervals')
85
+ if (value = attributes[:'intervals']).is_a?(Array)
86
+ self.intervals = value
87
+ end
88
+ end
89
89
  end
90
90
 
91
91
  # Show invalid properties with the reasons. Usually used together with valid?
92
- # @return Array for valid properies with the reasons
92
+ # @return Array for valid properties with the reasons
93
93
  def list_invalid_properties
94
94
  invalid_properties = Array.new
95
- return invalid_properties
95
+ invalid_properties
96
96
  end
97
97
 
98
98
  # Check to see if the all the properties in the model are valid
99
99
  # @return true if the model is valid
100
100
  def valid?
101
- return true
101
+ true
102
102
  end
103
103
 
104
104
  # Checks equality by comparing each attribute.
@@ -106,11 +106,11 @@ module AylienNewsApi
106
106
  def ==(o)
107
107
  return true if self.equal?(o)
108
108
  self.class == o.class &&
109
- intervals == o.intervals &&
110
- interval_start == o.interval_start &&
109
+ field == o.field &&
111
110
  interval_end == o.interval_end &&
111
+ interval_start == o.interval_start &&
112
112
  interval_width == o.interval_width &&
113
- field == o.field
113
+ intervals == o.intervals
114
114
  end
115
115
 
116
116
  # @see the `==` method
@@ -120,9 +120,16 @@ module AylienNewsApi
120
120
  end
121
121
 
122
122
  # Calculates hash code according to all attributes.
123
- # @return [Fixnum] Hash code
123
+ # @return [Integer] Hash code
124
124
  def hash
125
- [intervals, interval_start, interval_end, interval_width, field].hash
125
+ [field, interval_end, interval_start, interval_width, intervals].hash
126
+ end
127
+
128
+ # Builds the object from hash
129
+ # @param [Hash] attributes Model attributes in the form of hash
130
+ # @return [Object] Returns the model itself
131
+ def self.build_from_hash(attributes)
132
+ new.build_from_hash(attributes)
126
133
  end
127
134
 
128
135
  # Builds the object from hash
@@ -130,12 +137,12 @@ module AylienNewsApi
130
137
  # @return [Object] Returns the model itself
131
138
  def build_from_hash(attributes)
132
139
  return nil unless attributes.is_a?(Hash)
133
- self.class.api_types.each_pair do |key, type|
140
+ self.class.openapi_types.each_pair do |key, type|
134
141
  if type =~ /\AArray<(.*)>/i
135
- # check to ensure the input is an array given that the the attribute
142
+ # check to ensure the input is an array given that the attribute
136
143
  # is documented as an array but the input is not
137
144
  if attributes[self.class.attribute_map[key]].is_a?(Array)
138
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
145
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
139
146
  end
140
147
  elsif !attributes[self.class.attribute_map[key]].nil?
141
148
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
@@ -161,7 +168,7 @@ module AylienNewsApi
161
168
  value.to_i
162
169
  when :Float
163
170
  value.to_f
164
- when :BOOLEAN
171
+ when :Boolean
165
172
  if value.to_s =~ /\A(true|t|yes|y|1)\z/i
166
173
  true
167
174
  else
@@ -182,8 +189,7 @@ module AylienNewsApi
182
189
  end
183
190
  end
184
191
  else # model
185
- temp_model = AylienNewsApi.const_get(type).new
186
- temp_model.build_from_hash(value)
192
+ AylienNewsApi.const_get(type).build_from_hash(value)
187
193
  end
188
194
  end
189
195
 
@@ -217,7 +223,7 @@ module AylienNewsApi
217
223
  # @return [Hash] Returns the value in the form of hash
218
224
  def _to_hash(value)
219
225
  if value.is_a?(Array)
220
- value.compact.map{ |v| _to_hash(v) }
226
+ value.compact.map { |v| _to_hash(v) }
221
227
  elsif value.is_a?(Hash)
222
228
  {}.tap do |hash|
223
229
  value.each { |k, v| hash[k] = _to_hash(v) }
@@ -228,7 +234,5 @@ module AylienNewsApi
228
234
  value
229
235
  end
230
236
  end
231
-
232
237
  end
233
-
234
238
  end