class Ucenter::Interface::Base

The Base class of API

Public Class Methods

new(client) click to toggle source
# File lib/ucenter/interface/base.rb, line 5
def initialize(client)
  @client = client
  config = Hash.new
  config[:host]     = Ucenter::Config.uc_dbhost unless Ucenter::Config.uc_dbhost.nil?
  config[:username] = Ucenter::Config.uc_dbuser unless Ucenter::Config.uc_dbuser.nil?
  config[:password] = Ucenter::Config.uc_dbpw unless Ucenter::Config.uc_dbpw.nil?
  config[:database] = Ucenter::Config.uc_dbname unless Ucenter::Config.uc_dbname.nil?
  config[:encoding] = Ucenter::Config.uc_dbcharset unless Ucenter::Config.uc_dbcharset.nil?
  @db_client = Mysql2::Client.new(config)
end

Public Instance Methods

db_client() click to toggle source
# File lib/ucenter/interface/base.rb, line 24
def db_client
  @db_client
end
get(path, opts={}, &block) click to toggle source
# File lib/ucenter/interface/base.rb, line 16
def get(path, opts={}, &block)
  request(:get, path, opts, &block)
end
post(path, opts={}, &block) click to toggle source
# File lib/ucenter/interface/base.rb, line 20
def post(path, opts={}, &block)
  request(:post, path, opts, &block)
end