aylien_news_api 0.2.0 → 4.0.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 (155) hide show
  1. checksums.yaml +5 -5
  2. data/Gemfile +7 -1
  3. data/README.md +36 -47
  4. data/Rakefile +10 -0
  5. data/aylien_news_api.gemspec +25 -32
  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 +1310 -576
  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 +9 -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 +19 -1
  26. data/docs/MediaFormat.md +16 -0
  27. data/docs/MediaType.md +16 -0
  28. data/docs/Rank.md +21 -0
  29. data/docs/Rankings.md +17 -0
  30. data/docs/RelatedStories.md +14 -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 -3
  40. data/docs/Stories.md +15 -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/git_push.sh +58 -0
  53. data/lib/aylien_news_api.rb +23 -14
  54. data/lib/aylien_news_api/api/default_api.rb +2755 -892
  55. data/lib/aylien_news_api/api_client.rb +141 -102
  56. data/lib/aylien_news_api/api_error.rb +37 -18
  57. data/lib/aylien_news_api/configuration.rb +94 -43
  58. data/lib/aylien_news_api/models/author.rb +69 -53
  59. data/lib/aylien_news_api/models/autocomplete.rb +55 -39
  60. data/lib/aylien_news_api/models/autocompletes.rb +54 -38
  61. data/lib/aylien_news_api/models/category.rb +88 -97
  62. data/lib/aylien_news_api/models/category_links.rb +66 -50
  63. data/lib/aylien_news_api/models/category_taxonomy.rb +36 -0
  64. data/lib/aylien_news_api/models/cluster.rb +265 -0
  65. data/lib/aylien_news_api/models/clusters.rb +229 -0
  66. data/lib/aylien_news_api/models/coverages.rb +79 -75
  67. data/lib/aylien_news_api/models/entities.rb +67 -51
  68. data/lib/aylien_news_api/models/entity.rb +100 -81
  69. data/lib/aylien_news_api/models/entity_links.rb +54 -38
  70. data/lib/aylien_news_api/models/error.rb +79 -63
  71. data/lib/aylien_news_api/models/error_links.rb +54 -38
  72. data/lib/aylien_news_api/models/errors.rb +54 -38
  73. data/lib/aylien_news_api/models/histogram_interval.rb +55 -39
  74. data/lib/aylien_news_api/models/histograms.rb +99 -63
  75. data/lib/aylien_news_api/models/location.rb +70 -54
  76. data/lib/aylien_news_api/models/media.rb +97 -76
  77. data/lib/aylien_news_api/models/media_format.rb +44 -0
  78. data/lib/aylien_news_api/models/media_type.rb +36 -0
  79. data/lib/aylien_news_api/models/rank.rb +227 -0
  80. data/lib/aylien_news_api/models/rankings.rb +208 -0
  81. data/lib/aylien_news_api/models/related_stories.rb +72 -68
  82. data/lib/aylien_news_api/models/representative_story.rb +237 -0
  83. data/lib/aylien_news_api/models/scope.rb +76 -94
  84. data/lib/aylien_news_api/models/scope_level.rb +37 -0
  85. data/lib/aylien_news_api/models/sentiment.rb +70 -84
  86. data/lib/aylien_news_api/models/sentiment_polarity.rb +37 -0
  87. data/lib/aylien_news_api/models/sentiments.rb +65 -51
  88. data/lib/aylien_news_api/models/share_count.rb +55 -39
  89. data/lib/aylien_news_api/models/share_counts.rb +57 -41
  90. data/lib/aylien_news_api/models/source.rb +129 -64
  91. data/lib/aylien_news_api/models/stories.rb +79 -55
  92. data/lib/aylien_news_api/models/story.rb +191 -161
  93. data/lib/aylien_news_api/models/story_cluster.rb +71 -55
  94. data/lib/aylien_news_api/models/story_links.rb +73 -47
  95. data/lib/aylien_news_api/models/story_translation.rb +217 -0
  96. data/lib/aylien_news_api/models/story_translations.rb +207 -0
  97. data/lib/aylien_news_api/models/story_translations_en.rb +227 -0
  98. data/lib/aylien_news_api/models/summary.rb +54 -38
  99. data/lib/aylien_news_api/models/time_series.rb +66 -50
  100. data/lib/aylien_news_api/models/time_series_list.rb +75 -59
  101. data/lib/aylien_news_api/models/trend.rb +66 -50
  102. data/lib/aylien_news_api/models/trends.rb +80 -44
  103. data/lib/aylien_news_api/version.rb +12 -14
  104. data/spec/api/default_api_spec.rb +620 -284
  105. data/spec/api_client_spec.rb +43 -161
  106. data/spec/configuration_spec.rb +22 -19
  107. data/spec/models/author_spec.rb +21 -34
  108. data/spec/models/autocomplete_spec.rb +17 -26
  109. data/spec/models/autocompletes_spec.rb +16 -21
  110. data/spec/models/category_links_spec.rb +19 -28
  111. data/spec/models/category_spec.rb +31 -50
  112. data/spec/models/category_taxonomy_spec.rb +35 -0
  113. data/spec/models/cluster_spec.rb +77 -0
  114. data/spec/models/clusters_spec.rb +53 -0
  115. data/spec/models/coverages_spec.rb +24 -45
  116. data/spec/models/entities_spec.rb +19 -28
  117. data/spec/models/entity_links_spec.rb +16 -21
  118. data/spec/models/entity_spec.rb +25 -46
  119. data/spec/models/error_links_spec.rb +16 -21
  120. data/spec/models/error_spec.rb +27 -52
  121. data/spec/models/errors_spec.rb +16 -21
  122. data/spec/models/histogram_interval_spec.rb +17 -26
  123. data/spec/models/histograms_spec.rb +36 -45
  124. data/spec/models/location_spec.rb +21 -34
  125. data/spec/models/media_format_spec.rb +35 -0
  126. data/spec/models/media_spec.rb +41 -26
  127. data/spec/models/media_type_spec.rb +35 -0
  128. data/spec/models/rank_spec.rb +53 -0
  129. data/spec/models/rankings_spec.rb +41 -0
  130. data/spec/models/related_stories_spec.rb +21 -38
  131. data/spec/models/representative_story_spec.rb +59 -0
  132. data/spec/models/scope_level_spec.rb +35 -0
  133. data/spec/models/scope_spec.rb +23 -40
  134. data/spec/models/sentiment_polarity_spec.rb +35 -0
  135. data/spec/models/sentiment_spec.rb +17 -26
  136. data/spec/models/sentiments_spec.rb +19 -28
  137. data/spec/models/share_count_spec.rb +17 -26
  138. data/spec/models/share_counts_spec.rb +19 -36
  139. data/spec/models/source_spec.rb +54 -49
  140. data/spec/models/stories_spec.rb +26 -33
  141. data/spec/models/story_cluster_spec.rb +23 -44
  142. data/spec/models/story_links_spec.rb +25 -32
  143. data/spec/models/story_spec.rb +65 -134
  144. data/spec/models/story_translation_spec.rb +47 -0
  145. data/spec/models/story_translations_en_spec.rb +53 -0
  146. data/spec/models/story_translations_spec.rb +41 -0
  147. data/spec/models/summary_spec.rb +16 -21
  148. data/spec/models/time_series_list_spec.rb +22 -39
  149. data/spec/models/time_series_spec.rb +19 -28
  150. data/spec/models/trend_spec.rb +19 -28
  151. data/spec/models/trends_spec.rb +30 -27
  152. data/spec/spec_helper.rb +11 -13
  153. metadata +95 -193
  154. data/Gemfile.lock +0 -65
  155. data/LICENSE +0 -13
