aylien_news_api 4.3.1 → 4.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (147) hide show
  1. checksums.yaml +4 -4
  2. data/aylien_news_api.gemspec +1 -1
  3. data/docs/Category.md +3 -3
  4. data/docs/CategoryLinks.md +2 -0
  5. data/docs/DefaultApi.md +200 -176
  6. data/docs/DeprecatedEntities.md +19 -0
  7. data/docs/DeprecatedEntity.md +33 -0
  8. data/docs/DeprecatedEntitySurfaceForm.md +21 -0
  9. data/docs/DeprecatedRelatedStories.md +27 -0
  10. data/docs/DeprecatedStories.md +25 -0
  11. data/docs/DeprecatedStory.md +65 -0
  12. data/docs/Entity.md +12 -10
  13. data/docs/EntityInText.md +19 -0
  14. data/docs/EntityMention.md +19 -0
  15. data/docs/EntityMentionIndex.md +19 -0
  16. data/docs/EntitySurfaceForm.md +4 -2
  17. data/docs/Story.md +1 -1
  18. data/lib/aylien_news_api/api/default_api.rb +225 -189
  19. data/lib/aylien_news_api/api_client.rb +1 -1
  20. data/lib/aylien_news_api/api_error.rb +1 -1
  21. data/lib/aylien_news_api/configuration.rb +1 -1
  22. data/lib/aylien_news_api/models/aggregated_sentiment.rb +1 -1
  23. data/lib/aylien_news_api/models/author.rb +1 -1
  24. data/lib/aylien_news_api/models/autocomplete.rb +1 -1
  25. data/lib/aylien_news_api/models/autocompletes.rb +1 -1
  26. data/lib/aylien_news_api/models/category.rb +17 -14
  27. data/lib/aylien_news_api/models/category_links.rb +16 -2
  28. data/lib/aylien_news_api/models/category_taxonomy.rb +2 -1
  29. data/lib/aylien_news_api/models/cluster.rb +1 -1
  30. data/lib/aylien_news_api/models/clusters.rb +1 -1
  31. data/lib/aylien_news_api/models/deprecated_entities.rb +221 -0
  32. data/lib/aylien_news_api/models/deprecated_entity.rb +314 -0
  33. data/lib/aylien_news_api/models/deprecated_entity_surface_form.rb +244 -0
  34. data/lib/aylien_news_api/models/deprecated_related_stories.rb +260 -0
  35. data/lib/aylien_news_api/models/deprecated_stories.rb +252 -0
  36. data/lib/aylien_news_api/models/deprecated_story.rb +451 -0
  37. data/lib/aylien_news_api/models/entity.rb +91 -45
  38. data/lib/aylien_news_api/models/entity_in_text.rb +217 -0
  39. data/lib/aylien_news_api/models/entity_links.rb +1 -1
  40. data/lib/aylien_news_api/models/entity_mention.rb +215 -0
  41. data/lib/aylien_news_api/models/entity_mention_index.rb +265 -0
  42. data/lib/aylien_news_api/models/entity_sentiment.rb +1 -1
  43. data/lib/aylien_news_api/models/entity_surface_form.rb +35 -10
  44. data/lib/aylien_news_api/models/error.rb +1 -1
  45. data/lib/aylien_news_api/models/error_links.rb +1 -1
  46. data/lib/aylien_news_api/models/errors.rb +1 -1
  47. data/lib/aylien_news_api/models/histogram_interval.rb +1 -1
  48. data/lib/aylien_news_api/models/histograms.rb +1 -1
  49. data/lib/aylien_news_api/models/location.rb +1 -1
  50. data/lib/aylien_news_api/models/logicals.rb +1 -1
  51. data/lib/aylien_news_api/models/media.rb +1 -1
  52. data/lib/aylien_news_api/models/media_format.rb +1 -1
  53. data/lib/aylien_news_api/models/media_type.rb +1 -1
  54. data/lib/aylien_news_api/models/nested_entity.rb +1 -1
  55. data/lib/aylien_news_api/models/parameter.rb +1 -1
  56. data/lib/aylien_news_api/models/query.rb +1 -1
  57. data/lib/aylien_news_api/models/rank.rb +1 -1
  58. data/lib/aylien_news_api/models/rankings.rb +1 -1
  59. data/lib/aylien_news_api/models/related_stories.rb +2 -1
  60. data/lib/aylien_news_api/models/representative_story.rb +1 -1
  61. data/lib/aylien_news_api/models/scope.rb +1 -1
  62. data/lib/aylien_news_api/models/scope_level.rb +1 -1
  63. data/lib/aylien_news_api/models/sentiment.rb +1 -1
  64. data/lib/aylien_news_api/models/sentiment_polarity.rb +1 -1
  65. data/lib/aylien_news_api/models/sentiments.rb +1 -1
  66. data/lib/aylien_news_api/models/share_count.rb +1 -1
  67. data/lib/aylien_news_api/models/share_counts.rb +1 -1
  68. data/lib/aylien_news_api/models/source.rb +1 -1
  69. data/lib/aylien_news_api/models/stories.rb +2 -1
  70. data/lib/aylien_news_api/models/story.rb +6 -3
  71. data/lib/aylien_news_api/models/story_cluster.rb +1 -1
  72. data/lib/aylien_news_api/models/story_links.rb +1 -1
  73. data/lib/aylien_news_api/models/story_translation.rb +1 -1
  74. data/lib/aylien_news_api/models/story_translations.rb +1 -1
  75. data/lib/aylien_news_api/models/summary.rb +1 -1
  76. data/lib/aylien_news_api/models/time_series.rb +1 -1
  77. data/lib/aylien_news_api/models/time_series_list.rb +1 -1
  78. data/lib/aylien_news_api/models/trend.rb +1 -1
  79. data/lib/aylien_news_api/models/trends.rb +1 -1
  80. data/lib/aylien_news_api/models/warning.rb +1 -1
  81. data/lib/aylien_news_api/version.rb +2 -2
  82. data/lib/aylien_news_api.rb +10 -5
  83. data/spec/api/default_api_spec.rb +143 -5
  84. data/spec/api_client_spec.rb +1 -1
  85. data/spec/configuration_spec.rb +1 -1
  86. data/spec/models/aggregated_sentiment_spec.rb +1 -1
  87. data/spec/models/author_spec.rb +1 -1
  88. data/spec/models/autocomplete_spec.rb +1 -1
  89. data/spec/models/autocompletes_spec.rb +1 -1
  90. data/spec/models/category_links_spec.rb +7 -1
  91. data/spec/models/category_spec.rb +4 -4
  92. data/spec/models/category_taxonomy_spec.rb +1 -1
  93. data/spec/models/cluster_spec.rb +1 -1
  94. data/spec/models/clusters_spec.rb +1 -1
  95. data/spec/models/deprecated_entities_spec.rb +47 -0
  96. data/spec/models/deprecated_entity_spec.rb +89 -0
  97. data/spec/models/deprecated_entity_surface_form_spec.rb +53 -0
  98. data/spec/models/deprecated_related_stories_spec.rb +71 -0
  99. data/spec/models/deprecated_stories_spec.rb +65 -0
  100. data/spec/models/deprecated_story_spec.rb +185 -0
  101. data/spec/models/entity_in_text_spec.rb +47 -0
  102. data/spec/models/entity_links_spec.rb +7 -1
  103. data/spec/models/entity_mention_index_spec.rb +47 -0
  104. data/spec/models/entity_mention_spec.rb +47 -0
  105. data/spec/models/entity_sentiment_spec.rb +1 -1
  106. data/spec/models/entity_spec.rb +24 -6
  107. data/spec/models/entity_surface_form_spec.rb +8 -2
  108. data/spec/models/error_links_spec.rb +1 -1
  109. data/spec/models/error_spec.rb +1 -1
  110. data/spec/models/errors_spec.rb +1 -1
  111. data/spec/models/histogram_interval_spec.rb +1 -1
  112. data/spec/models/histograms_spec.rb +1 -1
  113. data/spec/models/location_spec.rb +1 -1
  114. data/spec/models/logicals_spec.rb +1 -1
  115. data/spec/models/media_format_spec.rb +1 -1
  116. data/spec/models/media_spec.rb +1 -1
  117. data/spec/models/media_type_spec.rb +1 -1
  118. data/spec/models/nested_entity_spec.rb +20 -2
  119. data/spec/models/parameter_spec.rb +1 -1
  120. data/spec/models/query_spec.rb +1 -1
  121. data/spec/models/rank_spec.rb +1 -1
  122. data/spec/models/rankings_spec.rb +1 -1
  123. data/spec/models/related_stories_spec.rb +1 -1
  124. data/spec/models/representative_story_spec.rb +1 -1
  125. data/spec/models/scope_level_spec.rb +1 -1
  126. data/spec/models/scope_spec.rb +1 -1
  127. data/spec/models/sentiment_polarity_spec.rb +1 -1
  128. data/spec/models/sentiment_spec.rb +1 -1
  129. data/spec/models/sentiments_spec.rb +1 -1
  130. data/spec/models/share_count_spec.rb +1 -1
  131. data/spec/models/share_counts_spec.rb +1 -1
  132. data/spec/models/source_spec.rb +1 -1
  133. data/spec/models/stories_spec.rb +1 -1
  134. data/spec/models/story_cluster_spec.rb +1 -1
  135. data/spec/models/story_links_spec.rb +1 -1
  136. data/spec/models/story_spec.rb +7 -1
  137. data/spec/models/story_translation_spec.rb +1 -1
  138. data/spec/models/story_translations_spec.rb +1 -1
  139. data/spec/models/summary_spec.rb +1 -1
  140. data/spec/models/time_series_list_spec.rb +1 -1
  141. data/spec/models/time_series_spec.rb +7 -1
  142. data/spec/models/trend_spec.rb +7 -1
  143. data/spec/models/trends_spec.rb +1 -1
  144. data/spec/models/warning_spec.rb +1 -1
  145. data/spec/spec_helper.rb +1 -1
  146. metadata +38 -3
  147. data/aylien_news_api-4.3.0.gem +0 -0
