feedbin 0.0.2 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +3 -0
- data/lib/feedbin.rb +47 -14
- data/lib/feedbin/version.rb +1 -1
- data/spec/feedbin_spec.rb +36 -5
- data/spec/spec_helper.rb +0 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OWY0YWMzMGNlYjY0OTBjMDA1OTJmMzhlMGNkYzU0ZmU3Y2YyMWFiMQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NDUzY2FmNjY1NDVhMzI1MGRlNDg5MmIxZGYzYzhlYTE5YzZlYmU2ZA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
N2QyMzQwNTBiNTFkMTU4ZWQ3NmE2YWZkYWRiNTA2MjcyZDkyOTMzYmI4ODM5
|
10
|
+
MjM5ZTdjZjIyN2U3Y2U2MWMxYWIyNzUxMjFkMzNiYTYxZjk1NjgwNWRiYzg4
|
11
|
+
YjIyMTQ5MzA3YjJlOWEzOGRkMDRkNjIwNWMwNmE5MDc4YjhkOGE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MmQ5NmI0Mzg1ZDM0Yzk3NGM4ZmRkOGU1YmE1YjNkZGYxZjA0Y2MyN2VkMTUy
|
14
|
+
YzA5OTYxMWU2YTk2MDI5MDNiOGZiNjlhNjIyM2E0M2EwNGNkMzM5MmVlZDkw
|
15
|
+
Yjc4ZWE3NjAyMjgwZmYxZWE4MTIxY2RlNzcwODM2MTQ5ZDBmYmU=
|
data/README.md
CHANGED
data/lib/feedbin.rb
CHANGED
@@ -8,8 +8,10 @@ class FeedbinAPI
|
|
8
8
|
@email, @password = email, password
|
9
9
|
end
|
10
10
|
|
11
|
-
|
12
|
-
|
11
|
+
# Entries
|
12
|
+
|
13
|
+
def entries(options = {})
|
14
|
+
HTTParty.get("https://api.feedbin.me/v2/entries.json", query: options, basic_auth: { username: @email, password: @password })
|
13
15
|
end
|
14
16
|
|
15
17
|
def entry(id)
|
@@ -20,28 +22,59 @@ class FeedbinAPI
|
|
20
22
|
HTTParty.get("https://api.feedbin.me/v2/unread_entries.json", basic_auth: { username: @email, password: @password })
|
21
23
|
end
|
22
24
|
|
25
|
+
def star(id)
|
26
|
+
HTTParty.post("https://api.feedbin.me/v2/starred_entries.json",
|
27
|
+
body: { 'starred_entries' => id }.to_json,
|
28
|
+
headers: { 'Content-Type' => 'application/json' },
|
29
|
+
basic_auth: { username: @email, password: @password }).code
|
30
|
+
end
|
31
|
+
|
32
|
+
def unstar(id)
|
33
|
+
HTTParty.post("https://api.feedbin.me/v2/starred_entries/delete.json",
|
34
|
+
body: { 'starred_entries' => id }.to_json,
|
35
|
+
headers: { 'Content-Type' => 'application/json' },
|
36
|
+
basic_auth: { username: @email, password: @password }).code
|
37
|
+
end
|
38
|
+
|
23
39
|
def mark_as_read(id)
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
40
|
+
HTTParty.post("https://api.feedbin.me/v2/unread_entries/delete.json",
|
41
|
+
body: { 'unread_entries' => id }.to_json,
|
42
|
+
headers: { 'Content-Type' => 'application/json' },
|
43
|
+
basic_auth: { username: @email, password: @password }).code
|
28
44
|
end
|
29
45
|
|
30
46
|
def mark_as_unread(id)
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
47
|
+
HTTParty.post("https://api.feedbin.me/v2/unread_entries.json",
|
48
|
+
body: { 'unread_entries' => id }.to_json,
|
49
|
+
headers: { 'Content-Type' => 'application/json' },
|
50
|
+
basic_auth: { username: @email, password: @password }).code
|
51
|
+
end
|
52
|
+
|
53
|
+
# Feeds
|
54
|
+
|
55
|
+
def feed(id)
|
56
|
+
HTTParty.get("https://api.feedbin.me/v2/feeds/#{id}.json", basic_auth: { username: @email, password: @password })
|
35
57
|
end
|
36
58
|
|
59
|
+
# Subscriptions
|
60
|
+
|
37
61
|
def subscribe(url)
|
38
62
|
HTTParty.post("https://api.feedbin.me/v2/subscriptions.json",
|
39
63
|
body: { 'feed_url' => url }.to_json,
|
40
64
|
headers: { 'Content-Type' => 'application/json' },
|
41
|
-
basic_auth: { username: @email, password: @password })
|
65
|
+
basic_auth: { username: @email, password: @password }).code
|
66
|
+
end
|
67
|
+
|
68
|
+
def unsubscribe(id)
|
69
|
+
HTTParty.delete("https://api.feedbin.me/v2/subscriptions/#{id}.json", basic_auth: { username: @email, password: @password }).code
|
42
70
|
end
|
43
71
|
|
44
|
-
def subscriptions
|
45
|
-
|
72
|
+
def subscriptions(options = {})
|
73
|
+
if options[:since]
|
74
|
+
resp = HTTParty.get("https://api.feedbin.me/v2/subscriptions.json", query: { since: options[:since] }, basic_auth: { username: @email, password: @password })
|
75
|
+
return resp == [] ? resp : 'There have been no subscriptions since this date.'.to_json unless resp.code != 200
|
76
|
+
else
|
77
|
+
HTTParty.get("https://api.feedbin.me/v2/subscriptions.json", basic_auth: { username: @email, password: @password })
|
78
|
+
end
|
46
79
|
end
|
47
|
-
end
|
80
|
+
end
|
data/lib/feedbin/version.rb
CHANGED
data/spec/feedbin_spec.rb
CHANGED
@@ -3,20 +3,51 @@ require 'spec_helper'
|
|
3
3
|
describe FeedbinAPI do
|
4
4
|
|
5
5
|
before do
|
6
|
-
@feedbin = FeedbinAPI.new(
|
6
|
+
@feedbin = FeedbinAPI.new('email', 'password')
|
7
7
|
end
|
8
8
|
|
9
9
|
describe '.entries' do
|
10
|
-
it 'should return a 200' do
|
11
|
-
stub_request(:get, "https
|
10
|
+
it 'should get entries and return a 200' do
|
11
|
+
stub_request(:get, "https://email:password@api.feedbin.me/v2/entries.json?").to_return(status: 200)
|
12
12
|
@feedbin.entries.code.should == 200
|
13
13
|
end
|
14
|
+
|
15
|
+
it 'should return a 200 when parameter is passed' do
|
16
|
+
stub_request(:get, "https://email:password@api.feedbin.me/v2/entries.json?read=false").to_return(status: 200)
|
17
|
+
@feedbin.entries(read: false).code.should == 200
|
18
|
+
end
|
14
19
|
end
|
15
20
|
|
16
21
|
describe '.subscriptions' do
|
17
|
-
it 'should return
|
18
|
-
stub_request(:get, "https
|
22
|
+
it 'should get subscriptions and return a 200' do
|
23
|
+
stub_request(:get, "https://email:password@api.feedbin.me/v2/subscriptions.json").to_return(status: 200)
|
19
24
|
@feedbin.subscriptions.code.should == 200
|
20
25
|
end
|
21
26
|
end
|
27
|
+
|
28
|
+
describe '.unsubscribe' do
|
29
|
+
it 'should unsubscribe and return a 204' do
|
30
|
+
stub_request(:delete, "https://email:password@api.feedbin.me/v2/subscriptions/260815.json").to_return(status: 204)
|
31
|
+
@feedbin.unsubscribe(260815).should == 204
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe '.feed' do
|
36
|
+
it 'should get feed and return a 200' do
|
37
|
+
stub_request(:get, "https://email:password@api.feedbin.me/v2/feeds/1.json").to_return(status: 200)
|
38
|
+
@feedbin.feed(1).code.should == 200
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe '.star' do
|
43
|
+
it 'should star a post and return a 200' do
|
44
|
+
stub_request(:post, "https://email:password@api.feedbin.me/v2/starred_entries.json").to_return(status: 200)
|
45
|
+
@feedbin.star(33).should == 200
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'should star an array of posts and return a 200' do
|
49
|
+
stub_request(:post, "https://email:password@api.feedbin.me/v2/starred_entries.json").to_return(status: 200)
|
50
|
+
@feedbin.star([33,44,55,66,77]).should == 200
|
51
|
+
end
|
52
|
+
end
|
22
53
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: feedbin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Colby Aley
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-08-
|
11
|
+
date: 2013-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|