@@ -0,0 +1,208 @@
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
12
+
13
+ require 'date'
14
+
15
+ module AylienNewsApi
16
+ class Rankings
17
+ attr_accessor :alexa
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+ :'alexa' => :'alexa'
23
+ }
24
+ end
25
+
26
+ # Attribute type mapping.
27
+ def self.openapi_types
28
+ {
29
+ :'alexa' => :'Array<Rank>'
30
+ }
31
+ end
32
+
33
+ # List of attributes with nullable: true
34
+ def self.openapi_nullable
35
+ Set.new([
36
+ ])
37
+ end
38
+
39
+ # Initializes the object
40
+ # @param [Hash] attributes Model attributes in the form of hash
41
+ def initialize(attributes = {})
42
+ if (!attributes.is_a?(Hash))
43
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::Rankings` initialize method"
44
+ end
45
+
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::Rankings`. 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
+ }
53
+
54
+ if attributes.key?(:'alexa')
55
+ if (value = attributes[:'alexa']).is_a?(Array)
56
+ self.alexa = value
57
+ end
58
+ end
59
+ end
60
+
61
+ # Show invalid properties with the reasons. Usually used together with valid?
62
+ # @return Array for valid properties with the reasons
63
+ def list_invalid_properties
64
+ invalid_properties = Array.new
65
+ 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
+ true
72
+ end
73
+
74
+ # Checks equality by comparing each attribute.
75
+ # @param [Object] Object to be compared
76
+ def ==(o)
77
+ return true if self.equal?(o)
78
+ self.class == o.class &&
79
+ alexa == o.alexa
80
+ end
81
+
82
+ # @see the `==` method
83
+ # @param [Object] Object to be compared
84
+ def eql?(o)
85
+ self == o
86
+ end
87
+
88
+ # Calculates hash code according to all attributes.
89
+ # @return [Integer] Hash code
90
+ def hash
91
+ [alexa].hash
92
+ end
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
+
101
+ # Builds the object from hash
102
+ # @param [Hash] attributes Model attributes in the form of hash
103
+ # @return [Object] Returns the model itself
104
+ def build_from_hash(attributes)
105
+ return nil unless attributes.is_a?(Hash)
106
+ self.class.openapi_types.each_pair do |key, type|
107
+ if type =~ /\AArray<(.*)>/i
108
+ # check to ensure the input is an array given that the attribute
109
+ # is documented as an array but the input is not
110
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
111
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
112
+ end
113
+ elsif !attributes[self.class.attribute_map[key]].nil?
114
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
115
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
116
+ end
117
+
118
+ self
119
+ end
120
+
121
+ # Deserializes the data based on type
122
+ # @param string type Data type
123
+ # @param string value Value to be deserialized
124
+ # @return [Object] Deserialized data
125
+ def _deserialize(type, value)
126
+ case type.to_sym
127
+ when :DateTime
128
+ DateTime.parse(value)
129
+ when :Date
130
+ Date.parse(value)
131
+ when :String
132
+ value.to_s
133
+ when :Integer
134
+ value.to_i
135
+ when :Float
136
+ value.to_f
137
+ when :Boolean
138
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
139
+ true
140
+ else
141
+ false
142
+ end
143
+ when :Object
144
+ # generic object (usually a Hash), return directly
145
+ value
146
+ when /\AArray<(?<inner_type>.+)>\z/
147
+ inner_type = Regexp.last_match[:inner_type]
148
+ value.map { |v| _deserialize(inner_type, v) }
149
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
150
+ k_type = Regexp.last_match[:k_type]
151
+ v_type = Regexp.last_match[:v_type]
152
+ {}.tap do |hash|
153
+ value.each do |k, v|
154
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
155
+ end
156
+ end
157
+ else # model
158
+ AylienNewsApi.const_get(type).build_from_hash(value)
159
+ end
160
+ end
161
+
162
+ # Returns the string representation of the object
163
+ # @return [String] String presentation of the object
164
+ def to_s
165
+ to_hash.to_s
166
+ end
167
+
168
+ # to_body is an alias to to_hash (backward compatibility)
169
+ # @return [Hash] Returns the object in the form of hash
170
+ def to_body
171
+ to_hash
172
+ end
173
+
174
+ # Returns the object in the form of hash
175
+ # @return [Hash] Returns the object in the form of hash
176
+ def to_hash
177
+ hash = {}
178
+ self.class.attribute_map.each_pair do |attr, param|
179
+ value = self.send(attr)
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
+
185
+ hash[param] = _to_hash(value)
186
+ end
187
+ hash
188
+ end
189
+
190
+ # Outputs non-array value in the form of hash
191
+ # For object, use to_hash. Otherwise, just return the value
192
+ # @param [Object] value Any valid value
193
+ # @return [Hash] Returns the value in the form of hash
194
+ def _to_hash(value)
195
+ if value.is_a?(Array)
196
+ value.compact.map { |v| _to_hash(v) }
197
+ elsif value.is_a?(Hash)
198
+ {}.tap do |hash|
199
+ value.each { |k, v| hash[k] = _to_hash(v) }
200
+ end
201
+ elsif value.respond_to? :to_hash
202
+ value.to_hash
203
+ else
204
+ value
205
+ end
206
+ end
207
+ end
208
+ end
@@ -1,24 +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 RelatedStories
20
- # The input story title
21
- attr_accessor :story_title
17
+ # An array of related stories for the input story
18
+ attr_accessor :related_stories
22
19
 
