aylien_news_api 0.2.0 → 0.3.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.
@@ -83,6 +83,15 @@ module AylienNewsApi
83
83
  # @return Array for valid properies with the reasons
84
84
  def list_invalid_properties
85
85
  invalid_properties = Array.new
86
+
87
+ if !@score.nil? && @score > 1.0
88
+ invalid_properties.push("invalid value for 'score', must be smaller than or equal to 1.0.")
89
+ end
90
+
91
+ if !@score.nil? && @score < 0.0
92
+ invalid_properties.push("invalid value for 'score', must be greater than or equal to 0.0.")
93
+ end
94
+
86
95
  return invalid_properties
87
96
  end
88
97
 
@@ -91,8 +100,8 @@ module AylienNewsApi
91
100
  def valid?
92
101
  polarity_validator = EnumAttributeValidator.new('String', ["positive", "neutral", "negative"])
93
102
  return false unless polarity_validator.valid?(@polarity)
94
- return false if @score > 1.0
95
- return false if @score < 0.0
103
+ return false if !@score.nil? && @score > 1.0
104
+ return false if !@score.nil? && @score < 0.0
96
105
  return true
97
106
  end
98
107
 
@@ -109,15 +118,12 @@ module AylienNewsApi
109
118
  # Custom attribute writer method with validation
110
119
  # @param [Object] score Value to be assigned
111
120
  def score=(score)
112
- if score.nil?
113
- fail ArgumentError, "score cannot be nil"
114
- end
115
121
 
116
- if score > 1.0
122
+ if !score.nil? && score > 1.0
117
123
  fail ArgumentError, "invalid value for 'score', must be smaller than or equal to 1.0."
118
124
  end
119
125
 
120
- if score < 0.0
126
+ if !score.nil? && score < 0.0
121
127
  fail ArgumentError, "invalid value for 'score', must be greater than or equal to 0.0."
122
128
  end
123
129
 
@@ -23,7 +23,19 @@ module AylienNewsApi
23
23
  # The source name
24
24
  attr_accessor :name
25
25
 
26
- # Domain name of the source which is extracted from the source URL
26
+ # The title of the home page URL
27
+ attr_accessor :title
28
+
29
+ # A general explanation about the source
30
+ attr_accessor :description
31
+
32
+ # The number of websites that link to the source
33
+ attr_accessor :links_in_count
34
+
35
+ # The home page URL of the source
36
+ attr_accessor :home_page_url
37
+
38
+ # The domain name of the source which is extracted from the source URL
27
39
  attr_accessor :domain
28
40
 
29
41
  # A URL which points to the source logo
@@ -32,19 +44,27 @@ module AylienNewsApi
32
44
  # The source locations which are tend to be the physical locations of the source, e.g. BBC headquarter is located in London.
33
45
  attr_accessor :locations
34
46
 
35
- # The source scopes which is tend to be scope locations of the source, e.g. BBC scopes is international.
47
+ # The source scopes which is tend to be scope locations of the source, e.g. BBC scopes is international.
36
48
  attr_accessor :scopes
37
49
 
50
+ # The web rankings of the source
51
+ attr_accessor :rankings
52
+
38
53
 
39
54
  # Attribute mapping from ruby-style variable name to JSON key.
40
55
  def self.attribute_map
41
56
  {
42
57
  :'id' => :'id',
43
58
  :'name' => :'name',
59
+ :'title' => :'title',
60
+ :'description' => :'description',
61
+ :'links_in_count' => :'links_in_count',
62
+ :'home_page_url' => :'home_page_url',
44
63
  :'domain' => :'domain',
45
64
  :'logo_url' => :'logo_url',
46
65
  :'locations' => :'locations',
47
- :'scopes' => :'scopes'
66
+ :'scopes' => :'scopes',
67
+ :'rankings' => :'rankings'
48
68
  }
49
69
  end
50
70
 
