aylien_news_api 1.0.0 → 3.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 (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,89 +1,78 @@
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 Stories
22
- # An array of stories
23
- attr_accessor :stories
24
-
25
- # An array of clusters
26
- attr_accessor :clusters
27
-
28
17
  # The next page cursor
29
18
  attr_accessor :next_page_cursor
30
19
 
20
+ # An array of stories
21
+ attr_accessor :stories
31
22
 
32
23
  # Attribute mapping from ruby-style variable name to JSON key.
33
24
  def self.attribute_map
34
25
  {
35
- :'stories' => :'stories',
36
- :'clusters' => :'clusters',
37
- :'next_page_cursor' => :'next_page_cursor'
26
+ :'next_page_cursor' => :'next_page_cursor',
27
+ :'stories' => :'stories'
38
28
  }
39
29
  end
40
30
 
41
31
  # Attribute type mapping.
42
- def self.api_types
32
+ def self.openapi_types
43
33
  {
44
- :'stories' => :'Array<Story>',
45
- :'clusters' => :'Array<StoryCluster>',
46
- :'next_page_cursor' => :'String'
34
+ :'next_page_cursor' => :'String',
35
+ :'stories' => :'Array<Story>'
47
36
  }
48
37
  end
49
38
 
50
39
  # Initializes the object
51
40
  # @param [Hash] attributes Model attributes in the form of hash
52
41
  def initialize(attributes = {})
53
- return unless attributes.is_a?(Hash)
54
-
55
- # convert string to symbol for hash key
56
- attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
57
-
58
- if attributes.has_key?(:'stories')
59
- if (value = attributes[:'stories']).is_a?(Array)
60
- self.stories = value
61
- end
42
+ if (!attributes.is_a?(Hash))
43
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::Stories` initialize method"
62
44
  end
63
45
 
64
- if attributes.has_key?(:'clusters')
65
- if (value = attributes[:'clusters']).is_a?(Array)
66
- self.clusters = value
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::Stories`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
67
50
  end
68
- end
51
+ h[k.to_sym] = v
52
+ }
69
53
 
70
- if attributes.has_key?(:'next_page_cursor')
54
+ if attributes.key?(:'next_page_cursor')
71
55
  self.next_page_cursor = attributes[:'next_page_cursor']
72
56
  end
73
57
 
58
+ if attributes.key?(:'stories')
59
+ if (value = attributes[:'stories']).is_a?(Array)
60
+ self.stories = value
61
+ end
62
+ end
74
63
  end
75
64
 
76
65
  # Show invalid properties with the reasons. Usually used together with valid?
77
- # @return Array for valid properies with the reasons
66
+ # @return Array for valid properties with the reasons
78
67
  def list_invalid_properties
79
68
  invalid_properties = Array.new
80
- return invalid_properties
69
+ invalid_properties
81
70
  end
82
71
 
83
72
  # Check to see if the all the properties in the model are valid
84
73
  # @return true if the model is valid
85
74
  def valid?
86
- return true
75
+ true
87
76
  end
88
77
 
89
78
  # Checks equality by comparing each attribute.
@@ -91,9 +80,8 @@ module AylienNewsApi
91
80
  def ==(o)
92
81
  return true if self.equal?(o)
93
82
  self.class == o.class &&
94
- stories == o.stories &&
95
- clusters == o.clusters &&
96
- next_page_cursor == o.next_page_cursor
83
+ next_page_cursor == o.next_page_cursor &&
84
+ stories == o.stories
97
85
  end
98
86
 
99
87
  # @see the `==` method
@@ -103,9 +91,16 @@ module AylienNewsApi
103
91
  end
104
92
 
105
93
  # Calculates hash code according to all attributes.
106
- # @return [Fixnum] Hash code
94
+ # @return [Integer] Hash code
107
95
  def hash
108
- [stories, clusters, next_page_cursor].hash
96
+ [next_page_cursor, stories].hash
97
+ end
98
+
99
+ # Builds the object from hash
100
+ # @param [Hash] attributes Model attributes in the form of hash
101
+ # @return [Object] Returns the model itself
102
+ def self.build_from_hash(attributes)
103
+ new.build_from_hash(attributes)
109
104
  end
