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
@@ -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 ShareCount
20
17
  # The number of shares
21
18
  attr_accessor :count
@@ -23,7 +20,6 @@ module AylienNewsApi
23
20
  # The fetched date of the shares
24
21
  attr_accessor :fetched_at
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
  :'count' => :'Integer',
39
35
  :'fetched_at' => :'DateTime'
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::ShareCount` 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::ShareCount`. 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?(:'count')
60
+ if attributes.key?(:'count')
52
61
  self.count = attributes[:'count']
53
62
  end
54
63
 
55
- if attributes.has_key?(:'fetched_at')
64
+ if attributes.key?(:'fetched_at')
56
65
  self.fetched_at = attributes[:'fetched_at']
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
  [count, fetched_at].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|
101
- if type =~ /^Array<(.*)>/i
102
- # check to ensure the input is an array given that the the attribute
115
+ self.class.openapi_types.each_pair do |key, type|
116
+ if type =~ /\AArray<(.*)>/i
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,8 +143,8 @@ module AylienNewsApi
128
143
  value.to_i
129
144
  when :Float
130
145
  value.to_f
131
- when :BOOLEAN
132
- if value.to_s =~ /^(true|t|yes|y|1)$/i
146
+ when :Boolean
147
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
133
148
  true
134
149
  else
135
150
  false
@@ -140,7 +155,7 @@ module AylienNewsApi
140
155
  when /\AArray<(?<inner_type>.+)>\z/
141
156
  inner_type = Regexp.last_match[:inner_type]
142
157
  value.map { |v| _deserialize(inner_type, v) }
143
- when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
158
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
144
159
  k_type = Regexp.last_match[:k_type]
145
160
  v_type = Regexp.last_match[:v_type]
146
161
  {}.tap do |hash|
@@ -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,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 ShareCounts
20
17
  # Facebook shares count
21
18
  attr_accessor :facebook
@@ -29,7 +26,6 @@ module AylienNewsApi
29
26
  # Reddit shares count
30
27
  attr_accessor :reddit
31
28
 
32
-
33
29
  # Attribute mapping from ruby-style variable name to JSON key.
34
30
  def self.attribute_map
35
31
  {
@@ -41,7 +37,7 @@ module AylienNewsApi
41
37
  end
42
38
 
43
39
  # Attribute type mapping.
44
- def self.api_types
40
+ def self.openapi_types
45
41
  {
46
42
  :'facebook' => :'Array<ShareCount>',
47
43
  :'google_plus' => :'Array<ShareCount>',
@@ -50,51 +46,63 @@ module AylienNewsApi
50
46
  }
51
47
  end
52
48
 
49
+ # List of attributes with nullable: true
50
+ def self.openapi_nullable
51
+ Set.new([
52
+ ])
53
+ end
54
+
53
55
  # Initializes the object
54
56
  # @param [Hash] attributes Model attributes in the form of hash
55
57
  def initialize(attributes = {})
56
- 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::ShareCounts` initialize method"
60
+ end
57
61
 
58
- # convert string to symbol for hash key
59
- 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::ShareCounts`. 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
+ }
60
69
 
61
- if attributes.has_key?(:'facebook')
70
+ if attributes.key?(:'facebook')
62
71
  if (value = attributes[:'facebook']).is_a?(Array)
63
72
  self.facebook = value
64
73
  end
65
74
  end
66
75
 
67
- if attributes.has_key?(:'google_plus')
76
+ if attributes.key?(:'google_plus')
68
77
  if (value = attributes[:'google_plus']).is_a?(Array)
69
78
  self.google_plus = value
70
79
  end
71
80
  end
72
81
 
73
- if attributes.has_key?(:'linkedin')
82
+ if attributes.key?(:'linkedin')
74
83
  if (value = attributes[:'linkedin']).is_a?(Array)
75
84
  self.linkedin = value
76
85
  end
77
86
  end
78
87
 
