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,28 +1,22 @@
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 EntityLinks
22
17
  # A dbpedia resource URL
23
18
  attr_accessor :dbpedia
24
19
 
25
-
26
20
  # Attribute mapping from ruby-style variable name to JSON key.
27
21
  def self.attribute_map
28
22
  {
@@ -31,7 +25,7 @@ module AylienNewsApi
31
25
  end
32
26
 
33
27
  # Attribute type mapping.
34
- def self.api_types
28
+ def self.openapi_types
35
29
  {
36
30
  :'dbpedia' => :'String'
37
31
  }
@@ -40,28 +34,34 @@ module AylienNewsApi
40
34
  # Initializes the object
41
35
  # @param [Hash] attributes Model attributes in the form of hash
42
36
  def initialize(attributes = {})
43
- return unless attributes.is_a?(Hash)
37
+ if (!attributes.is_a?(Hash))
38
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::EntityLinks` initialize method"
39
+ end
44
40
 
45
- # convert string to symbol for hash key
46
- attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
41
+ # check to see if the attribute exists and convert string to symbol for hash key
42
+ attributes = attributes.each_with_object({}) { |(k, v), h|
43
+ if (!self.class.attribute_map.key?(k.to_sym))
44
+ fail ArgumentError, "`#{k}` is not a valid attribute in `AylienNewsApi::EntityLinks`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
45
+ end
46
+ h[k.to_sym] = v
47
+ }
47
48
 
48
- if attributes.has_key?(:'dbpedia')
49
+ if attributes.key?(:'dbpedia')
49
50
  self.dbpedia = attributes[:'dbpedia']
50
51
  end
51
-
52
52
  end
53
53
 
54
54
  # Show invalid properties with the reasons. Usually used together with valid?
55
- # @return Array for valid properies with the reasons
55
+ # @return Array for valid properties with the reasons
56
56
  def list_invalid_properties
57
57
  invalid_properties = Array.new
58
- return invalid_properties
58
+ invalid_properties
59
59
  end
60
60
 
61
61
  # Check to see if the all the properties in the model are valid
62
62
  # @return true if the model is valid
63
63
  def valid?
64
- return true
64
+ true
65
65
  end
66
66
 
67
67
  # Checks equality by comparing each attribute.
@@ -79,22 +79,29 @@ module AylienNewsApi
79
79
  end
80
80
 
81
81
  # Calculates hash code according to all attributes.
82
- # @return [Fixnum] Hash code
82
+ # @return [Integer] Hash code
83
83
  def hash
84
84
  [dbpedia].hash
85
85
  end
86
86
 
87
+ # Builds the object from hash
88
+ # @param [Hash] attributes Model attributes in the form of hash
89
+ # @return [Object] Returns the model itself
90
+ def self.build_from_hash(attributes)
91
+ new.build_from_hash(attributes)
92
+ end
93
+
87
94
  # Builds the object from hash
88
95
  # @param [Hash] attributes Model attributes in the form of hash
89
96
  # @return [Object] Returns the model itself
90
97
  def build_from_hash(attributes)
91
98
  return nil unless attributes.is_a?(Hash)
92
- self.class.api_types.each_pair do |key, type|
99
+ self.class.openapi_types.each_pair do |key, type|
93
100
  if type =~ /\AArray<(.*)>/i
94
- # check to ensure the input is an array given that the the attribute
101
+ # check to ensure the input is an array given that the attribute
95
102
  # is documented as an array but the input is not
96
103
  if attributes[self.class.attribute_map[key]].is_a?(Array)
97
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
104
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
98
105
  end
99
106
  elsif !attributes[self.class.attribute_map[key]].nil?
100
107
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
@@ -120,7 +127,7 @@ module AylienNewsApi
120
127
  value.to_i
121
128
  when :Float
122
129
  value.to_f
123
- when :BOOLEAN
130
+ when :Boolean
124
131
  if value.to_s =~ /\A(true|t|yes|y|1)\z/i