23
20
  # The input story body
24
21
  attr_accessor :story_body
@@ -26,80 +23,80 @@ module AylienNewsApi
26
23
  # The input story language
27
24
  attr_accessor :story_language
28
25
 
29
- # An array of related stories for the input story
30
- attr_accessor :related_stories
31
-
32
- # An array of clusters
33
- attr_accessor :clusters
34
-
26
+ # The input story title
27
+ attr_accessor :story_title
35
28
 
36
29
  # Attribute mapping from ruby-style variable name to JSON key.
37
30
  def self.attribute_map
38
31
  {
39
- :'story_title' => :'story_title',
32
+ :'related_stories' => :'related_stories',
40
33
  :'story_body' => :'story_body',
41
34
  :'story_language' => :'story_language',
42
- :'related_stories' => :'related_stories',
43
- :'clusters' => :'clusters'
35
+ :'story_title' => :'story_title'
44
36
  }
45
37
  end
46
38
 
47
39
  # Attribute type mapping.
48
- def self.api_types
40
+ def self.openapi_types
49
41
  {
50
- :'story_title' => :'String',
42
+ :'related_stories' => :'Array<Story>',
51
43
  :'story_body' => :'String',
52
44
  :'story_language' => :'String',
53
- :'related_stories' => :'Array<Story>',
54
- :'clusters' => :'Array<StoryCluster>'
45
+ :'story_title' => :'String'
55
46
  }