110
105
 
111
106
  # Builds the object from hash
@@ -113,12 +108,12 @@ module AylienNewsApi
113
108
  # @return [Object] Returns the model itself
114
109
  def build_from_hash(attributes)
115
110
  return nil unless attributes.is_a?(Hash)
116
- self.class.api_types.each_pair do |key, type|
111
+ self.class.openapi_types.each_pair do |key, type|
117
112
  if type =~ /\AArray<(.*)>/i
118
- # check to ensure the input is an array given that the the attribute
113
+ # check to ensure the input is an array given that the attribute
119
114
  # is documented as an array but the input is not
120
115
  if attributes[self.class.attribute_map[key]].is_a?(Array)
121
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
116
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
122
117
  end
123
118
  elsif !attributes[self.class.attribute_map[key]].nil?
124
119
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
@@ -144,7 +139,7 @@ module AylienNewsApi
144
139
  value.to_i
145
140
  when :Float
146
141
  value.to_f
147
- when :BOOLEAN
142
+ when :Boolean
148
143
  if value.to_s =~ /\A(true|t|yes|y|1)\z/i
149
144
  true
150
145
  else
@@ -165,8 +160,7 @@ module AylienNewsApi
165
160
  end
166
161
  end
167
162
  else # model
168
- temp_model = AylienNewsApi.const_get(type).new
169
- temp_model.build_from_hash(value)
163
+ AylienNewsApi.const_get(type).build_from_hash(value)
170
164
  end
171
165
  end
172
166
 
@@ -200,7 +194,7 @@ module AylienNewsApi
200
194
  # @return [Hash] Returns the value in the form of hash
201
195
  def _to_hash(value)
202
196
  if value.is_a?(Array)
203
- value.compact.map{ |v| _to_hash(v) }
197
+ value.compact.map { |v| _to_hash(v) }
204
198
  elsif value.is_a?(Hash)
205
199
  {}.tap do |hash|
206
200
  value.each { |k, v| hash[k] = _to_hash(v) }
@@ -211,7 +205,5 @@ module AylienNewsApi
211
205
  value
212
206
  end
213
207
  end
214
-
215
208
  end
216
-
217
209
  end
@@ -1,246 +1,258 @@
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 Story
22
- # ID of the story which is a unique identification
23
- attr_accessor :id
24
-
25
- # Title of the story
26
- attr_accessor :title
17
+ attr_accessor :author
27
18
 
28
19
  # Body of the story
29
20
  attr_accessor :body
30
21
 
31
- # The suggested story summary
32
- attr_accessor :summary
22
+ # Suggested categories for the story
23
+ attr_accessor :categories
33
24
 
34
- # The story source
35
- attr_accessor :source
25
+ # Character count of the story body
26
+ attr_accessor :characters_count
36
27
 
37
- # The story author
38
- attr_accessor :author
28
+ # An array of clusters the story is associated with
29
+ attr_accessor :clusters
39
30
 
40
- # Extracted entities from the story title or body
41
31
  attr_accessor :entities
42
32
 
43
- # Extracted keywords mentioned in the story title or body
44
- attr_accessor :keywords
45
-
46
33
  # An array of suggested Story hashtags
47
34
  attr_accessor :hashtags
48
35
 
49
- # Character count of the story body
50
- attr_accessor :characters_count
36
+ # ID of the story which is a unique identification
37
+ attr_accessor :id
51
38
 
52
- # Word count of the story body
53
- attr_accessor :words_count
39
+ # Extracted keywords mentioned in the story title or body
40
+ attr_accessor :keywords
54
41
 
55
- # Sentence count of the story body
56
- attr_accessor :sentences_count
42
+ # Language of the story
43
+ attr_accessor :language
44
+
45
+ attr_accessor :links
46
+
47
+ # An array of extracted media such as images and videos
48
+ attr_accessor :media
57
49
 
