class BacklogJp::Client

Constants

APIException
AuthenticationException

Public Class Methods

new(config = {}) click to toggle source
# File lib/backlog_jp/client.rb, line 8
def initialize config = {}
  config[:space]   ||= ENV["BACKLOG_SPACE"]
  config[:api_key] ||= ENV["BACKLOG_API_KEY"]

  unless config[:space] && config[:api_key]
    fail AuthenticationException, "`:space` and `:api_key` are required for authentication."
  end

  @space   = config[:space]
  @api_key = config[:api_key]
end

Private Instance Methods

build_params(params) click to toggle source
# File lib/backlog_jp/client.rb, line 45
def build_params params
  hash = {}

  params.each do |key, value|
    hash.update camelize(key.to_s).intern => value
  end

  hash
end
camelize(string) click to toggle source
# File lib/backlog_jp/client.rb, line 41
def camelize string
  string.gsub(/_[a-z]/){|match| match.chars.last.upcase}
end
connection() click to toggle source
# File lib/backlog_jp/client.rb, line 37
def connection
  @connection ||= Faraday.new "https://#{@space}.backlog.jp/api/v2/"
end