module DaisybillApi::Data::Url

Constants

DEFAULT_PATH

Public Class Methods

build(path, params = {}) click to toggle source
# File lib/daisybill_api/data/url.rb, line 9
def build(path, params = {})
  port = DaisybillApi.configuration.port
  builder = port == 443 ? URI::HTTPS : URI::HTTP
  builder.build({
      host: DaisybillApi.configuration.host,
      port: port,
      path: "#{DEFAULT_PATH}#{path}",
      query: to_query(params.merge api_token: DaisybillApi.configuration.api_token)
    })
end
to_query(hash) click to toggle source
# File lib/daisybill_api/data/url.rb, line 20
def to_query(hash)
  URI.encode_www_form hash
end