56
47
  end
57
48
 
49
+ # List of attributes with nullable: true
50
+ def self.openapi_nullable
51
+ Set.new([
52
+ ])
53
+ end
54
+
58
55
  # Initializes the object
59
56
  # @param [Hash] attributes Model attributes in the form of hash
60
57
  def initialize(attributes = {})
61
- return unless attributes.is_a?(Hash)
58
+ if (!attributes.is_a?(Hash))
59
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::RelatedStories` initialize method"
60
+ end
62
61
 
63
- # convert string to symbol for hash key
64
- attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
62
+ # check to see if the attribute exists and convert string to symbol for hash key
63
+ attributes = attributes.each_with_object({}) { |(k, v), h|
64
+ if (!self.class.attribute_map.key?(k.to_sym))
65
+ fail ArgumentError, "`#{k}` is not a valid attribute in `AylienNewsApi::RelatedStories`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
66
+ end
67
+ h[k.to_sym] = v
68
+ }
65
69
 
66
- if attributes.has_key?(:'story_title')
67
- self.story_title = attributes[:'story_title']
70
+ if attributes.key?(:'related_stories')
71
+ if (value = attributes[:'related_stories']).is_a?(Array)
72
+ self.related_stories = value
73
+ end
68
74
  end
69
75
 
70
- if attributes.has_key?(:'story_body')
76
+ if attributes.key?(:'story_body')
71
77
  self.story_body = attributes[:'story_body']
72
78
  end
73
79
 
74
- if attributes.has_key?(:'story_language')
80
+ if attributes.key?(:'story_language')
75
81
  self.story_language = attributes[:'story_language']
76
82
  end
77
83
 
78
- if attributes.has_key?(:'related_stories')
79
- if (value = attributes[:'related_stories']).is_a?(Array)
80
- self.related_stories = value
81
- end
82
- end
83
-
84
- if attributes.has_key?(:'clusters')
85
- if (value = attributes[:'clusters']).is_a?(Array)
86
- self.clusters = value
87
- end
84
+ if attributes.key?(:'story_title')
85
+ self.story_title = attributes[:'story_title']
88
86
  end
89
-
90
87
  end
91
88
 
92
89
  # Show invalid properties with the reasons. Usually used together with valid?
93
- # @return Array for valid properies with the reasons
90
+ # @return Array for valid properties with the reasons
94
91
  def list_invalid_properties
95
92
  invalid_properties = Array.new
96
- return invalid_properties
93
+ invalid_properties
97
94
  end
98
95
 
99
96
  # Check to see if the all the properties in the model are valid
100
97
  # @return true if the model is valid
101
98
  def valid?
102
- return true
99
+ true
103
100
  end
104
101
 
105
102
  # Checks equality by comparing each attribute.
