feedbin 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +86 -0
- data/Rakefile +1 -0
- data/feedbin.gemspec +25 -0
- data/lib/feedbin.rb +49 -0
- data/lib/feedbin/version.rb +3 -0
- metadata +107 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 861e3a51b3187562bb99ea216ced66d9495f6f52
|
4
|
+
data.tar.gz: d0bc0eae892a7bc3833130cc231c119812666ade
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3f0b2b497988ff947e8e345f46cd98cd76d4fe762a907c3f8606c4182114684909a0afb8500a65ebbebd540740a5efd7f28d6248ea2b2a5fed1415b1f274492f
|
7
|
+
data.tar.gz: 9c76e98204dd79e23728995deee2d732d76dfd347db838324208dabee5c4495036d616b5a4fe3e709172e373c017a21506dd400052eb2f6f96be2e31130f3bbf
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 TODO: Write your name
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
# Feedbin
|
2
|
+
|
3
|
+
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
|
+
This is an unoficial gem, and is not affiliated with Feedbin.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
`gem 'feedbin'`
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
`$ bundle`
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
`$ gem install feedbin`
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
### Examples
|
24
|
+
@feedbin = Feedbin::API.new('colby@aley.me','pa$$w0rd')
|
25
|
+
|
26
|
+
@feedbin.entries
|
27
|
+
# => (array of entry hashes)
|
28
|
+
|
29
|
+
@feedbin.unread_entries
|
30
|
+
# => (array of unread entry IDs)
|
31
|
+
|
32
|
+
entry_id = @feedbin.entries[0]["id"] # Let's get the ID of the first entry in our array.
|
33
|
+
|
34
|
+
@feedbin.entry(entry_id)
|
35
|
+
# => (entry)
|
36
|
+
|
37
|
+
@feedbin.mark_as_read(entry_id)
|
38
|
+
# => entry_id
|
39
|
+
|
40
|
+
@feedbin.mark_as_unread(entry_id)
|
41
|
+
# => entry_id
|
42
|
+
|
43
|
+
@feedbin.subscribe('http://colbyaley.com/feed')
|
44
|
+
# => 200
|
45
|
+
|
46
|
+
@feedbin.subscriptions
|
47
|
+
# => (an array with hashes of all subscriptions)
|
48
|
+
|
49
|
+
### Sample Sinatra App
|
50
|
+
|
51
|
+
require 'sinatra'
|
52
|
+
require 'feedbin'
|
53
|
+
|
54
|
+
@@feedbin = Feedbin::API.new('colby@aley.me','pa$$w0rd')
|
55
|
+
|
56
|
+
get '/' do
|
57
|
+
@@feedbin.entries
|
58
|
+
end
|
59
|
+
|
60
|
+
get '/subscribe/:url' do
|
61
|
+
@@feedbin.subscribe(url.to_s)
|
62
|
+
end
|
63
|
+
|
64
|
+
...you get the picture.
|
65
|
+
|
66
|
+
## Todo
|
67
|
+
- Move away from HTTParty because of it's massive overhead.
|
68
|
+
- Ensure that tests do not mess with tester's Feedbin account.
|
69
|
+
|
70
|
+
## Testing
|
71
|
+
|
72
|
+
Rspec is used for tests. You will need to pass in your Feedbin email and password to run the tests.
|
73
|
+
|
74
|
+
`$ EMAIL=email@me.com PASSWORD=pa$$w0rd rspec`
|
75
|
+
|
76
|
+
Please add tests when contrinuting, and make sure that they all pass before submitting a PR.
|
77
|
+
|
78
|
+
## Contributing
|
79
|
+
|
80
|
+
1. Fork it
|
81
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
82
|
+
3. Add test coverage for your code.
|
83
|
+
4. Run `rspec`. If there are any failures, please fix them before moving forward.
|
84
|
+
5. Commit your changes (`git commit -am 'Add some feature'`)
|
85
|
+
6. Push to the branch (`git push origin my-new-feature`)
|
86
|
+
7. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/feedbin.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'feedbin/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "feedbin"
|
8
|
+
spec.version = Feedbin::VERSION
|
9
|
+
spec.author = "Colby Aley"
|
10
|
+
spec.email = "colby@aley.me"
|
11
|
+
spec.description = %q{A Ruby wrapper for the Feedbin API}
|
12
|
+
spec.summary = %q{Ruby wrapper for the Feedbin API}
|
13
|
+
spec.homepage = "https://github.com/ColbyAley/feedbin"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "rspec"
|
24
|
+
spec.add_runtime_dependency "httparty"
|
25
|
+
end
|
data/lib/feedbin.rb
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'feedbin/version'
|
2
|
+
require 'httparty'
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
module Feedbin
|
6
|
+
class API
|
7
|
+
attr_accessor :email, :password
|
8
|
+
def initialize(email, password)
|
9
|
+
@email, @password = email, password
|
10
|
+
end
|
11
|
+
|
12
|
+
def entries
|
13
|
+
HTTParty.get("https://api.feedbin.me/v2/entries.json", basic_auth: { username: @email, password: @password })
|
14
|
+
end
|
15
|
+
|
16
|
+
def entry(id)
|
17
|
+
HTTParty.get("https://api.feedbin.me/v2/entries/#{id}.json", basic_auth: { username: @email, password: @password })
|
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
|
30
|
+
|
31
|
+
def mark_as_unread(id)
|
32
|
+
HTTParty.post("https://api.feedbin.me/v2/unread_entries.json",
|
33
|
+
body: { 'unread_entries' => id }.to_json,
|
34
|
+
headers: { 'Content-Type' => 'application/json' },
|
35
|
+
basic_auth: { username: @email, password: @password })
|
36
|
+
end
|
37
|
+
|
38
|
+
def subscribe(url)
|
39
|
+
HTTParty.post("https://api.feedbin.me/v2/subscriptions.json",
|
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
|
48
|
+
end
|
49
|
+
end
|
metadata
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: feedbin
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Colby Aley
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-07-15 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: httparty
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: A Ruby wrapper for the Feedbin API
|
70
|
+
email: colby@aley.me
|
71
|
+
executables: []
|
72
|
+
extensions: []
|
73
|
+
extra_rdoc_files: []
|
74
|
+
files:
|
75
|
+
- .gitignore
|
76
|
+
- Gemfile
|
77
|
+
- LICENSE.txt
|
78
|
+
- README.md
|
79
|
+
- Rakefile
|
80
|
+
- feedbin.gemspec
|
81
|
+
- lib/feedbin.rb
|
82
|
+
- lib/feedbin/version.rb
|
83
|
+
homepage: https://github.com/ColbyAley/feedbin
|
84
|
+
licenses:
|
85
|
+
- MIT
|
86
|
+
metadata: {}
|
87
|
+
post_install_message:
|
88
|
+
rdoc_options: []
|
89
|
+
require_paths:
|
90
|
+
- lib
|
91
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - '>='
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - '>='
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
101
|
+
requirements: []
|
102
|
+
rubyforge_project:
|
103
|
+
rubygems_version: 2.0.3
|
104
|
+
signing_key:
|
105
|
+
specification_version: 4
|
106
|
+
summary: Ruby wrapper for the Feedbin API
|
107
|
+
test_files: []
|