feedly_api 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +18 -10
- data/README.md +8 -21
- data/feedly_api.gemspec +1 -1
- data/lib/feedly_api.rb +1 -1
- data/lib/feedly_api/client.rb +1 -2
- data/lib/feedly_api/feed.rb +20 -9
- data/lib/feedly_api/version.rb +1 -1
- data/spec/lib/feedly_api/client_spec.rb +14 -0
- data/spec/lib/feedly_api/feed_spec.rb +11 -29
- data/spec/lib/feedly_api_spec.rb +12 -20
- metadata +17 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b7519c1e6112dda9cd35da6fd2951dda5c047ba
|
4
|
+
data.tar.gz: e3c7d15e7057f90ed01186acb927a8e8d3f40da0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57e4764514164564323c3b53f75d26debf5fb921485c678860c2832d48cd657fcc5c4d66cc074216b90384c9914be1e5a5a20c03d438a9b6773aaa520a073a64
|
7
|
+
data.tar.gz: b21d6794aa1ae065de8d2c10dc472dbdafe24181c916b792ad23b39990c287a1b8efdf58d96056c265951839509b22146f92b3193503b55d0af58a275ac7ae87
|
data/LICENSE
CHANGED
@@ -1,13 +1,21 @@
|
|
1
|
-
|
1
|
+
The MIT License (MIT)
|
2
2
|
|
3
|
-
|
4
|
-
you may not use this file except in compliance with the License.
|
5
|
-
You may obtain a copy of the License at
|
3
|
+
Copyright (c) 2014 Myuzu
|
6
4
|
|
7
|
-
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
8
11
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -12,27 +12,14 @@ Early unofficial Feedly API with no external dependencies
|
|
12
12
|
## Usage
|
13
13
|
|
14
14
|
```ruby
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
client.get_feed_contents 'feed/https://www.eff.org/rss/updates.xml'
|
24
|
-
=> {:direction=>"ltr",
|
25
|
-
:continuation=>"13fa6b1134b:1a10f:eacbe387",
|
26
|
-
:alternate=>
|
27
|
-
[{:href=>"https://www.eff.org/rss/updates.xml", :type=>"text/html"}],
|
28
|
-
:id=>"feed/https://www.eff.org/rss/updates.xml",
|
29
|
-
:updated=>1373935361457,
|
30
|
-
:title=>"Deeplinks",
|
31
|
-
:items=>
|
32
|
-
[{:id=>
|
33
|
-
# ...
|
34
|
-
client.get_feed_contents('feed/https://www.eff.org/rss/updates.xml', count: 1).size
|
35
|
-
=> 1
|
15
|
+
# Create client for API requests; OAuth token optional
|
16
|
+
@client = FeedlyApi::Client.new
|
17
|
+
# Create Feed object for specific feed id
|
18
|
+
@feed = @client.feed('feed/https://www.eff.org/rss/updates.xml')
|
19
|
+
# Get array of feed items hashes
|
20
|
+
@feed.items
|
21
|
+
# Pass params to get more or less items
|
22
|
+
@feed.items(count: 50)
|
36
23
|
```
|
37
24
|
|
38
25
|
## Supported Ruby Versions
|
data/feedly_api.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.homepage = 'https://github.com/Myuzu/feedly_api'
|
10
10
|
s.summary = %q{Ruby wrapper for Feedly API}
|
11
11
|
s.description = %q{Simpe unofficial Feedly API wrapper. No auth yet.}
|
12
|
-
s.license = '
|
12
|
+
s.license = 'MIT License'
|
13
13
|
|
14
14
|
s.files = `git ls-files`.split("\n")
|
15
15
|
s.require_paths = ['lib']
|
data/lib/feedly_api.rb
CHANGED
data/lib/feedly_api/client.rb
CHANGED
data/lib/feedly_api/feed.rb
CHANGED
@@ -4,18 +4,29 @@ module FeedlyApi
|
|
4
4
|
:subscribers,
|
5
5
|
:title,
|
6
6
|
:velocity,
|
7
|
-
:id
|
7
|
+
:id,
|
8
|
+
:client
|
8
9
|
|
9
|
-
def initialize(
|
10
|
-
@
|
11
|
-
@
|
12
|
-
|
13
|
-
|
14
|
-
|
10
|
+
def initialize(client = Client.new, feed_id)
|
11
|
+
@client = client
|
12
|
+
@id = feed_id
|
13
|
+
|
14
|
+
fetch_feed_info
|
15
|
+
end
|
16
|
+
|
17
|
+
def items(args = {})
|
18
|
+
@client.get_feed_contents(@id, args).fetch(:items) {[]}
|
15
19
|
end
|
16
20
|
|
17
|
-
|
18
|
-
|
21
|
+
private
|
22
|
+
|
23
|
+
def fetch_feed_info
|
24
|
+
data = @client.get_feed_info(@id)
|
25
|
+
|
26
|
+
@website = data.fetch(:website) { nil }
|
27
|
+
@subscribers = data.fetch(:subscribers) { nil }
|
28
|
+
@title = data.fetch(:title) { nil }
|
29
|
+
@velocity = data.fetch(:velocity) { nil }
|
19
30
|
end
|
20
31
|
end
|
21
32
|
end
|
data/lib/feedly_api/version.rb
CHANGED
@@ -1,4 +1,18 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe FeedlyApi::Client do
|
4
|
+
let(:auth_token) { ENV['FEEDLY_TOKEN'] || 'GREATE_AUTH_TOKEN' }
|
5
|
+
let(:user_id) { ENV['FEEDLY_USER_ID'] || '00000000-000-NOT-VALID-a29b6679bb3c' }
|
6
|
+
let(:client) { FeedlyApi::Client.new(auth_token) }
|
7
|
+
let(:feed_data) { {website: 'https://www.eff.org/rss/updates.xml', subscribers: 2443,
|
8
|
+
title: 'Deeplinks', velocity: 15.2,
|
9
|
+
id: 'feed/https://www.eff.org/rss/updates.xml' }
|
10
|
+
}
|
11
|
+
|
12
|
+
describe '#feed' do
|
13
|
+
it 'returns Feed object with given feed_id' do
|
14
|
+
feed = client.feed(feed_data[:id])
|
15
|
+
expect(feed.id).to eq feed_data[:id]
|
16
|
+
end
|
17
|
+
end
|
4
18
|
end
|
@@ -1,41 +1,23 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe FeedlyApi::Feed do
|
4
|
-
|
5
|
-
title: 'Deeplinks', velocity: 15.2,
|
6
|
-
id: 'feed/https://www.eff.org/rss/updates.xml' }
|
7
|
-
}
|
8
|
-
let(:feed) { FeedlyApi::Feed.new(feed_data) }
|
4
|
+
DEFAULT_ITEMS_SIZE = 20
|
9
5
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
it 'stores subscribers' do
|
16
|
-
expect(feed.subscribers).to eq 2443
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'stores title' do
|
20
|
-
expect(feed.title).to eq 'Deeplinks'
|
21
|
-
end
|
6
|
+
let(:auth_token) { ENV['FEEDLY_TOKEN'] || 'GREATE_AUTH_TOKEN' }
|
7
|
+
let(:user_id) { ENV['FEEDLY_USER_ID'] || '00000000-000-NOT-VALID-a29b6679bb3c' }
|
8
|
+
let(:feed_id) { 'feed/https://www.eff.org/rss/updates.xml' }
|
9
|
+
let(:feed) { FeedlyApi::Client.new(auth_token).feed(feed_id) }
|
22
10
|
|
23
|
-
|
24
|
-
|
11
|
+
describe '#items' do
|
12
|
+
it 'returns feed items' do
|
13
|
+
expect(feed.items.size).to eq DEFAULT_ITEMS_SIZE
|
25
14
|
end
|
26
15
|
|
27
|
-
it '
|
28
|
-
|
16
|
+
it 'returns certain amount of feed items' do
|
17
|
+
items = feed.items(count: 2)
|
18
|
+
expect(items.size).to eq 2
|
29
19
|
end
|
30
|
-
end
|
31
|
-
|
32
|
-
describe '#items' do
|
33
|
-
it 'returns feed items'
|
34
|
-
# it 'returns feed items' do
|
35
|
-
# expect(feed.items.size).to eq 20
|
36
|
-
# end
|
37
20
|
|
38
|
-
it 'returns certain amount of feed items'
|
39
21
|
it 'returns feed items in certain order'
|
40
22
|
end
|
41
23
|
end
|
data/spec/lib/feedly_api_spec.rb
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe FeedlyApi::Client do
|
4
|
-
|
5
|
-
let(:auth_token) { ENV['FEEDLY_TOKEN'] || 'GREATE_AUTH_TOKEN' }
|
4
|
+
let(:auth_token) { ENV['FEEDLY_TOKEN'] || 'GREATE_AUTH_TOKEN' }
|
6
5
|
let(:user_id) { ENV['FEEDLY_USER_ID'] || '00000000-000-NOT-VALID-a29b6679bb3c' }
|
7
6
|
let(:client) { FeedlyApi::Client.new auth_token }
|
8
7
|
|
9
8
|
describe '#new' do
|
10
9
|
before :each do
|
11
|
-
FeedlyApi.stub(:get).and_return(File.read(File.join('spec', 'fixtures', 'profile.json')))
|
10
|
+
FeedlyApi.stub(:get).and_return(File.read(File.join('spec', 'fixtures', 'profile.json')))
|
12
11
|
end
|
13
12
|
|
14
13
|
it 'creates Client object with given token' do
|
@@ -17,21 +16,21 @@ describe FeedlyApi::Client do
|
|
17
16
|
end
|
18
17
|
|
19
18
|
it 'saves user_id' do
|
20
|
-
expect(client.user_id).to eq
|
19
|
+
expect(client.user_id).to eq user_id
|
21
20
|
end
|
22
21
|
end
|
23
22
|
|
24
23
|
describe '#get_user_profile' do
|
25
24
|
# rewrite for more accurancy
|
26
25
|
it 'returns user info' do
|
27
|
-
FeedlyApi.stub(:get).and_return(File.read(File.join('spec', 'fixtures', 'profile.json')))
|
26
|
+
FeedlyApi.stub(:get).and_return(File.read(File.join('spec', 'fixtures', 'profile.json')))
|
28
27
|
expect(client.get_user_profile[:client]).to eq 'feedly'
|
29
28
|
end
|
30
29
|
end
|
31
30
|
|
32
31
|
describe '#get_feed_info' do
|
33
32
|
it 'retrievs basic feed info' do
|
34
|
-
FeedlyApi.stub(:get).and_return(File.read(File.join('spec', 'fixtures', 'feed_info.json')))
|
33
|
+
FeedlyApi.stub(:get).and_return(File.read(File.join('spec', 'fixtures', 'feed_info.json')))
|
35
34
|
feed_info = client.get_feed_info('feed/https://www.eff.org/rss/updates.xml')
|
36
35
|
expect(feed_info[:website]).to eq 'https://www.eff.org/rss/updates.xml'
|
37
36
|
end
|
@@ -39,20 +38,20 @@ describe FeedlyApi::Client do
|
|
39
38
|
|
40
39
|
describe '#get_subscriptions' do
|
41
40
|
it 'retrievs user subscriptions' do
|
42
|
-
FeedlyApi.stub(:get).and_return(File.read(File.join('spec', 'fixtures', 'subscriptions.json')))
|
41
|
+
FeedlyApi.stub(:get).and_return(File.read(File.join('spec', 'fixtures', 'subscriptions.json')))
|
43
42
|
expect(client.get_subscriptions.size).to eq 3
|
44
43
|
end
|
45
44
|
end
|
46
45
|
|
47
46
|
describe '#get_feed_contents' do
|
48
47
|
it 'retrievs feed contents' do
|
49
|
-
FeedlyApi.stub(:get).and_return(File.read(File.join('spec', 'fixtures', 'feed_contents_20.json')))
|
48
|
+
FeedlyApi.stub(:get).and_return(File.read(File.join('spec', 'fixtures', 'feed_contents_20.json')))
|
50
49
|
feed_contents = client.get_feed_contents('feed/https://www.eff.org/rss/updates.xml')
|
51
50
|
expect(feed_contents[:items].size).to eq 20
|
52
51
|
end
|
53
52
|
|
54
53
|
it 'retrievs custom number of feed items' do
|
55
|
-
FeedlyApi.stub(:get).and_return(File.read(File.join('spec', 'fixtures', 'feed_contents_10.json')))
|
54
|
+
FeedlyApi.stub(:get).and_return(File.read(File.join('spec', 'fixtures', 'feed_contents_10.json')))
|
56
55
|
feed_contents = client.get_feed_contents('feed/https://www.eff.org/rss/updates.xml', {count: 10})
|
57
56
|
expect(feed_contents[:items].size).to eq 10
|
58
57
|
end
|
@@ -64,7 +63,7 @@ describe FeedlyApi::Client do
|
|
64
63
|
|
65
64
|
describe '#get_tag_contents' do
|
66
65
|
it 'retrievs content for specific tag' do
|
67
|
-
FeedlyApi.stub(:get).and_return(File.read(File.join('spec', 'fixtures', 'tagged.json')))
|
66
|
+
FeedlyApi.stub(:get).and_return(File.read(File.join('spec', 'fixtures', 'tagged.json')))
|
68
67
|
feed_contents = client.get_tag_contents('global.saved')
|
69
68
|
expect(feed_contents[:items].size).to eq 1
|
70
69
|
end
|
@@ -78,13 +77,13 @@ describe FeedlyApi::Client do
|
|
78
77
|
|
79
78
|
describe '#get_category_contents' do
|
80
79
|
it 'retrievs content for custom category_id' do
|
81
|
-
FeedlyApi.stub(:get).and_return(File.read(File.join('spec', 'fixtures', 'uncategoriezed.json')))
|
80
|
+
FeedlyApi.stub(:get).and_return(File.read(File.join('spec', 'fixtures', 'uncategoriezed.json')))
|
82
81
|
feed_contents = client.get_category_contents('global.uncategorized')
|
83
82
|
expect(feed_contents[:items].size).to eq 16
|
84
83
|
end
|
85
84
|
|
86
85
|
it 'retrievs custom number of feed items for specific category_id' do
|
87
|
-
FeedlyApi.stub(:get).and_return(File.read(File.join('spec', 'fixtures', 'uncategoriezed_10.json')))
|
86
|
+
FeedlyApi.stub(:get).and_return(File.read(File.join('spec', 'fixtures', 'uncategoriezed_10.json')))
|
88
87
|
feed_contents = client.get_category_contents('global.uncategorized', {count: 10})
|
89
88
|
expect(feed_contents[:items].size).to eq 10
|
90
89
|
end
|
@@ -92,15 +91,8 @@ describe FeedlyApi::Client do
|
|
92
91
|
|
93
92
|
describe '#get_markers' do
|
94
93
|
it 'returns unred counts for all feeds' do
|
95
|
-
FeedlyApi.stub(:get).and_return(File.read(File.join('spec', 'fixtures', 'markers.json')))
|
94
|
+
FeedlyApi.stub(:get).and_return(File.read(File.join('spec', 'fixtures', 'markers.json')))
|
96
95
|
expect(client.get_markers[:unreadcounts].last[:count]).to eq 16
|
97
96
|
end
|
98
97
|
end
|
99
|
-
|
100
|
-
describe '#feed' do
|
101
|
-
it 'returns Feed object for current feed id' do
|
102
|
-
feed = client.feed('feed/https://www.eff.org/rss/updates.xml')
|
103
|
-
expect(feed).to be_instance_of(FeedlyApi::Feed)
|
104
|
-
end
|
105
|
-
end
|
106
98
|
end
|
metadata
CHANGED
@@ -1,69 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: feedly_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Myuzu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-06-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: pry
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: coveralls
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
description: Simpe unofficial Feedly API wrapper. No auth yet.
|
@@ -72,9 +72,9 @@ executables: []
|
|
72
72
|
extensions: []
|
73
73
|
extra_rdoc_files: []
|
74
74
|
files:
|
75
|
-
- .gitignore
|
76
|
-
- .rspec
|
77
|
-
- .travis.yml
|
75
|
+
- ".gitignore"
|
76
|
+
- ".rspec"
|
77
|
+
- ".travis.yml"
|
78
78
|
- CHANGELOG.md
|
79
79
|
- Gemfile
|
80
80
|
- LICENSE
|
@@ -104,7 +104,7 @@ files:
|
|
104
104
|
- spec/spec_helper.rb
|
105
105
|
homepage: https://github.com/Myuzu/feedly_api
|
106
106
|
licenses:
|
107
|
-
-
|
107
|
+
- MIT License
|
108
108
|
metadata: {}
|
109
109
|
post_install_message:
|
110
110
|
rdoc_options: []
|
@@ -112,17 +112,17 @@ require_paths:
|
|
112
112
|
- lib
|
113
113
|
required_ruby_version: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: 1.9.3
|
118
118
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
119
|
requirements:
|
120
|
-
- -
|
120
|
+
- - ">="
|
121
121
|
- !ruby/object:Gem::Version
|
122
122
|
version: '0'
|
123
123
|
requirements: []
|
124
124
|
rubyforge_project:
|
125
|
-
rubygems_version: 2.0
|
125
|
+
rubygems_version: 2.3.0
|
126
126
|
signing_key:
|
127
127
|
specification_version: 4
|
128
128
|
summary: Ruby wrapper for Feedly API
|