feedbin 0.0.1 → 0.0.2
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.
- checksums.yaml +14 -6
- data/.gitignore +0 -0
- data/.travis.yml +3 -0
- data/Gemfile +5 -2
- data/LICENSE.txt +1 -1
- data/README.md +7 -9
- data/Rakefile +6 -0
- data/feedbin.gemspec +1 -1
- data/lib/feedbin.rb +38 -40
- data/lib/feedbin/version.rb +1 -1
- data/spec/feedbin_spec.rb +22 -0
- data/spec/spec_helper.rb +12 -0
- metadata +17 -12
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NzAwODFmMzhiYTAwZDFmMmM4M2I4MGIyZGVkZTlhYjAyMDA3YmY2OQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
NzQ2ZjYzNmQ3ZTlhMmI0OGNmOGIxY2QzM2NmZDU2NTM0YWU5MzI2Mg==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
YmZmYmMwMjA3ZWM5ZWRiOTUzZDJkNDgzMzI2YmY4NDkwMWEwMWY0MjM5ZDI1
|
10
|
+
YjRkNDdlYzI0ODBjMGQ2NGM1ZWRjYzk4NGVmNDAwMmI0NzcxMWM1MjFkOTk1
|
11
|
+
NWJlMjYxNGRmZjE3MGE5OGMxMjdlYjk5NTQ3NzVhZGRmMjM5Y2U=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NGZiYjhjYTNiZTRjMDg2ZmFhYzY2ZjgzZmRkOTA0ZTRiMmQxYWVkMDRkNTA4
|
14
|
+
YjgxZTNlNTNkNzQ5MWIyMTVlMTZiMDJjODVmMDM0Zjk4N2QxZTc4YmE0ODZl
|
15
|
+
ZjIxZjNmMDNiMjEzN2M4ZDY5OTM5MzA4YjQ0ZGY1M2E5NzczZjA=
|
data/.gitignore
CHANGED
File without changes
|
data/.travis.yml
ADDED
data/Gemfile
CHANGED
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
Feedbin [](https://travis-ci.org/ColbyAley/feedbin)
|
2
|
+
===
|
2
3
|
|
3
4
|
A simple Ruby wrapper for v2 of the [Feedbin.me](http://feedbin.me) REST [API](https://github.com/feedbin/feedbin-api). Includes functionality for retrieving entries and subscribing to feeds.
|
4
5
|
|
@@ -21,7 +22,7 @@ Or install it yourself as:
|
|
21
22
|
## Usage
|
22
23
|
|
23
24
|
### Examples
|
24
|
-
@feedbin =
|
25
|
+
@feedbin = FeedbinAPI.new('colby@aley.me','pa$$w0rd')
|
25
26
|
|
26
27
|
@feedbin.entries
|
27
28
|
# => (array of entry hashes)
|
@@ -51,27 +52,24 @@ Or install it yourself as:
|
|
51
52
|
require 'sinatra'
|
52
53
|
require 'feedbin'
|
53
54
|
|
54
|
-
|
55
|
+
FEEDBIN = FeedbinAPI.new('colby@aley.me','pa$$w0rd')
|
55
56
|
|
56
57
|
get '/' do
|
57
|
-
|
58
|
+
FEEDBIN.entries
|
58
59
|
end
|
59
60
|
|
60
61
|
get '/subscribe/:url' do
|
61
|
-
|
62
|
+
FEEDBIN.subscribe(url.to_s)
|
62
63
|
end
|
63
64
|
|
64
65
|
...you get the picture.
|
65
66
|
|
66
67
|
## Todo
|
67
68
|
- Move away from HTTParty because of it's massive overhead.
|
68
|
-
- Ensure that tests do not mess with tester's Feedbin account.
|
69
69
|
|
70
70
|
## Testing
|
71
71
|
|
72
|
-
Rspec is used for tests.
|
73
|
-
|
74
|
-
`$ EMAIL=email@me.com PASSWORD=pa$$w0rd rspec`
|
72
|
+
Rspec is used for tests. WebMock is used to avoid touching the live Feedbin API.
|
75
73
|
|
76
74
|
Please add tests when contrinuting, and make sure that they all pass before submitting a PR.
|
77
75
|
|
data/Rakefile
CHANGED
data/feedbin.gemspec
CHANGED
data/lib/feedbin.rb
CHANGED
@@ -2,48 +2,46 @@ require 'feedbin/version'
|
|
2
2
|
require 'httparty'
|
3
3
|
require 'json'
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
end
|
19
|
-
|
20
|
-
def unread_entries
|
21
|
-
HTTParty.get("https://api.feedbin.me/v2/unread_entries.json", basic_auth: { username: @email, password: @password })
|
22
|
-
end
|
23
|
-
|
24
|
-
def mark_as_read(id)
|
25
|
-
HTTParty.post("https://api.feedbin.me/v2/unread_entries/delete.json",
|
26
|
-
body: { 'unread_entries' => id }.to_json,
|
27
|
-
headers: { 'Content-Type' => 'application/json' },
|
28
|
-
basic_auth: { username: @email, password: @password })
|
29
|
-
end
|
5
|
+
class FeedbinAPI
|
6
|
+
attr_accessor :email, :password
|
7
|
+
def initialize(email, password)
|
8
|
+
@email, @password = email, password
|
9
|
+
end
|
10
|
+
|
11
|
+
def entries
|
12
|
+
HTTParty.get("https://api.feedbin.me/v2/entries.json", basic_auth: { username: @email, password: @password })
|
13
|
+
end
|
14
|
+
|
15
|
+
def entry(id)
|
16
|
+
HTTParty.get("https://api.feedbin.me/v2/entries/#{id}.json", basic_auth: { username: @email, password: @password })
|
17
|
+
end
|
30
18
|
|
31
|
-
|
32
|
-
HTTParty.
|
33
|
-
|
19
|
+
def unread_entries
|
20
|
+
HTTParty.get("https://api.feedbin.me/v2/unread_entries.json", basic_auth: { username: @email, password: @password })
|
21
|
+
end
|
22
|
+
|
23
|
+
def mark_as_read(id)
|
24
|
+
HTTParty.post("https://api.feedbin.me/v2/unread_entries/delete.json",
|
25
|
+
body: { 'unread_entries' => id }.to_json,
|
26
|
+
headers: { 'Content-Type' => 'application/json' },
|
27
|
+
basic_auth: { username: @email, password: @password })
|
28
|
+
end
|
29
|
+
|
30
|
+
def mark_as_unread(id)
|
31
|
+
HTTParty.post("https://api.feedbin.me/v2/unread_entries.json",
|
32
|
+
body: { 'unread_entries' => id }.to_json,
|
33
|
+
headers: { 'Content-Type' => 'application/json' },
|
34
|
+
basic_auth: { username: @email, password: @password })
|
35
|
+
end
|
36
|
+
|
37
|
+
def subscribe(url)
|
38
|
+
HTTParty.post("https://api.feedbin.me/v2/subscriptions.json",
|
39
|
+
body: { 'feed_url' => url }.to_json,
|
34
40
|
headers: { 'Content-Type' => 'application/json' },
|
35
41
|
basic_auth: { username: @email, password: @password })
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
body: { 'feed_url' => url }.to_json,
|
41
|
-
headers: { 'Content-Type' => 'application/json' },
|
42
|
-
basic_auth: { username: @email, password: @password })
|
43
|
-
end
|
44
|
-
|
45
|
-
def subscriptions
|
46
|
-
HTTParty.get("https://api.feedbin.me/v2/subscriptions.json", basic_auth: { username: @email, password: @password })
|
47
|
-
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def subscriptions
|
45
|
+
HTTParty.get("https://api.feedbin.me/v2/subscriptions.json", basic_auth: { username: @email, password: @password })
|
48
46
|
end
|
49
47
|
end
|
data/lib/feedbin/version.rb
CHANGED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe FeedbinAPI do
|
4
|
+
|
5
|
+
before do
|
6
|
+
@feedbin = FeedbinAPI.new(ENV["EMAIL"], ENV["PASSWORD"])
|
7
|
+
end
|
8
|
+
|
9
|
+
describe '.entries' do
|
10
|
+
it 'should return a 200' do
|
11
|
+
stub_request(:get, "https://#{ENV["EMAIL"]}:#{ENV["PASSWORD"]}@api.feedbin.me/v2/entries.json").to_return(status: 200)
|
12
|
+
@feedbin.entries.code.should == 200
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe '.subscriptions' do
|
17
|
+
it 'should return 201' do
|
18
|
+
stub_request(:get, "https://#{ENV["EMAIL"]}:#{ENV["PASSWORD"]}@api.feedbin.me/v2/subscriptions.json").to_return(status: 200)
|
19
|
+
@feedbin.subscriptions.code.should == 200
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/spec/spec_helper.rb
ADDED
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.2
|
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-
|
11
|
+
date: 2013-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -28,42 +28,42 @@ dependencies:
|
|
28
28
|
name: rake
|
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: rspec
|
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: httparty
|
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: :runtime
|
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: A Ruby wrapper for the Feedbin API
|
@@ -73,6 +73,7 @@ extensions: []
|
|
73
73
|
extra_rdoc_files: []
|
74
74
|
files:
|
75
75
|
- .gitignore
|
76
|
+
- .travis.yml
|
76
77
|
- Gemfile
|
77
78
|
- LICENSE.txt
|
78
79
|
- README.md
|
@@ -80,6 +81,8 @@ files:
|
|
80
81
|
- feedbin.gemspec
|
81
82
|
- lib/feedbin.rb
|
82
83
|
- lib/feedbin/version.rb
|
84
|
+
- spec/feedbin_spec.rb
|
85
|
+
- spec/spec_helper.rb
|
83
86
|
homepage: https://github.com/ColbyAley/feedbin
|
84
87
|
licenses:
|
85
88
|
- MIT
|
@@ -90,18 +93,20 @@ require_paths:
|
|
90
93
|
- lib
|
91
94
|
required_ruby_version: !ruby/object:Gem::Requirement
|
92
95
|
requirements:
|
93
|
-
- - '>='
|
96
|
+
- - ! '>='
|
94
97
|
- !ruby/object:Gem::Version
|
95
98
|
version: '0'
|
96
99
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
100
|
requirements:
|
98
|
-
- - '>='
|
101
|
+
- - ! '>='
|
99
102
|
- !ruby/object:Gem::Version
|
100
103
|
version: '0'
|
101
104
|
requirements: []
|
102
105
|
rubyforge_project:
|
103
|
-
rubygems_version: 2.0.
|
106
|
+
rubygems_version: 2.0.6
|
104
107
|
signing_key:
|
105
108
|
specification_version: 4
|
106
109
|
summary: Ruby wrapper for the Feedbin API
|
107
|
-
test_files:
|
110
|
+
test_files:
|
111
|
+
- spec/feedbin_spec.rb
|
112
|
+
- spec/spec_helper.rb
|