125
132
  true
126
133
  else
@@ -141,8 +148,7 @@ module AylienNewsApi
141
148
  end
142
149
  end
143
150
  else # model
144
- temp_model = AylienNewsApi.const_get(type).new
145
- temp_model.build_from_hash(value)
151
+ AylienNewsApi.const_get(type).build_from_hash(value)
146
152
  end
147
153
  end
148
154
 
@@ -176,7 +182,7 @@ module AylienNewsApi
176
182
  # @return [Hash] Returns the value in the form of hash
177
183
  def _to_hash(value)
178
184
  if value.is_a?(Array)
179
- value.compact.map{ |v| _to_hash(v) }
185
+ value.compact.map { |v| _to_hash(v) }
180
186
  elsif value.is_a?(Hash)
181
187
  {}.tap do |hash|
182
188
  value.each { |k, v| hash[k] = _to_hash(v) }
@@ -187,7 +193,5 @@ module AylienNewsApi
187
193
  value
188
194
  end
189
195
  end
190
-
191
196
  end
192
-
193
197
  end
@@ -1,106 +1,106 @@
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 Error
17
+ attr_accessor :code
18
+
19
+ attr_accessor :detail
20
+
22
21
  attr_accessor :id
23
22
 
24
23
  attr_accessor :links
25
24
 
26
25
  attr_accessor :status
27
26
 
28
- attr_accessor :code
29
-
30
27
  attr_accessor :title
31
28
 
32
- attr_accessor :detail
33
-
34
-
35
29
  # Attribute mapping from ruby-style variable name to JSON key.
36
30
  def self.attribute_map
37
31
  {
32
+ :'code' => :'code',
33
+ :'detail' => :'detail',
38
34
  :'id' => :'id',
39
35
  :'links' => :'links',
40
36
  :'status' => :'status',
41
- :'code' => :'code',
42
- :'title' => :'title',
43
- :'detail' => :'detail'
37
+ :'title' => :'title'
44
38
  }
45
39
  end
46
40
 
47
41
  # Attribute type mapping.
48
- def self.api_types
42
+ def self.openapi_types
49
43
  {
44
+ :'code' => :'String',
45
+ :'detail' => :'String',
50
46
  :'id' => :'String',
51
47
  :'links' => :'ErrorLinks',
52
48
  :'status' => :'String',
53
- :'code' => :'String',
54
- :'title' => :'String',
55
- :'detail' => :'String'
49
+ :'title' => :'String'
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)
56
+ if (!attributes.is_a?(Hash))
57
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::Error` initialize method"
58
+ end
63
59
 
64
- # convert string to symbol for hash key
65
- attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
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::Error`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
64
+ end
65
+ h[k.to_sym] = v
66
+ }
66
67
 
67
- if attributes.has_key?(:'id')
68
- self.id = attributes[:'id']
68
+ if attributes.key?(:'code')
69
+ self.code = attributes[:'code']
69
70
  end
70
71
 
71
- if attributes.has_key?(:'links')
72
- self.links = attributes[:'links']
72
+ if attributes.key?(:'detail')
73
+ self.detail = attributes[:'detail']
73
74
  end
74
75
 
75
- if attributes.has_key?(:'status')
76
- self.status = attributes[:'status']
76
+ if attributes.key?(:'id')
77
+ self.id = attributes[:'id']
77
78
  end
78
79
 
79
- if attributes.has_key?(:'code')
80
- self.code = attributes[:'code']
80
+ if attributes.key?(:'links')
81
+ self.links = attributes[:'links']
81
82
  end
82
83
 
83
- if attributes.has_key?(:'title')
84
- self.title = attributes[:'title']
84
+ if attributes.key?(:'status')
85
+ self.status = attributes[:'status']
85
86
  end
86
87
 