79
- if attributes.has_key?(:'reddit')
88
+ if attributes.key?(:'reddit')
80
89
  if (value = attributes[:'reddit']).is_a?(Array)
81
90
  self.reddit = value
82
91
  end
83
92
  end
84
-
85
93
  end
86
94
 
87
95
  # Show invalid properties with the reasons. Usually used together with valid?
88
- # @return Array for valid properies with the reasons
96
+ # @return Array for valid properties with the reasons
89
97
  def list_invalid_properties
90
98
  invalid_properties = Array.new
91
- return invalid_properties
99
+ invalid_properties
92
100
  end
93
101
 
94
102
  # Check to see if the all the properties in the model are valid
95
103
  # @return true if the model is valid
96
104
  def valid?
97
- return true
105
+ true
98
106
  end
99
107
 
100
108
  # Checks equality by comparing each attribute.
@@ -115,22 +123,29 @@ module AylienNewsApi
115
123
  end
116
124
 
117
125
  # Calculates hash code according to all attributes.
118
- # @return [Fixnum] Hash code
126
+ # @return [Integer] Hash code
119
127
  def hash
120
128
  [facebook, google_plus, linkedin, reddit].hash
121
129
  end
122
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)
136
+ end
137
+
123
138
  # Builds the object from hash
124
139
  # @param [Hash] attributes Model attributes in the form of hash
125
140
  # @return [Object] Returns the model itself
126
141
  def build_from_hash(attributes)
127
142
  return nil unless attributes.is_a?(Hash)
128
- self.class.api_types.each_pair do |key, type|
129
- if type =~ /^Array<(.*)>/i
130
- # check to ensure the input is an array given that the the attribute
143
+ self.class.openapi_types.each_pair do |key, type|
144
+ if type =~ /\AArray<(.*)>/i
145
+ # check to ensure the input is an array given that the attribute
131
146
  # is documented as an array but the input is not
132
147
  if attributes[self.class.attribute_map[key]].is_a?(Array)
133
- 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) })
134
149
  end
135
150
  elsif !attributes[self.class.attribute_map[key]].nil?
136
151
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
@@ -156,8 +171,8 @@ module AylienNewsApi
156
171
  value.to_i
157
172
  when :Float
158
173
  value.to_f
159
- when :BOOLEAN
160
- if value.to_s =~ /^(true|t|yes|y|1)$/i
174
+ when :Boolean
175
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
161
176
  true
162
177
  else
163
178
  false
@@ -168,7 +183,7 @@ module AylienNewsApi
168
183
  when /\AArray<(?<inner_type>.+)>\z/
169
184
  inner_type = Regexp.last_match[:inner_type]
170
185
  value.map { |v| _deserialize(inner_type, v) }
171
- when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
186
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
172
187
  k_type = Regexp.last_match[:k_type]
173
188
  v_type = Regexp.last_match[:v_type]
174
189
  {}.tap do |hash|
@@ -177,8 +192,7 @@ module AylienNewsApi
177
192
  end
178
193
  end
179
194
  else # model
180
- temp_model = AylienNewsApi.const_get(type).new
181
- temp_model.build_from_hash(value)
195
+ AylienNewsApi.const_get(type).build_from_hash(value)
182
196
  end
183
197
  end
184
198
 
@@ -200,7 +214,11 @@ module AylienNewsApi
200
214
  hash = {}
201
215
  self.class.attribute_map.each_pair do |attr, param|
202
216
  value = self.send(attr)
203
- next if value.nil?
217
+ if value.nil?
218
+ is_nullable = self.class.openapi_nullable.include?(attr)
219
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
220
+ end
221
+
204
222
  hash[param] = _to_hash(value)
205
223
  end
206
224
  hash
@@ -212,7 +230,7 @@ module AylienNewsApi
212
230
  # @return [Hash] Returns the value in the form of hash
213
231
  def _to_hash(value)
214
232
  if value.is_a?(Array)
