class Trello::Client

Constants

BASE_URL

Public Class Methods

new(key:, token:) click to toggle source
# File lib/trello/client.rb, line 7
def initialize(key:, token:)
  raise unless key && token
  @key = key
  @token = token
  @http_client = NetHttpClient.new(URI.parse(BASE_URL))
end

Public Instance Methods

delete(path) click to toggle source
# File lib/trello/client.rb, line 22
def delete(path)
  @http_client.perform(:delete, with_key_and_token(path))
end
get(path) click to toggle source
# File lib/trello/client.rb, line 14
def get(path)
  @http_client.perform(:get, with_key_and_token(path))
end
post(path, body = {}) click to toggle source
# File lib/trello/client.rb, line 18
def post(path, body = {})
  @http_client.perform(:post, with_key_and_token(path), body.to_json)
end

Private Instance Methods

with_key_and_token(path) click to toggle source
# File lib/trello/client.rb, line 28
def with_key_and_token(path)
  path + "?key=#{@key}&token=#{@token}"
end