@@ -0,0 +1,217 @@
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: 4.7
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 EntityInText
17
+ attr_accessor :sentiment
18
+
19
+ attr_accessor :surface_forms
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'sentiment' => :'sentiment',
25
+ :'surface_forms' => :'surface_forms'
26
+ }
27
+ end
28
+
29
+ # Attribute type mapping.
30
+ def self.openapi_types
31
+ {
32
+ :'sentiment' => :'EntitySentiment',
33
+ :'surface_forms' => :'Array<EntitySurfaceForm>'
34
+ }
35
+ end
36
+
37
+ # List of attributes with nullable: true
38
+ def self.openapi_nullable
39
+ Set.new([
40
+ ])
41
+ end
42
+
43
+ # Initializes the object
44
+ # @param [Hash] attributes Model attributes in the form of hash
45
+ def initialize(attributes = {})
46
+ if (!attributes.is_a?(Hash))
47
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::EntityInText` initialize method"
48
+ end
49
+
50
+ # check to see if the attribute exists and convert string to symbol for hash key
51
+ attributes = attributes.each_with_object({}) { |(k, v), h|
52
+ if (!self.class.attribute_map.key?(k.to_sym))
53
+ fail ArgumentError, "`#{k}` is not a valid attribute in `AylienNewsApi::EntityInText`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
54
+ end
55
+ h[k.to_sym] = v
56
+ }
57
+
58
+ if attributes.key?(:'sentiment')
59
+ self.sentiment = attributes[:'sentiment']
60
+ end
61
+
62
+ if attributes.key?(:'surface_forms')
63
+ if (value = attributes[:'surface_forms']).is_a?(Array)
64
+ self.surface_forms = value
65
+ end
66
+ end
67
+ end
68
+
69
+ # Show invalid properties with the reasons. Usually used together with valid?
70
+ # @return Array for valid properties with the reasons
71
+ def list_invalid_properties
72
+ invalid_properties = Array.new
73
+ invalid_properties
74
+ end
75
+
76
+ # Check to see if the all the properties in the model are valid
77
+ # @return true if the model is valid
78
+ def valid?
79
+ true
80
+ end
81
+
82
+ # Checks equality by comparing each attribute.
83
+ # @param [Object] Object to be compared
84
+ def ==(o)
85
+ return true if self.equal?(o)
86
+ self.class == o.class &&
87
+ sentiment == o.sentiment &&
88
+ surface_forms == o.surface_forms
89
+ end
90
+
91
+ # @see the `==` method
92
+ # @param [Object] Object to be compared
93
+ def eql?(o)
94
+ self == o
95
+ end
96
+
97
+ # Calculates hash code according to all attributes.
98
+ # @return [Integer] Hash code
99
+ def hash
100
+ [sentiment, surface_forms].hash
101
+ end
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
+
110
+ # Builds the object from hash
111
+ # @param [Hash] attributes Model attributes in the form of hash
112
+ # @return [Object] Returns the model itself
113
+ def build_from_hash(attributes)
114
+ return nil unless attributes.is_a?(Hash)
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
118
+ # is documented as an array but the input is not
119
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
120
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
121
+ end
122
+ elsif !attributes[self.class.attribute_map[key]].nil?
123
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
124
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
125
+ end
126
+
127
+ self
128
+ end
129
+
130
+ # Deserializes the data based on type
131
+ # @param string type Data type
132
+ # @param string value Value to be deserialized
133
+ # @return [Object] Deserialized data
134
+ def _deserialize(type, value)
135
+ case type.to_sym
136
+ when :DateTime
137
+ DateTime.parse(value)
138
+ when :Date
139
+ Date.parse(value)
140
+ when :String
141
+ value.to_s
142
+ when :Integer
143
+ value.to_i
144
+ when :Float
145
+ value.to_f
146
+ when :Boolean
147
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
148
+ true
149
+ else
150
+ false
151
+ end
152
+ when :Object
153
+ # generic object (usually a Hash), return directly
154
+ value
155
+ when /\AArray<(?<inner_type>.+)>\z/
156
+ inner_type = Regexp.last_match[:inner_type]
157
+ value.map { |v| _deserialize(inner_type, v) }
158
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
159
+ k_type = Regexp.last_match[:k_type]
160
+ v_type = Regexp.last_match[:v_type]
161
+ {}.tap do |hash|
162
+ value.each do |k, v|
163
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
164
+ end
165
+ end
166
+ else # model
167
+ AylienNewsApi.const_get(type).build_from_hash(value)
168
+ end
169
+ end
170
+
171
+ # Returns the string representation of the object
172
+ # @return [String] String presentation of the object
173
+ def to_s
174
+ to_hash.to_s
175
+ end
176
+
177
+ # to_body is an alias to to_hash (backward compatibility)
178
+ # @return [Hash] Returns the object in the form of hash
179
+ def to_body
180
+ to_hash
181
+ end
182
+
183
+ # Returns the object in the form of hash
184
+ # @return [Hash] Returns the object in the form of hash
185
+ def to_hash
186
+ hash = {}
187
+ self.class.attribute_map.each_pair do |attr, param|
188
+ value = self.send(attr)
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
+
194
+ hash[param] = _to_hash(value)
195
+ end
196
+ hash
197
+ end
198
+
199
+ # Outputs non-array value in the form of hash
200
+ # For object, use to_hash. Otherwise, just return the value
201
+ # @param [Object] value Any valid value
202
+ # @return [Hash] Returns the value in the form of hash
203
+ def _to_hash(value)
204
+ if value.is_a?(Array)
205
+ value.compact.map { |v| _to_hash(v) }
206
+ elsif value.is_a?(Hash)
207
+ {}.tap do |hash|
208
+ value.each { |k, v| hash[k] = _to_hash(v) }
209
+ end
210
+ elsif value.respond_to? :to_hash
211
+ value.to_hash
212
+ else
213
+ value
214
+ end
215
+ end
216
+ end
217
+ end
@@ -3,7 +3,7 @@
3
3
 