215
- value.compact.map{ |v| _to_hash(v) }
233
+ value.compact.map { |v| _to_hash(v) }
216
234
  elsif value.is_a?(Hash)
217
235
  {}.tap do |hash|
218
236
  value.each { |k, v| hash[k] = _to_hash(v) }
@@ -223,7 +241,5 @@ module AylienNewsApi
223
241
  value
224
242
  end
225
243
  end
226
-
227
244
  end
228
-
229
245
  end
@@ -1,114 +1,166 @@
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 Source
17
+ # A general explanation about the source
18
+ attr_accessor :description
19
+
20
+ # The domain name of the source which is extracted from the source URL
21
+ attr_accessor :domain
22
+
23
+ # The home page URL of the source
24
+ attr_accessor :home_page_url
25
+
20
26
  # The source id which is a unique value
21
27
  attr_accessor :id
22
28
 
23
- # The source name
24
- attr_accessor :name
29
+ # The number of websites that link to the source
30
+ attr_accessor :links_in_count
25
31
 
26
- # Domain name of the source which is extracted from the source URL
27
- attr_accessor :domain
32
+ # The source locations which are tend to be the physical locations of the source, e.g. BBC headquarter is located in London.
33
+ attr_accessor :locations
28
34
 
29
35
  # A URL which points to the source logo
30
36
  attr_accessor :logo_url
31
37
 
32
- # The source locations which are tend to be the physical locations of the source, e.g. BBC headquarter is located in London.
33
- attr_accessor :locations
38
+ # The source name
39
+ attr_accessor :name
40
+
41
+ attr_accessor :rankings
34
42
 
35
43
  # The source scopes which is tend to be scope locations of the source, e.g. BBC scopes is international.
36
44
  attr_accessor :scopes
37
45
 
46
+ # The title of the home page URL
47
+ attr_accessor :title
38
48
 
39
49
  # Attribute mapping from ruby-style variable name to JSON key.
40
50
  def self.attribute_map
41
51
  {
42
- :'id' => :'id',
43
- :'name' => :'name',
52
+ :'description' => :'description',
44
53
  :'domain' => :'domain',
45
- :'logo_url' => :'logo_url',
54
+ :'home_page_url' => :'home_page_url',
55
+ :'id' => :'id',
56
+ :'links_in_count' => :'links_in_count',
46
57
  :'locations' => :'locations',
47
- :'scopes' => :'scopes'
58
+ :'logo_url' => :'logo_url',
59
+ :'name' => :'name',
60
+ :'rankings' => :'rankings',
61
+ :'scopes' => :'scopes',
62
+ :'title' => :'title'
48
63
  }
49
64
  end
50
65
 
51
66
  # Attribute type mapping.
52
- def self.api_types
67
+ def self.openapi_types
53
68
  {
54
- :'id' => :'Integer',
55
- :'name' => :'String',
69
+ :'description' => :'String',
56
70
  :'domain' => :'String',
57
- :'logo_url' => :'String',
71
+ :'home_page_url' => :'String',
72
+ :'id' => :'Integer',
73
+ :'links_in_count' => :'Integer',
58
74
  :'locations' => :'Array<Location>',
59
- :'scopes' => :'Array<Scope>'
75
+ :'logo_url' => :'String',
76
+ :'name' => :'String',
77
+ :'rankings' => :'Rankings',
78
+ :'scopes' => :'Array<Scope>',
79
+ :'title' => :'String'
60
80
  }
61
81
  end
62
82
 
83
+ # List of attributes with nullable: true
84
+ def self.openapi_nullable
85
+ Set.new([
86
+ ])
87
+ end
88
+
63
89
  # Initializes the object
64
90
  # @param [Hash] attributes Model attributes in the form of hash
65
91
  def initialize(attributes = {})