@@ -107,11 +104,10 @@ module AylienNewsApi
107
104
  def ==(o)
108
105
  return true if self.equal?(o)
109
106
  self.class == o.class &&
110
- story_title == o.story_title &&
107
+ related_stories == o.related_stories &&
111
108
  story_body == o.story_body &&
112
109
  story_language == o.story_language &&
113
- related_stories == o.related_stories &&
114
- clusters == o.clusters
110
+ story_title == o.story_title
115
111
  end
116
112
 
117
113
  # @see the `==` method
@@ -121,9 +117,16 @@ module AylienNewsApi
121
117
  end
122
118
 
123
119
  # Calculates hash code according to all attributes.
124
- # @return [Fixnum] Hash code
120
+ # @return [Integer] Hash code
125
121
  def hash
126
- [story_title, story_body, story_language, related_stories, clusters].hash
122
+ [related_stories, story_body, story_language, story_title].hash
123
+ end
124
+
125
+ # Builds the object from hash
126
+ # @param [Hash] attributes Model attributes in the form of hash
127
+ # @return [Object] Returns the model itself
128
+ def self.build_from_hash(attributes)
129
+ new.build_from_hash(attributes)
127
130
  end
128
131
 
129
132
  # Builds the object from hash
@@ -131,12 +134,12 @@ module AylienNewsApi
131
134
  # @return [Object] Returns the model itself
132
135
  def build_from_hash(attributes)
133
136
  return nil unless attributes.is_a?(Hash)
134
- self.class.api_types.each_pair do |key, type|
135
- if type =~ /^Array<(.*)>/i
136
- # check to ensure the input is an array given that the the attribute
137
+ self.class.openapi_types.each_pair do |key, type|
138
+ if type =~ /\AArray<(.*)>/i
139
+ # check to ensure the input is an array given that the attribute
137
140
  # is documented as an array but the input is not
138
141
  if attributes[self.class.attribute_map[key]].is_a?(Array)
139
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
142
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
140
143
  end
141
144
  elsif !attributes[self.class.attribute_map[key]].nil?
142
145
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
@@ -162,8 +165,8 @@ module AylienNewsApi
162
165
  value.to_i
163
166
  when :Float
164
167
  value.to_f
165
- when :BOOLEAN
166
- if value.to_s =~ /^(true|t|yes|y|1)$/i
168
+ when :Boolean
169
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
167
170
  true
168
171
  else
169
172
  false
@@ -174,7 +177,7 @@ module AylienNewsApi
174
177
  when /\AArray<(?<inner_type>.+)>\z/
175
178
  inner_type = Regexp.last_match[:inner_type]
176
179
  value.map { |v| _deserialize(inner_type, v) }
177
- when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
180
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
178
181
  k_type = Regexp.last_match[:k_type]
179
182
  v_type = Regexp.last_match[:v_type]
180
183
  {}.tap do |hash|
@@ -183,8 +186,7 @@ module AylienNewsApi
183
186
  end
184
187
  end
185
188
  else # model
186
- temp_model = AylienNewsApi.const_get(type).new
187
- temp_model.build_from_hash(value)
189
+ AylienNewsApi.const_get(type).build_from_hash(value)
188
190
  end
189
191
  end
190
192
 
@@ -206,7 +208,11 @@ module AylienNewsApi
206
208
  hash = {}
207
209
  self.class.attribute_map.each_pair do |attr, param|
208
210
  value = self.send(attr)
209
- next if value.nil?
211
+ if value.nil?
212
+ is_nullable = self.class.openapi_nullable.include?(attr)
213
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
214
+ end
215
+
210
216
  hash[param] = _to_hash(value)
211
217
  end
212
218
  hash
@@ -218,7 +224,7 @@ module AylienNewsApi
218
224
  # @return [Hash] Returns the value in the form of hash
219
225
  def _to_hash(value)
220
226
  if value.is_a?(Array)
221
- value.compact.map{ |v| _to_hash(v) }
227
+ value.compact.map { |v| _to_hash(v) }
222
228
  elsif value.is_a?(Hash)
223
229
  {}.tap do |hash|
224
230
  value.each { |k, v| hash[k] = _to_hash(v) }
@@ -229,7 +235,5 @@ module AylienNewsApi
229
235
  value
230
236
  end
231
237
  end
232
-
233
238
  end
234
-
235
239
  end