58
50
  # Paragraph count of the story body
59
51
  attr_accessor :paragraphs_count
60
52
 
61
- # Suggested categories for the story
62
- attr_accessor :categories
63
-
64
- # Social shares count for the story
65
- attr_accessor :social_shares_count
53
+ # Published date of the story
54
+ attr_accessor :published_at
66
55
 
67
- # An array of extracted media such as images and videos
68
- attr_accessor :media
56
+ # Sentence count of the story body
57
+ attr_accessor :sentences_count
69
58
 
70
- # Suggested sentiments for the story title or body
71
59
  attr_accessor :sentiment
72
60
 
73
- # Language of the story
74
- attr_accessor :language
61
+ attr_accessor :social_shares_count
75
62
 
76
- # Published date of the story
77
- attr_accessor :published_at
63
+ attr_accessor :source
78
64
 
79
- # Links which is related to the story
80
- attr_accessor :links
65
+ attr_accessor :summary
81
66
 
67
+ # Title of the story
68
+ attr_accessor :title
69
+
70
+ attr_accessor :translations
71
+
72
+ # Word count of the story body
73
+ attr_accessor :words_count
82
74
 
83
75
  # Attribute mapping from ruby-style variable name to JSON key.
84
76
  def self.attribute_map
85
77
  {
86
- :'id' => :'id',
87
- :'title' => :'title',
88
- :'body' => :'body',
89
- :'summary' => :'summary',
90
- :'source' => :'source',
91
78
  :'author' => :'author',
79
+ :'body' => :'body',
80
+ :'categories' => :'categories',
81
+ :'characters_count' => :'characters_count',
82
+ :'clusters' => :'clusters',
92
83
  :'entities' => :'entities',
93
- :'keywords' => :'keywords',
94
84
  :'hashtags' => :'hashtags',
95
- :'characters_count' => :'characters_count',
96
- :'words_count' => :'words_count',
97
- :'sentences_count' => :'sentences_count',
98
- :'paragraphs_count' => :'paragraphs_count',
99
- :'categories' => :'categories',
100
- :'social_shares_count' => :'social_shares_count',
101
- :'media' => :'media',
102
- :'sentiment' => :'sentiment',
85
+ :'id' => :'id',
86
+ :'keywords' => :'keywords',
103
87
  :'language' => :'language',
88
+ :'links' => :'links',
89
+ :'media' => :'media',
90
+ :'paragraphs_count' => :'paragraphs_count',
104
91
  :'published_at' => :'published_at',
105
- :'links' => :'links'
92
+ :'sentences_count' => :'sentences_count',
93
+ :'sentiment' => :'sentiment',
94
+ :'social_shares_count' => :'social_shares_count',
95
+ :'source' => :'source',
96
+ :'summary' => :'summary',
97
+ :'title' => :'title',
98
+ :'translations' => :'translations',
99
+ :'words_count' => :'words_count'
106
100
  }
107
101
  end
108
102
 
109
103
  # Attribute type mapping.
110
- def self.api_types
104
+ def self.openapi_types
111
105
  {
112
- :'id' => :'Integer',
113
- :'title' => :'String',
114
- :'body' => :'String',
115
- :'summary' => :'Summary',
116
- :'source' => :'Source',
117
106
  :'author' => :'Author',
107
+ :'body' => :'String',
108
+ :'categories' => :'Array<Category>',
109
+ :'characters_count' => :'Integer',
110
+ :'clusters' => :'Array<Integer>',
118
111
  :'entities' => :'Entities',
119
- :'keywords' => :'Array<String>',
120
112
  :'hashtags' => :'Array<String>',
121
- :'characters_count' => :'Integer',
122
- :'words_count' => :'Integer',
123
- :'sentences_count' => :'Integer',
124
- :'paragraphs_count' => :'Integer',
125
- :'categories' => :'Array<Category>',
126
- :'social_shares_count' => :'ShareCounts',
127
- :'media' => :'Array<Media>',
128
- :'sentiment' => :'Sentiments',
113
+ :'id' => :'Integer',
114
+ :'keywords' => :'Array<String>',
129
115
  :'language' => :'String',
116
+ :'links' => :'StoryLinks',
117
+ :'media' => :'Array<Media>',
118
+ :'paragraphs_count' => :'Integer',
130
119
  :'published_at' => :'DateTime',
131
- :'links' => :'StoryLinks'
120
+ :'sentences_count' => :'Integer',
121
+ :'sentiment' => :'Sentiments',
122
+ :'social_shares_count' => :'ShareCounts',
123
+ :'source' => :'Source',
124
+ :'summary' => :'Summary',
125
+ :'title' => :'String',
126
+ :'translations' => :'StoryTranslations',
127
+ :'words_count' => :'Integer'
132
128
  }
