Sha256: b26d03e336f2f207a2f501b08bb24c13f0a2bb467fd9b403f86d3e0fa4fdaeba

Contents?: true

Size: 906 Bytes

Versions: 2

Compression:

Stored size: 906 Bytes

Contents

module Pocket
  # Wrapper for the Pocket REST API
  class Client < API
    # http://getpocket.com/developer/docs/v3/add
    # required params: url, consumer_key, access_token
    def add params
      response = connection.post("/v3/add", params)
      response.body
    end

    # http://getpocket.com/developer/docs/v3/modify
    # required params: actions, consumer_key, access_token
    def modify actions
      response = connection.post("/v3/send", {actions: actions})
      response.body
    end

    # http://getpocket.com/developer/docs/v3/retrieve
    # required params: consumer_key, access_token
    def retrieve params = {}
      response = connection.post("/v3/get", params)
      response.body
    end

    def favorite(item_id)
      modify([action: "favorite", item_id: item_id])
    end

    def unfavorite(item_id)
      modify([action: "unfavorite", item_id: item_id])
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pocket-ruby-0.6.0 lib/pocket/client.rb
pocket-ruby-0.5.0 lib/pocket/client.rb