4
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
5
 
6
- The version of the OpenAPI document: 3.0
6
+ The version of the OpenAPI document: 4.7
7
7
  Contact: support@aylien.com
8
8
  Generated by: https://openapi-generator.tech
9
9
  OpenAPI Generator version: 5.0.0-SNAPSHOT
@@ -0,0 +1,215 @@
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: 4.7
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 EntityMention
17
+ attr_accessor :index
18
+
19
+ attr_accessor :sentiment
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'index' => :'index',
25
+ :'sentiment' => :'sentiment'
26
+ }
27
+ end
28
+
29
+ # Attribute type mapping.
30
+ def self.openapi_types
31
+ {
32
+ :'index' => :'EntityMentionIndex',
33
+ :'sentiment' => :'EntitySentiment'
34
+ }
35
+ end
36
+
37
+ # List of attributes with nullable: true
38
+ def self.openapi_nullable
39
+ Set.new([
40
+ ])
41
+ end
42
+
43
+ # Initializes the object
44
+ # @param [Hash] attributes Model attributes in the form of hash
45
+ def initialize(attributes = {})
46
+ if (!attributes.is_a?(Hash))
47
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::EntityMention` initialize method"
48
+ end
49
+
50
+ # check to see if the attribute exists and convert string to symbol for hash key
51
+ attributes = attributes.each_with_object({}) { |(k, v), h|
52
+ if (!self.class.attribute_map.key?(k.to_sym))
53
+ fail ArgumentError, "`#{k}` is not a valid attribute in `AylienNewsApi::EntityMention`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
54
+ end
55
+ h[k.to_sym] = v
56
+ }
57
+
58
+ if attributes.key?(:'index')
59
+ self.index = attributes[:'index']
60
+ end
61
+
62
+ if attributes.key?(:'sentiment')
63
+ self.sentiment = attributes[:'sentiment']
64
+ end
65
+ end
66
+
67
+ # Show invalid properties with the reasons. Usually used together with valid?
68
+ # @return Array for valid properties with the reasons
69
+ def list_invalid_properties
70
+ invalid_properties = Array.new
71
+ invalid_properties
72
+ end
73
+
74
+ # Check to see if the all the properties in the model are valid
75
+ # @return true if the model is valid
76
+ def valid?
77
+ true
78
+ end
79
+
80
+ # Checks equality by comparing each attribute.
81
+ # @param [Object] Object to be compared
82
+ def ==(o)
83
+ return true if self.equal?(o)
84
+ self.class == o.class &&
85
+ index == o.index &&
86
+ sentiment == o.sentiment
87
+ end
88
+
89
+ # @see the `==` method
90
+ # @param [Object] Object to be compared
91
+ def eql?(o)
92
+ self == o
93
+ end
94
+
95
+ # Calculates hash code according to all attributes.
96
+ # @return [Integer] Hash code
97
+ def hash
98
+ [index, sentiment].hash
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 self.build_from_hash(attributes)
105
+ new.build_from_hash(attributes)
106
+ end
107
+
108
+ # Builds the object from hash
109
+ # @param [Hash] attributes Model attributes in the form of hash
110
+ # @return [Object] Returns the model itself
111
+ def build_from_hash(attributes)
112
+ return nil unless attributes.is_a?(Hash)
113
+ self.class.openapi_types.each_pair do |key, type|
114
+ if type =~ /\AArray<(.*)>/i
115
+ # check to ensure the input is an array given that the attribute
116
+ # is documented as an array but the input is not
117
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
118
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
119
+ end
120
+ elsif !attributes[self.class.attribute_map[key]].nil?
121
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
122
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
123
+ end
124
+
125
+ self
126
+ end
127
+
128
+ # Deserializes the data based on type
129
+ # @param string type Data type
130
+ # @param string value Value to be deserialized
131
+ # @return [Object] Deserialized data
132
+ def _deserialize(type, value)
133
+ case type.to_sym
134
+ when :DateTime
135
+ DateTime.parse(value)
136
+ when :Date
137
+ Date.parse(value)
138
+ when :String
139
+ value.to_s
140
+ when :Integer
141
+ value.to_i
142
+ when :Float
143
+ value.to_f
144
+ when :Boolean
145
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
146
+ true
147
+ else
148
+ false
149
+ end
150
+ when :Object
151
+ # generic object (usually a Hash), return directly
152
+ value
153
+ when /\AArray<(?<inner_type>.+)>\z/
154
+ inner_type = Regexp.last_match[:inner_type]
155
+ value.map { |v| _deserialize(inner_type, v) }
156
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
157
+ k_type = Regexp.last_match[:k_type]
158
+ v_type = Regexp.last_match[:v_type]
159
+ {}.tap do |hash|
160
+ value.each do |k, v|
161
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
162
+ end
163
+ end
164
+ else # model
165
+ AylienNewsApi.const_get(type).build_from_hash(value)
166
+ end
167
+ end
168
+
169
+ # Returns the string representation of the object
170
+ # @return [String] String presentation of the object
171
+ def to_s
172
+ to_hash.to_s
173
+ end
174
+
175
+ # to_body is an alias to to_hash (backward compatibility)
176
+ # @return [Hash] Returns the object in the form of hash
177
+ def to_body
178
+ to_hash
179
+ end
180
+
181
+ # Returns the object in the form of hash
182
+ # @return [Hash] Returns the object in the form of hash
183
+ def to_hash
184
+ hash = {}
185
+ self.class.attribute_map.each_pair do |attr, param|
186
+ value = self.send(attr)
187
+ if value.nil?
188
+ is_nullable = self.class.openapi_nullable.include?(attr)
189
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
190
+ end
191
+
192
+ hash[param] = _to_hash(value)
193
+ end
194
+ hash
195
+ end
196
+
197
+ # Outputs non-array value in the form of hash
198
+ # For object, use to_hash. Otherwise, just return the value
199
+ # @param [Object] value Any valid value
200
+ # @return [Hash] Returns the value in the form of hash
201
+ def _to_hash(value)
202
+ if value.is_a?(Array)
203
+ value.compact.map { |v| _to_hash(v) }
204
+ elsif value.is_a?(Hash)
205
+ {}.tap do |hash|
206
+ value.each { |k, v| hash[k] = _to_hash(v) }
207
+ end
208
+ elsif value.respond_to? :to_hash
209
+ value.to_hash
210
+ else
211
+ value
212
+ end
213
+ end
214
+ end
215
+ end
@@ -0,0 +1,265 @@
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: 4.7
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 EntityMentionIndex
17
+ # Start index of a single entity mention in the text (counting from 0)
18
+ attr_accessor :start
19
+
20
+ # End index of a single entity mention in the text (counting from 0)
21
+ attr_accessor :_end
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'start' => :'start',
27
+ :'_end' => :'end'
28
+ }
29
+ end
30
+
31
+ # Attribute type mapping.
32
+ def self.openapi_types
33
+ {
34
+ :'start' => :'Integer',
35
+ :'_end' => :'Integer'
36
+ }
37
+ end
38
+
39
+ # List of attributes with nullable: true
40
+ def self.openapi_nullable
41
+ Set.new([
42
+ ])
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ if (!attributes.is_a?(Hash))
49
+ fail ArgumentError, "The input argument (attributes) must be a hash in `AylienNewsApi::EntityMentionIndex` initialize method"
50
+ end
51
+
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::EntityMentionIndex`. 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
+ }
59
+
60
+ if attributes.key?(:'start')
61
+ self.start = attributes[:'start']
62
+ end
63
+
64
+ if attributes.key?(:'_end')
65
+ self._end = attributes[:'_end']
66
+ end
67
+ end
68
+
69
+ # Show invalid properties with the reasons. Usually used together with valid?
70
+ # @return Array for valid properties with the reasons
71
+ def list_invalid_properties
72
+ invalid_properties = Array.new
73
+ if @start.nil?
74
+ invalid_properties.push('invalid value for "start", start cannot be nil.')
75
+ end
76
+
77
+ if @start < 0
78
+ invalid_properties.push('invalid value for "start", must be greater than or equal to 0.')
79
+ end
80
+
81
+ if @_end.nil?
82
+ invalid_properties.push('invalid value for "_end", _end cannot be nil.')
83
+ end
84
+
85
+ if @_end < 1
86
+ invalid_properties.push('invalid value for "_end", must be greater than or equal to 1.')
87
+ end
88
+
89
+ invalid_properties
90
+ end
91
+
92
+ # Check to see if the all the properties in the model are valid
93
+ # @return true if the model is valid
94
+ def valid?
95
+ return false if @start.nil?
96
+ return false if @start < 0
97
+ return false if @_end.nil?
98
+ return false if @_end < 1
99
+ true
100
+ end
101
+
102
+ # Custom attribute writer method with validation
103
+ # @param [Object] start Value to be assigned
104
+ def start=(start)
105
+ if start.nil?
106
+ fail ArgumentError, 'start cannot be nil'
107
+ end
108
+
109
+ if start < 0
110
+ fail ArgumentError, 'invalid value for "start", must be greater than or equal to 0.'
111
+ end
112
+
113
+ @start = start
114
+ end
115
+
116
+ # Custom attribute writer method with validation
117
+ # @param [Object] _end Value to be assigned
118
+ def _end=(_end)
119
+ if _end.nil?
120
+ fail ArgumentError, '_end cannot be nil'
121
+ end
122
+
123
+ if _end < 1
124
+ fail ArgumentError, 'invalid value for "_end", must be greater than or equal to 1.'
125
+ end
126
+
127
+ @_end = _end
128
+ end
129
+
130
+ # Checks equality by comparing each attribute.
131
+ # @param [Object] Object to be compared
132
+ def ==(o)
133
+ return true if self.equal?(o)
134
+ self.class == o.class &&
135
+ start == o.start &&
136
+ _end == o._end
137
+ end
138
+
139
+ # @see the `==` method
140
+ # @param [Object] Object to be compared
141
+ def eql?(o)
142
+ self == o
143
+ end
144
+
145
+ # Calculates hash code according to all attributes.
146
+ # @return [Integer] Hash code
147
+ def hash
148
+ [start, _end].hash
149
+ end
150
+
151
+ # Builds the object from hash
152
+ # @param [Hash] attributes Model attributes in the form of hash
153
+ # @return [Object] Returns the model itself
154
+ def self.build_from_hash(attributes)
155
+ new.build_from_hash(attributes)
156
+ end
157
+
158
+ # Builds the object from hash
159
+ # @param [Hash] attributes Model attributes in the form of hash
160
+ # @return [Object] Returns the model itself
161
+ def build_from_hash(attributes)
162
+ return nil unless attributes.is_a?(Hash)
163
+ self.class.openapi_types.each_pair do |key, type|
164
+ if type =~ /\AArray<(.*)>/i
165
+ # check to ensure the input is an array given that the attribute
166
+ # is documented as an array but the input is not
167
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
168
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
169
+ end
170
+ elsif !attributes[self.class.attribute_map[key]].nil?
171
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
172
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
173
+ end
174
+
175
+ self
176
+ end
177
+
178
+ # Deserializes the data based on type
179
+ # @param string type Data type
180
+ # @param string value Value to be deserialized
181
+ # @return [Object] Deserialized data
182
+ def _deserialize(type, value)
183
+ case type.to_sym
184
+ when :DateTime
185
+ DateTime.parse(value)
186
+ when :Date
187
+ Date.parse(value)
188
+ when :String
189
+ value.to_s
190
+ when :Integer
191
+ value.to_i
192
+ when :Float
193
+ value.to_f
194
+ when :Boolean
195
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
196
+ true
197
+ else
198
+ false
199
+ end
200
+ when :Object
201
+ # generic object (usually a Hash), return directly
202
+ value
203
+ when /\AArray<(?<inner_type>.+)>\z/
204
+ inner_type = Regexp.last_match[:inner_type]
205
+ value.map { |v| _deserialize(inner_type, v) }
206
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
207
+ k_type = Regexp.last_match[:k_type]
208
+ v_type = Regexp.last_match[:v_type]
209
+ {}.tap do |hash|
210
+ value.each do |k, v|
211
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
212
+ end
213
+ end
214
+ else # model
215
+ AylienNewsApi.const_get(type).build_from_hash(value)
216
+ end
217
+ end
218
+
219
+ # Returns the string representation of the object
220
+ # @return [String] String presentation of the object
221
+ def to_s
222
+ to_hash.to_s
223
+ end
224
+
225
+ # to_body is an alias to to_hash (backward compatibility)
226
+ # @return [Hash] Returns the object in the form of hash
227
+ def to_body
228
+ to_hash
229
+ end
230
+
231
+ # Returns the object in the form of hash
232
+ # @return [Hash] Returns the object in the form of hash
233
+ def to_hash
234
+ hash = {}
235
+ self.class.attribute_map.each_pair do |attr, param|
236
+ value = self.send(attr)
237
+ if value.nil?
238
+ is_nullable = self.class.openapi_nullable.include?(attr)
239
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
240
+ end
241
+
242
+ hash[param] = _to_hash(value)
243
+ end
244
+ hash
245
+ end
246
+
247
+ # Outputs non-array value in the form of hash
248
+ # For object, use to_hash. Otherwise, just return the value
249
+ # @param [Object] value Any valid value
250
+ # @return [Hash] Returns the value in the form of hash
251
+ def _to_hash(value)
252
+ if value.is_a?(Array)
253
+ value.compact.map { |v| _to_hash(v) }
254
+ elsif value.is_a?(Hash)
255
+ {}.tap do |hash|
256
+ value.each { |k, v| hash[k] = _to_hash(v) }
257
+ end
258
+ elsif value.respond_to? :to_hash
259
+ value.to_hash
260
+ else
261
+ value
262
+ end
263
+ end
264
+ end
265
+ end