@@ -53,10 +73,15 @@ module AylienNewsApi
53
73
  {
54
74
  :'id' => :'Integer',
55
75
  :'name' => :'String',
76
+ :'title' => :'String',
77
+ :'description' => :'String',
78
+ :'links_in_count' => :'Integer',
79
+ :'home_page_url' => :'String',
56
80
  :'domain' => :'String',
57
81
  :'logo_url' => :'String',
58
82
  :'locations' => :'Array<Location>',
59
- :'scopes' => :'Array<Scope>'
83
+ :'scopes' => :'Array<Scope>',
84
+ :'rankings' => :'Rankings'
60
85
  }
61
86
  end
62
87
 
@@ -76,6 +101,22 @@ module AylienNewsApi
76
101
  self.name = attributes[:'name']
77
102
  end
78
103
 
104
+ if attributes.has_key?(:'title')
105
+ self.title = attributes[:'title']
106
+ end
107
+
108
+ if attributes.has_key?(:'description')
109
+ self.description = attributes[:'description']
110
+ end
111
+
112
+ if attributes.has_key?(:'links_in_count')
113
+ self.links_in_count = attributes[:'links_in_count']
114
+ end
115
+
116
+ if attributes.has_key?(:'home_page_url')
117
+ self.home_page_url = attributes[:'home_page_url']
118
+ end
119
+
79
120
  if attributes.has_key?(:'domain')
80
121
  self.domain = attributes[:'domain']
81
122
  end
@@ -96,6 +137,10 @@ module AylienNewsApi
96
137
  end
97
138
  end
98
139
 
140
+ if attributes.has_key?(:'rankings')
141
+ self.rankings = attributes[:'rankings']
142
+ end
143
+
99
144
  end
100
145
 
101
146
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -118,10 +163,15 @@ module AylienNewsApi
118
163
  self.class == o.class &&
119
164
  id == o.id &&
120
165
  name == o.name &&
166
+ title == o.title &&
167
+ description == o.description &&
168
+ links_in_count == o.links_in_count &&
169
+ home_page_url == o.home_page_url &&
121
170
  domain == o.domain &&
122
171
  logo_url == o.logo_url &&
123
172
  locations == o.locations &&
124
- scopes == o.scopes
173
+ scopes == o.scopes &&
174
+ rankings == o.rankings
125
175
  end
126
176
 
127
177
  # @see the `==` method
@@ -133,7 +183,7 @@ module AylienNewsApi
133
183
  # Calculates hash code according to all attributes.
134
184
  # @return [Fixnum] Hash code
135
185
  def hash
136
- [id, name, domain, logo_url, locations, scopes].hash
186
+ [id, name, title, description, links_in_count, home_page_url, domain, logo_url, locations, scopes, rankings].hash
137
187
  end
138
188
 
139
189
  # Builds the object from hash
@@ -13,5 +13,5 @@
13
13
  # limitations under the License.
14
14
 
15
15
  module AylienNewsApi
16
- VERSION = "0.2.0"
16
+ VERSION = "0.3.0"
17
17
  end