66
- return unless attributes.is_a?(Hash)
92
+ if (!attributes.is_a?(Hash))
93
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::Source` initialize method"
94
+ end
95
+
96
+ # check to see if the attribute exists and convert string to symbol for hash key
97
+ attributes = attributes.each_with_object({}) { |(k, v), h|
98
+ if (!self.class.attribute_map.key?(k.to_sym))
99
+ fail ArgumentError, "`#{k}` is not a valid attribute in `AylienNewsApi::Source`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
100
+ end
101
+ h[k.to_sym] = v
102
+ }
67
103
 
68
- # convert string to symbol for hash key
69
- attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
104
+ if attributes.key?(:'description')
105
+ self.description = attributes[:'description']
106
+ end
70
107
 
71
- if attributes.has_key?(:'id')
72
- self.id = attributes[:'id']
108
+ if attributes.key?(:'domain')
109
+ self.domain = attributes[:'domain']
73
110
  end
74
111
 
75
- if attributes.has_key?(:'name')
76
- self.name = attributes[:'name']
112
+ if attributes.key?(:'home_page_url')
113
+ self.home_page_url = attributes[:'home_page_url']
77
114
  end
78
115
 
79
- if attributes.has_key?(:'domain')
80
- self.domain = attributes[:'domain']
116
+ if attributes.key?(:'id')
117
+ self.id = attributes[:'id']
81
118
  end
82
119
 
83
- if attributes.has_key?(:'logo_url')
84
- self.logo_url = attributes[:'logo_url']
120
+ if attributes.key?(:'links_in_count')
121
+ self.links_in_count = attributes[:'links_in_count']
85
122
  end
86
123
 
87
- if attributes.has_key?(:'locations')
124
+ if attributes.key?(:'locations')
88
125
  if (value = attributes[:'locations']).is_a?(Array)
89
126
  self.locations = value
90
127
  end
91
128
  end
92
129
 
93
- if attributes.has_key?(:'scopes')
130
+ if attributes.key?(:'logo_url')
131
+ self.logo_url = attributes[:'logo_url']
132
+ end
133
+
134
+ if attributes.key?(:'name')
135
+ self.name = attributes[:'name']
136
+ end
137
+
138
+ if attributes.key?(:'rankings')
139
+ self.rankings = attributes[:'rankings']
140
+ end
141
+
142
+ if attributes.key?(:'scopes')
94
143
  if (value = attributes[:'scopes']).is_a?(Array)
95
144
  self.scopes = value
96
145
  end
97
146
  end
98
147
 
148
+ if attributes.key?(:'title')
149
+ self.title = attributes[:'title']
150
+ end
99
151
  end
100
152
 
101
153
  # Show invalid properties with the reasons. Usually used together with valid?
102
- # @return Array for valid properies with the reasons
154
+ # @return Array for valid properties with the reasons
103
155
  def list_invalid_properties
104
156
  invalid_properties = Array.new
105
- return invalid_properties
157
+ invalid_properties
106
158
  end
107
159
 
108
160
  # Check to see if the all the properties in the model are valid
109
161
  # @return true if the model is valid
110
162
  def valid?
111
- return true
163
+ true
112
164
  end
113
165
 
114
166
  # Checks equality by comparing each attribute.
@@ -116,12 +168,17 @@ module AylienNewsApi
116
168
  def ==(o)
117
169
  return true if self.equal?(o)
118
170
  self.class == o.class &&
119
- id == o.id &&
120
- name == o.name &&
171
+ description == o.description &&
121
172
  domain == o.domain &&
122
- logo_url == o.logo_url &&
173
+ home_page_url == o.home_page_url &&
174
+ id == o.id &&
175
+ links_in_count == o.links_in_count &&
123
176
  locations == o.locations &&
124
- scopes == o.scopes
177
+ logo_url == o.logo_url &&
178
+ name == o.name &&
179
+ rankings == o.rankings &&
180
+ scopes == o.scopes &&
181
+ title == o.title
125
182
  end
126
183
 
