class FeedbinAPI

Attributes

email[RW]
password[RW]

Public Class Methods

new(email, password) click to toggle source
# File lib/feedbin.rb, line 7
def initialize(email, password)
  @email, @password = email, password
end

Public Instance Methods

entries(options = {}) click to toggle source

Entries

# File lib/feedbin.rb, line 13
def entries(options = {})
  HTTParty.get("https://api.feedbin.me/v2/entries.json", query: options, basic_auth: { username: @email, password: @password })
end
entry(id) click to toggle source
# File lib/feedbin.rb, line 17
def entry(id)
  HTTParty.get("https://api.feedbin.me/v2/entries/#{id}.json", basic_auth: { username: @email, password: @password })
end
feed(id) click to toggle source

Feeds

# File lib/feedbin.rb, line 55
def feed(id)
  HTTParty.get("https://api.feedbin.me/v2/feeds/#{id}.json", basic_auth: { username: @email, password: @password })
end
mark_as_read(id) click to toggle source
# File lib/feedbin.rb, line 39
def mark_as_read(id)
  HTTParty.post("https://api.feedbin.me/v2/unread_entries/delete.json", 
    body: { 'unread_entries' => id }.to_json, 
    headers: { 'Content-Type' => 'application/json' },
    basic_auth: { username: @email, password: @password }).code
end
mark_as_unread(id) click to toggle source
# File lib/feedbin.rb, line 46
def mark_as_unread(id)
  HTTParty.post("https://api.feedbin.me/v2/unread_entries.json", 
    body: { 'unread_entries' => id }.to_json, 
    headers: { 'Content-Type' => 'application/json' },
    basic_auth: { username: @email, password: @password }).code
end
star(id) click to toggle source
# File lib/feedbin.rb, line 25
def star(id)
  HTTParty.post("https://api.feedbin.me/v2/starred_entries.json", 
    body: { 'starred_entries' => id }.to_json, 
    headers: { 'Content-Type' => 'application/json' },
    basic_auth: { username: @email, password: @password }).code
end
subscribe(url) click to toggle source

Subscriptions

# File lib/feedbin.rb, line 61
def subscribe(url)
  HTTParty.post("https://api.feedbin.me/v2/subscriptions.json", 
    body: { 'feed_url' => url }.to_json, 
    headers: { 'Content-Type' => 'application/json' },
    basic_auth: { username: @email, password: @password }).code
end
subscriptions(options = {}) click to toggle source
# File lib/feedbin.rb, line 72
def subscriptions(options = {})
  if options[:since]
    resp = HTTParty.get("https://api.feedbin.me/v2/subscriptions.json", query: { since: options[:since] }, basic_auth: { username: @email, password: @password })
    return resp == [] ? resp : 'There have been no subscriptions since this date.'.to_json unless resp.code != 200
  else
    HTTParty.get("https://api.feedbin.me/v2/subscriptions.json", basic_auth: { username: @email, password: @password })
  end
end
unread_entries() click to toggle source
# File lib/feedbin.rb, line 21
def unread_entries
  HTTParty.get("https://api.feedbin.me/v2/unread_entries.json", basic_auth: { username: @email, password: @password })
end
unstar(id) click to toggle source
# File lib/feedbin.rb, line 32
def unstar(id)
  HTTParty.post("https://api.feedbin.me/v2/starred_entries/delete.json", 
    body: { 'starred_entries' => id }.to_json, 
    headers: { 'Content-Type' => 'application/json' },
    basic_auth: { username: @email, password: @password }).code
end
unsubscribe(id) click to toggle source
# File lib/feedbin.rb, line 68
def unsubscribe(id)
  HTTParty.delete("https://api.feedbin.me/v2/subscriptions/#{id}.json", basic_auth: { username: @email, password: @password }).code
end