Module: Wirecard::Elastic

Defined in:
lib/wirecard/elastic.rb,
lib/wirecard/elastic/error.rb,
lib/wirecard/elastic/request.rb,
lib/wirecard/elastic/version.rb,
lib/wirecard/elastic/response.rb,
lib/wirecard/elastic/request/base.rb,
lib/wirecard/elastic/configuration.rb,
lib/wirecard/elastic/response/base.rb,
lib/wirecard/elastic/request/refund.rb,
lib/wirecard/elastic/response/refund.rb,
lib/wirecard/elastic/request/transaction.rb,
lib/wirecard/elastic/request/body/builder.rb,
lib/wirecard/elastic/response/transaction.rb,
lib/wirecard/elastic/request/body/builder/xml.rb,
lib/wirecard/elastic/request/body/params/refund.rb

Defined Under Namespace

Classes: ConfigError, Configuration, Error, Request, Response

Constant Summary collapse

METHODS_MAP =

this restrict the actions available via the library to avoid crashes adding ‘:whatever` will allow to call Elastic.whatever and try to load Request::Whatever.new(*args) with it

[:transaction, :refund]
VERSION =
"0.2.2"

Class Method Summary collapse

Class Method Details

.configurationObject Also known as: config

access and define configuration this is used while loading your environment (initializers)



40
41
42
43
44
45
46
47
# File 'lib/wirecard/elastic.rb', line 40

def configuration
  @configuration ||= Configuration.new
  if block_given?
    yield @configuration
  else
    @configuration
  end
end

.method_missing(method, *args) ⇒ Object



30
31
32
33
34
35
# File 'lib/wirecard/elastic.rb', line 30

def method_missing(method, *args)
  unless METHODS_MAP.include?(method)
    raise Error, "Invalid action. Please use the methods available (#{METHODS_MAP.join(', ')})"
  end
  Request.const_get(method.capitalize).new(*args)
end

.resetObject

simply reset the configuration NOTE : avoid to use this if you’re not resetting anything afterwards



54
55
56
# File 'lib/wirecard/elastic.rb', line 54

def reset
  @configuration = Configuration.new
end