class PinterestApi::Client

Constants

API_URL

Public Class Methods

new(access_token) click to toggle source
# File lib/pinterest_api/client.rb, line 5
def initialize(access_token)
  @access_token = access_token
end

Public Instance Methods

boards() click to toggle source
# File lib/pinterest_api/client.rb, line 17
def boards
  get('me/boards/')
end
create_pin(pin_params) click to toggle source
# File lib/pinterest_api/client.rb, line 13
def create_pin(pin_params)
  post('pins/', pin_params)
end
me() click to toggle source
# File lib/pinterest_api/client.rb, line 9
def me
  get('me/')
end

Private Instance Methods

api_url(path, token) click to toggle source
# File lib/pinterest_api/client.rb, line 31
def api_url(path, token)
  path = path.gsub /^\//, ''
  "#{API_URL}#{path}?access_token=#{token}"
end
get(path, parameters = {}) click to toggle source
# File lib/pinterest_api/client.rb, line 23
def get(path, parameters = {})
  JSON.parse RestClient.get(api_url(path, @access_token), :params => parameters)
end
post(path, parameters = {}) click to toggle source
# File lib/pinterest_api/client.rb, line 27
def post(path, parameters = {})
  JSON.parse RestClient.post(api_url(path, @access_token), parameters)
end