127
184
  # @see the `==` method
@@ -131,9 +188,16 @@ module AylienNewsApi
131
188
  end
132
189
 
133
190
  # Calculates hash code according to all attributes.
134
- # @return [Fixnum] Hash code
191
+ # @return [Integer] Hash code
135
192
  def hash
136
- [id, name, domain, logo_url, locations, scopes].hash
193
+ [description, domain, home_page_url, id, links_in_count, locations, logo_url, name, rankings, scopes, title].hash
194
+ end
195
+
196
+ # Builds the object from hash
197
+ # @param [Hash] attributes Model attributes in the form of hash
198
+ # @return [Object] Returns the model itself
199
+ def self.build_from_hash(attributes)
200
+ new.build_from_hash(attributes)
137
201
  end
138
202
 
139
203
  # Builds the object from hash
@@ -141,12 +205,12 @@ module AylienNewsApi
141
205
  # @return [Object] Returns the model itself
142
206
  def build_from_hash(attributes)
143
207
  return nil unless attributes.is_a?(Hash)
144
- self.class.api_types.each_pair do |key, type|
145
- if type =~ /^Array<(.*)>/i
146
- # check to ensure the input is an array given that the the attribute
208
+ self.class.openapi_types.each_pair do |key, type|
209
+ if type =~ /\AArray<(.*)>/i
210
+ # check to ensure the input is an array given that the attribute
147
211
  # is documented as an array but the input is not
148
212
  if attributes[self.class.attribute_map[key]].is_a?(Array)
149
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
213
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
150
214
  end
151
215
  elsif !attributes[self.class.attribute_map[key]].nil?
152
216
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
@@ -172,8 +236,8 @@ module AylienNewsApi
172
236
  value.to_i
173
237
  when :Float
174
238
  value.to_f
175
- when :BOOLEAN
176
- if value.to_s =~ /^(true|t|yes|y|1)$/i
239
+ when :Boolean
240
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
177
241
  true
178
242
  else
179
243
  false
@@ -184,7 +248,7 @@ module AylienNewsApi
184
248
  when /\AArray<(?<inner_type>.+)>\z/
185
249
  inner_type = Regexp.last_match[:inner_type]
186
250
  value.map { |v| _deserialize(inner_type, v) }
187
- when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
251
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
188
252
  k_type = Regexp.last_match[:k_type]
189
253
  v_type = Regexp.last_match[:v_type]
190
254
  {}.tap do |hash|
@@ -193,8 +257,7 @@ module AylienNewsApi
193
257
  end
194
258
  end
195
259
  else # model
196
- temp_model = AylienNewsApi.const_get(type).new
197
- temp_model.build_from_hash(value)
260
+ AylienNewsApi.const_get(type).build_from_hash(value)
198
261
  end
199
262
  end
200
263
 
@@ -216,7 +279,11 @@ module AylienNewsApi
216
279
  hash = {}
217
280
  self.class.attribute_map.each_pair do |attr, param|
218
281
  value = self.send(attr)
219
- next if value.nil?
282
+ if value.nil?
283
+ is_nullable = self.class.openapi_nullable.include?(attr)
284
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
285
+ end
286
+
220
287
  hash[param] = _to_hash(value)
221
288
  end
222
289
  hash
@@ -228,7 +295,7 @@ module AylienNewsApi
228
295
  # @return [Hash] Returns the value in the form of hash
229
296
  def _to_hash(value)
230
297
  if value.is_a?(Array)
231
- value.compact.map{ |v| _to_hash(v) }
298
+ value.compact.map { |v| _to_hash(v) }
232
299
  elsif value.is_a?(Hash)
233
300
  {}.tap do |hash|
234
301
  value.each { |k, v| hash[k] = _to_hash(v) }
@@ -239,7 +306,5 @@ module AylienNewsApi
239
306
  value
240
307
  end
241
308
  end
242
-
243
309
  end
244
-
245
310
  end