87
- if attributes.has_key?(:'detail')
88
- self.detail = attributes[:'detail']
88
+ if attributes.key?(:'title')
89
+ self.title = attributes[:'title']
89
90
  end
90
-
91
91
  end
92
92
 
93
93
  # Show invalid properties with the reasons. Usually used together with valid?
94
- # @return Array for valid properies with the reasons
94
+ # @return Array for valid properties with the reasons
95
95
  def list_invalid_properties
96
96
  invalid_properties = Array.new
97
- return invalid_properties
97
+ invalid_properties
98
98
  end
99
99
 
100
100
  # Check to see if the all the properties in the model are valid
101
101
  # @return true if the model is valid
102
102
  def valid?
103
- return true
103
+ true
104
104
  end
105
105
 
106
106
  # Checks equality by comparing each attribute.
@@ -108,12 +108,12 @@ module AylienNewsApi
108
108
  def ==(o)
109
109
  return true if self.equal?(o)
110
110
  self.class == o.class &&
111
+ code == o.code &&
112
+ detail == o.detail &&
111
113
  id == o.id &&
112
114
  links == o.links &&
113
115
  status == o.status &&
114
- code == o.code &&
115
- title == o.title &&
116
- detail == o.detail
116
+ title == o.title
117
117
  end
118
118
 
119
119
  # @see the `==` method
@@ -123,9 +123,16 @@ module AylienNewsApi
123
123
  end
124
124
 
125
125
  # Calculates hash code according to all attributes.
126
- # @return [Fixnum] Hash code
126
+ # @return [Integer] Hash code
127
127
  def hash
128
- [id, links, status, code, title, detail].hash
128
+ [code, detail, id, links, status, title].hash
129
+ end
130
+
131
+ # Builds the object from hash
132
+ # @param [Hash] attributes Model attributes in the form of hash
133
+ # @return [Object] Returns the model itself
134
+ def self.build_from_hash(attributes)
135
+ new.build_from_hash(attributes)
129
136
  end
130
137
 
131
138
  # Builds the object from hash
@@ -133,12 +140,12 @@ module AylienNewsApi
133
140
  # @return [Object] Returns the model itself
134
141
  def build_from_hash(attributes)
135
142
  return nil unless attributes.is_a?(Hash)
136
- self.class.api_types.each_pair do |key, type|
143
+ self.class.openapi_types.each_pair do |key, type|
137
144
  if type =~ /\AArray<(.*)>/i
138
- # check to ensure the input is an array given that the the attribute
145
+ # check to ensure the input is an array given that the attribute
139
146
  # is documented as an array but the input is not
140
147
  if attributes[self.class.attribute_map[key]].is_a?(Array)
141
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
148
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
142
149
  end
143
150
  elsif !attributes[self.class.attribute_map[key]].nil?
144
151
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
@@ -164,7 +171,7 @@ module AylienNewsApi
164
171
  value.to_i
165
172
  when :Float
166
173
  value.to_f
167
- when :BOOLEAN
174
+ when :Boolean
168
175
  if value.to_s =~ /\A(true|t|yes|y|1)\z/i
169
176
  true
170
177
  else
@@ -185,8 +192,7 @@ module AylienNewsApi
185
192
  end
186
193
  end
187
194
  else # model
188
- temp_model = AylienNewsApi.const_get(type).new
189
- temp_model.build_from_hash(value)
195
+ AylienNewsApi.const_get(type).build_from_hash(value)
190
196
  end
191
197
  end
192
198
 
@@ -220,7 +226,7 @@ module AylienNewsApi
220
226
  # @return [Hash] Returns the value in the form of hash
221
227
  def _to_hash(value)
222
228
  if value.is_a?(Array)
223
- value.compact.map{ |v| _to_hash(v) }
229
+ value.compact.map { |v| _to_hash(v) }
224
230
  elsif value.is_a?(Hash)
225
231
  {}.tap do |hash|