@@ -0,0 +1,54 @@
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.
14
+
15
+ require 'spec_helper'
16
+ require 'json'
17
+ require 'date'
18
+
19
+ # Unit tests for AylienNewsApi::Rank
20
+ describe 'Rank' do
21
+ before do
22
+ # run before each test
23
+ @instance = AylienNewsApi::Rank.new
24
+ end
25
+
26
+ after do
27
+ # run after each test
28
+ end
29
+
30
+ describe 'test an instance of Rank' do
31
+ it 'should create an instact of Rank' do
32
+ expect(@instance).to be_instance_of(AylienNewsApi::Rank)
33
+ end
34
+ end
35
+ describe 'test attribute "rank"' do
36
+ it 'should work' do
37
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
38
+ end
39
+ end
40
+
41
+ describe 'test attribute "country"' do
42
+ it 'should work' do
43
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
44
+ end
45
+ end
46
+
47
+ describe 'test attribute "fetched_at"' do
48
+ it 'should work' do
49
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
50
+ end
51
+ end
52
+
53
+ end
54
+
@@ -0,0 +1,42 @@
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.
14
+
15
+ require 'spec_helper'
16
+ require 'json'
17
+ require 'date'
18
+
19
+ # Unit tests for AylienNewsApi::Rankings
20
+ describe 'Rankings' do
21
+ before do
22
+ # run before each test
23
+ @instance = AylienNewsApi::Rankings.new
24
+ end
25
+
26
+ after do
27
+ # run after each test
28
+ end
29
+
30
+ describe 'test an instance of Rankings' do
31
+ it 'should create an instact of Rankings' do
32
+ expect(@instance).to be_instance_of(AylienNewsApi::Rankings)
33
+ end
34
+ end
35
+ describe 'test attribute "alexa"' do
36
+ it 'should work' do
37
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
38
+ end
39
+ end
40
+
41
+ end
42
+
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aylien_news_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - AYLIEN Inc.
8
- - Hamed Ramezanian Nik
8
+ - Hamed R. Nik
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-07-01 00:00:00.000000000 Z
12
+ date: 2016-08-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: typhoeus
@@ -204,6 +204,7 @@ files:
204
204
  - Gemfile.lock
205
205
  - LICENSE
206
206
  - README.md
207
+ - aylien_news_api-0.2.0.gem
207
208
  - aylien_news_api.gemspec
208
209
  - docs/Author.md
209
210
  - docs/Autocomplete.md
@@ -222,6 +223,8 @@ files:
222
223
  - docs/Histograms.md
223
224
  - docs/Location.md
224
225
  - docs/Media.md
226
+ - docs/Rank.md
227
+ - docs/Rankings.md
225
228
  - docs/RelatedStories.md
226
229
  - docs/Scope.md
227
230
  - docs/Sentiment.md
@@ -259,6 +262,8 @@ files:
259
262
  - lib/aylien_news_api/models/histograms.rb
260
263
  - lib/aylien_news_api/models/location.rb
261
264
  - lib/aylien_news_api/models/media.rb
265
+ - lib/aylien_news_api/models/rank.rb
266
+ - lib/aylien_news_api/models/rankings.rb
262
267
  - lib/aylien_news_api/models/related_stories.rb
263
268
  - lib/aylien_news_api/models/scope.rb
264
269
  - lib/aylien_news_api/models/sentiment.rb
@@ -295,6 +300,8 @@ files:
295
300
  - spec/models/histograms_spec.rb
296
301
  - spec/models/location_spec.rb
297
302
  - spec/models/media_spec.rb
303
+ - spec/models/rank_spec.rb
304
+ - spec/models/rankings_spec.rb
298
305
  - spec/models/related_stories_spec.rb
299
306
  - spec/models/scope_spec.rb
300
307
  - spec/models/sentiment_spec.rb
@@ -312,7 +319,7 @@ files:
312
319
  - spec/models/trend_spec.rb
313
320
  - spec/models/trends_spec.rb
314
321
  - spec/spec_helper.rb
315
- homepage: https://github.com/AYLIEN/aylien_newsapi_ruby
322
+ homepage: https://newsapi.aylien.com/
316
323
  licenses:
317
324
  - Apache-2.0
318
325
  metadata: {}
@@ -371,6 +378,8 @@ test_files:
371
378
  - spec/models/sentiments_spec.rb
372
379
  - spec/models/sentiment_spec.rb
373
380
  - spec/models/entity_links_spec.rb
381
+ - spec/models/rankings_spec.rb
382
+ - spec/models/rank_spec.rb
374
383
  - spec/models/category_spec.rb
375
384
  - spec/models/time_series_list_spec.rb
376
385
  - spec/spec_helper.rb