133
129
  end
134
130
 
135
131
  # Initializes the object
136
132
  # @param [Hash] attributes Model attributes in the form of hash
137
133
  def initialize(attributes = {})
138
- return unless attributes.is_a?(Hash)
139
-
140
- # convert string to symbol for hash key
141
- attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
142
-
143
- if attributes.has_key?(:'id')
144
- self.id = attributes[:'id']
134
+ if (!attributes.is_a?(Hash))
135
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::Story` initialize method"
145
136
  end
146
137
 
147
- if attributes.has_key?(:'title')
148
- self.title = attributes[:'title']
138
+ # check to see if the attribute exists and convert string to symbol for hash key
139
+ attributes = attributes.each_with_object({}) { |(k, v), h|
140
+ if (!self.class.attribute_map.key?(k.to_sym))
141
+ fail ArgumentError, "`#{k}` is not a valid attribute in `AylienNewsApi::Story`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
142
+ end
143
+ h[k.to_sym] = v
144
+ }
145
+
146
+ if attributes.key?(:'author')
147
+ self.author = attributes[:'author']
149
148
  end
150
149
 
151
- if attributes.has_key?(:'body')
150
+ if attributes.key?(:'body')
152
151
  self.body = attributes[:'body']
153
152
  end
154
153
 
155
- if attributes.has_key?(:'summary')
156
- self.summary = attributes[:'summary']
154
+ if attributes.key?(:'categories')
155
+ if (value = attributes[:'categories']).is_a?(Array)
156
+ self.categories = value
157
+ end
157
158
  end
158
159
 
159
- if attributes.has_key?(:'source')
160
- self.source = attributes[:'source']
160
+ if attributes.key?(:'characters_count')
161
+ self.characters_count = attributes[:'characters_count']
161
162
  end
162
163
 
163
- if attributes.has_key?(:'author')
164
- self.author = attributes[:'author']
164
+ if attributes.key?(:'clusters')
165
+ if (value = attributes[:'clusters']).is_a?(Array)
166
+ self.clusters = value
167
+ end
165
168
  end
166
169
 
167
- if attributes.has_key?(:'entities')
170
+ if attributes.key?(:'entities')
168
171
  self.entities = attributes[:'entities']
169
172
  end
170
173
 
171
- if attributes.has_key?(:'keywords')
172
- if (value = attributes[:'keywords']).is_a?(Array)
173
- self.keywords = value
174
- end
175
- end
176
-
177
- if attributes.has_key?(:'hashtags')
174
+ if attributes.key?(:'hashtags')
178
175
  if (value = attributes[:'hashtags']).is_a?(Array)
179
176
  self.hashtags = value
180
177
  end
181
178
  end
182
179
 
183
- if attributes.has_key?(:'characters_count')
184
- self.characters_count = attributes[:'characters_count']
180
+ if attributes.key?(:'id')
181
+ self.id = attributes[:'id']
185
182
  end
186
183
 
187
- if attributes.has_key?(:'words_count')
188
- self.words_count = attributes[:'words_count']
184
+ if attributes.key?(:'keywords')
185
+ if (value = attributes[:'keywords']).is_a?(Array)
186
+ self.keywords = value
187
+ end
189
188
  end
190
189
 
