class AcceptOn::Client

Attributes

api_key[RW]
environment[RW]
user_agent[W]

Public Class Methods

new(options = {}) { |self| ... } click to toggle source

Initializes a new Client object

@param options [Hash] @return [AcceptOn::Client]

# File lib/accepton/client.rb, line 24
def initialize(options = {})
  options.each do |key, value|
    instance_variable_set("@#{key}", value)
  end
  set_defaults
  yield(self) if block_given?
end

Public Instance Methods

api_key?() click to toggle source

@return [Boolean]

# File lib/accepton/client.rb, line 33
def api_key?
  !!api_key
end
user_agent() click to toggle source

@return [String]

# File lib/accepton/client.rb, line 38
def user_agent
  @user_agent ||= "accepton-ruby/#{AcceptOn::VERSION}"
end

Private Instance Methods

set_defaults() click to toggle source

@return [void]

# File lib/accepton/client.rb, line 45
def set_defaults
  self.environment = :production unless environment
end