226
232
  value.each { |k, v| hash[k] = _to_hash(v) }
@@ -231,7 +237,5 @@ module AylienNewsApi
231
237
  value
232
238
  end
233
239
  end
234
-
235
240
  end
236
-
237
241
  end
@@ -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 ErrorLinks
22
17
  attr_accessor :about
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
  :'about' => :'String'
36
30
  }
@@ -39,28 +33,34 @@ 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::ErrorLinks` 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::ErrorLinks`. 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?(:'about')
48
+ if attributes.key?(:'about')
48
49
  self.about = attributes[:'about']
49
50
  end
50
-
51
51
  end
52
52
 
53
53
  # Show invalid properties with the reasons. Usually used together with valid?
54
- # @return Array for valid properies with the reasons
54
+ # @return Array for valid properties with the reasons
55
55
  def list_invalid_properties
56
56
  invalid_properties = Array.new
57
- return invalid_properties
57
+ invalid_properties
58
58
  end
59
59
 
60
60
  # Check to see if the all the properties in the model are valid
61
61
  # @return true if the model is valid
62
62
  def valid?
63
- return true
63
+ true
64
64
  end
65
65
 
66
66
  # Checks equality by comparing each attribute.
@@ -78,22 +78,29 @@ module AylienNewsApi
78
78
  end
79
79
 
80
80
  # Calculates hash code according to all attributes.
81
- # @return [Fixnum] Hash code
81
+ # @return [Integer] Hash code
82
82
  def hash
83
83
  [about].hash
84
84
  end
85
85
 
86
+ # Builds the object from hash
87
+ # @param [Hash] attributes Model attributes in the form of hash
88
+ # @return [Object] Returns the model itself
89
+ def self.build_from_hash(attributes)
90
+ new.build_from_hash(attributes)
91
+ end
92
+
86
93
  # Builds the object from hash
87
94
  # @param [Hash] attributes Model attributes in the form of hash
88
95
  # @return [Object] Returns the model itself
89
96
  def build_from_hash(attributes)
90
97
  return nil unless attributes.is_a?(Hash)
91
- self.class.api_types.each_pair do |key, type|
98
+ self.class.openapi_types.each_pair do |key, type|
92
99
  if type =~ /\AArray<(.*)>/i
93
- # check to ensure the input is an array given that the the attribute
100
+ # check to ensure the input is an array given that the attribute
94
101
  # is documented as an array but the input is not
95
102
  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) } )
103
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
97
104
  end
98
105
  elsif !attributes[self.class.attribute_map[key]].nil?
99
106
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
@@ -119,7 +126,7 @@ module AylienNewsApi
119
126
  value.to_i
120
127
  when :Float
121
128
  value.to_f
122
- when :BOOLEAN
129
+ when :Boolean
123
130
  if value.to_s =~ /\A(true|t|yes|y|1)\z/i
124
131
  true
125
132
  else
@@ -140,8 +147,7 @@ module AylienNewsApi
140
147
  end
141
148
  end
142
149
  else # model
143
- temp_model = AylienNewsApi.const_get(type).new
144
- temp_model.build_from_hash(value)
150
+ AylienNewsApi.const_get(type).build_from_hash(value)
145
151
  end
146
152
  end
147
153
 
@@ -175,7 +181,7 @@ module AylienNewsApi
175
181
  # @return [Hash] Returns the value in the form of hash
176
182
  def _to_hash(value)
177
183
  if value.is_a?(Array)
178
- value.compact.map{ |v| _to_hash(v) }
184
+ value.compact.map { |v| _to_hash(v) }
179
185
  elsif value.is_a?(Hash)
180
186
  {}.tap do |hash|
181
187
  value.each { |k, v| hash[k] = _to_hash(v) }
@@ -186,7 +192,5 @@ module AylienNewsApi
186
192
  value
187
193
  end
188
194
  end
189
-
190
195
  end
191
-
192
196
  end