191
- if attributes.has_key?(:'sentences_count')
192
- self.sentences_count = attributes[:'sentences_count']
190
+ if attributes.key?(:'language')
191
+ self.language = attributes[:'language']
193
192
  end
194
193
 
195
- if attributes.has_key?(:'paragraphs_count')
196
- self.paragraphs_count = attributes[:'paragraphs_count']
194
+ if attributes.key?(:'links')
195
+ self.links = attributes[:'links']
197
196
  end
198
197
 
199
- if attributes.has_key?(:'categories')
200
- if (value = attributes[:'categories']).is_a?(Array)
201
- self.categories = value
198
+ if attributes.key?(:'media')
199
+ if (value = attributes[:'media']).is_a?(Array)
200
+ self.media = value
202
201
  end
203
202
  end
204
203
 
205
- if attributes.has_key?(:'social_shares_count')
206
- self.social_shares_count = attributes[:'social_shares_count']
204
+ if attributes.key?(:'paragraphs_count')
205
+ self.paragraphs_count = attributes[:'paragraphs_count']
207
206
  end
208
207
 
209
- if attributes.has_key?(:'media')
210
- if (value = attributes[:'media']).is_a?(Array)
211
- self.media = value
212
- end
208
+ if attributes.key?(:'published_at')
209
+ self.published_at = attributes[:'published_at']
210
+ end
211
+
212
+ if attributes.key?(:'sentences_count')
213
+ self.sentences_count = attributes[:'sentences_count']
213
214
  end
214
215
 
215
- if attributes.has_key?(:'sentiment')
216
+ if attributes.key?(:'sentiment')
216
217
  self.sentiment = attributes[:'sentiment']
217
218
  end
218
219
 
219
- if attributes.has_key?(:'language')
220
- self.language = attributes[:'language']
220
+ if attributes.key?(:'social_shares_count')
221
+ self.social_shares_count = attributes[:'social_shares_count']
221
222
  end
222
223
 
223
- if attributes.has_key?(:'published_at')
224
- self.published_at = attributes[:'published_at']
224
+ if attributes.key?(:'source')
225
+ self.source = attributes[:'source']
225
226
  end
226
227
 
227
- if attributes.has_key?(:'links')
228
- self.links = attributes[:'links']
228
+ if attributes.key?(:'summary')
229
+ self.summary = attributes[:'summary']
230
+ end
231
+
232
+ if attributes.key?(:'title')
233
+ self.title = attributes[:'title']
229
234
  end
230
235
 
236
+ if attributes.key?(:'translations')
237
+ self.translations = attributes[:'translations']
238
+ end
239
+
240
+ if attributes.key?(:'words_count')
241
+ self.words_count = attributes[:'words_count']
242
+ end
231
243
  end
232
244
 
233
245
  # Show invalid properties with the reasons. Usually used together with valid?
234
- # @return Array for valid properies with the reasons
246
+ # @return Array for valid properties with the reasons
235
247
  def list_invalid_properties
236
248
  invalid_properties = Array.new
237
- return invalid_properties
249
+ invalid_properties
238
250
  end
239
251
 
240
252
  # Check to see if the all the properties in the model are valid
241
253
  # @return true if the model is valid
242
254
  def valid?
243
- return true
255
+ true
244
256
  end
245
257
 
246
258
  # Checks equality by comparing each attribute.
@@ -248,26 +260,28 @@ module AylienNewsApi
248
260
  def ==(o)
249
261
  return true if self.equal?(o)
250
262
  self.class == o.class &&
251
- id == o.id &&
252
- title == o.title &&
253
- body == o.body &&
254
- summary == o.summary &&
255
- source == o.source &&
256
263
  author == o.author &&
264
+ body == o.body &&
265
+ categories == o.categories &&
266
+ characters_count == o.characters_count &&
267
+ clusters == o.clusters &&
257
268
  entities == o.entities &&
258
- keywords == o.keywords &&
259
269
  hashtags == o.hashtags &&
