Class: AcceptOn::Client

Inherits:
Object
  • Object
show all
Includes:
API::Promotion, API::Querying, API::Refunding, API::Tokenization
Defined in:
lib/accepton/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from API::Tokenization

#create_token

Methods included from API::Refunding

#refund

Methods included from API::Querying

#charge, #charges, #promo_code, #promo_codes, #token

Methods included from API::Promotion

#create_promo_code, #delete_promo_code, #update_promo_code

Constructor Details

#initialize(options = {}) {|_self| ... } ⇒ AcceptOn::Client

Initializes a new Client object

Parameters:

  • options (Hash) (defaults to: {})

Yields:

  • (_self)

Yield Parameters:



20
21
22
23
24
25
26
# File 'lib/accepton/client.rb', line 20

def initialize(options = {})
  options.each do |key, value|
    instance_variable_set("@#{key}", value)
  end
  set_defaults
  yield(self) if block_given?
end

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key.



13
14
15
# File 'lib/accepton/client.rb', line 13

def api_key
  @api_key
end

#environmentObject

Returns the value of attribute environment.



13
14
15
# File 'lib/accepton/client.rb', line 13

def environment
  @environment
end

#user_agentString

Returns:

  • (String)


34
35
36
# File 'lib/accepton/client.rb', line 34

def user_agent
  @user_agent ||= "accepton-ruby/#{AcceptOn::VERSION}"
end

Instance Method Details

#api_key?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/accepton/client.rb', line 29

def api_key?
  !!api_key
end