260
- characters_count == o.characters_count &&
261
- words_count == o.words_count &&
262
- sentences_count == o.sentences_count &&
263
- paragraphs_count == o.paragraphs_count &&
264
- categories == o.categories &&
265
- social_shares_count == o.social_shares_count &&
266
- media == o.media &&
267
- sentiment == o.sentiment &&
270
+ id == o.id &&
271
+ keywords == o.keywords &&
268
272
  language == o.language &&
273
+ links == o.links &&
274
+ media == o.media &&
275
+ paragraphs_count == o.paragraphs_count &&
269
276
  published_at == o.published_at &&
270
- links == o.links
277
+ sentences_count == o.sentences_count &&
278
+ sentiment == o.sentiment &&
279
+ social_shares_count == o.social_shares_count &&
280
+ source == o.source &&
281
+ summary == o.summary &&
282
+ title == o.title &&
283
+ translations == o.translations &&
284
+ words_count == o.words_count
271
285
  end
272
286
 
273
287
  # @see the `==` method
@@ -277,9 +291,16 @@ module AylienNewsApi
277
291
  end
278
292
 
279
293
  # Calculates hash code according to all attributes.
280
- # @return [Fixnum] Hash code
294
+ # @return [Integer] Hash code
281
295
  def hash
282
- [id, title, body, summary, source, author, entities, keywords, hashtags, characters_count, words_count, sentences_count, paragraphs_count, categories, social_shares_count, media, sentiment, language, published_at, links].hash
296
+ [author, body, categories, characters_count, clusters, entities, hashtags, id, keywords, language, links, media, paragraphs_count, published_at, sentences_count, sentiment, social_shares_count, source, summary, title, translations, words_count].hash
297
+ end
298
+
299
+ # Builds the object from hash
300
+ # @param [Hash] attributes Model attributes in the form of hash
301
+ # @return [Object] Returns the model itself
302
+ def self.build_from_hash(attributes)
303
+ new.build_from_hash(attributes)
283
304
  end
284
305
 
285
306
  # Builds the object from hash
@@ -287,12 +308,12 @@ module AylienNewsApi
287
308
  # @return [Object] Returns the model itself
288
309
  def build_from_hash(attributes)
289
310
  return nil unless attributes.is_a?(Hash)
290
- self.class.api_types.each_pair do |key, type|
311
+ self.class.openapi_types.each_pair do |key, type|
291
312
  if type =~ /\AArray<(.*)>/i
292
- # check to ensure the input is an array given that the the attribute
313
+ # check to ensure the input is an array given that the attribute
293
314
  # is documented as an array but the input is not
294
315
  if attributes[self.class.attribute_map[key]].is_a?(Array)
295
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
316
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
296
317
  end
297
318
  elsif !attributes[self.class.attribute_map[key]].nil?
298
319
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
@@ -318,7 +339,7 @@ module AylienNewsApi
318
339
  value.to_i
319
340
  when :Float
320
341
  value.to_f
321
- when :BOOLEAN
342
+ when :Boolean
322
343
  if value.to_s =~ /\A(true|t|yes|y|1)\z/i
323
344
  true
324
345
  else
@@ -339,8 +360,7 @@ module AylienNewsApi
339
360
  end
340
361
  end
341
362
  else # model
342
- temp_model = AylienNewsApi.const_get(type).new
343
- temp_model.build_from_hash(value)
363
+ AylienNewsApi.const_get(type).build_from_hash(value)
344
364
  end
345
365
  end
346
366
 
@@ -374,7 +394,7 @@ module AylienNewsApi
374
394
  # @return [Hash] Returns the value in the form of hash
375
395
  def _to_hash(value)
376
396
  if value.is_a?(Array)
377
- value.compact.map{ |v| _to_hash(v) }
397
+ value.compact.map { |v| _to_hash(v) }
378
398
  elsif value.is_a?(Hash)
379
399
  {}.tap do |hash|
380
400
  value.each { |k, v| hash[k] = _to_hash(v) }
@@ -385,7 +405,5 @@ module AylienNewsApi
385
405
  value
386
406
  end
387
407
  end
388
-
389
408
  end
390
-
391
409
  end