Class: LemonWay::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/lemon_way/client.rb

Defined Under Namespace

Classes: Error

Constant Summary collapse

@@api_method_calls =
%w(
  FastPay
  GetBalances
  GetKycStatus
  GetMoneyInIBANDetails
  GetMoneyInTransDetails
  GetMoneyOutTransDetails
  GetPaymentDetails
  GetWalletDetails
  MoneyIn
  MoneyIn3DConfirm
  MoneyIn3DInit
  MoneyInWebInit
  MoneyInWithCardId
  MoneyOut
  RefundMoneyIn
  RegisterCard
  RegisterIBAN
  RegisterWallet
  SendPayment
  UnregisterCard
  UpdateWalletDetails
  UploadFile
)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Client

Returns a new instance of Client.



37
38
39
40
41
42
# File 'lib/lemon_way/client.rb', line 37

def initialize opts = {}
  @options = opts.symbolize_keys!.except(:uri, :xml_mini_backend).camelize_keys
  @uri = URI.parse opts[:uri]
  @xml_mini_backend = opts[:xml_mini_backend] || ActiveSupport::XmlMini_REXML
  @entity_expansion_text_limit = opts[:entity_expansion_text_limit] || 10**20
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args, &block) ⇒ Object



44
45
46
47
48
49
50
51
52
# File 'lib/lemon_way/client.rb', line 44

def method_missing *args, &block
  camelized_method_name = args.first.to_s.camelize
  if @@api_method_calls.include? camelized_method_name
    attrs = attrs_from_options args.extract_options!
    query camelized_method_name, attrs, &block
  else
    super
  end
end

Instance Attribute Details

#entity_expansion_text_limitObject (readonly)

Returns the value of attribute entity_expansion_text_limit.



35
36
37
# File 'lib/lemon_way/client.rb', line 35

def entity_expansion_text_limit
  @entity_expansion_text_limit
end

#optionsObject (readonly)

Returns the value of attribute options.



35
36
37
# File 'lib/lemon_way/client.rb', line 35

def options
  @options
end

#uriObject (readonly)

Returns the value of attribute uri.



35
36
37
# File 'lib/lemon_way/client.rb', line 35

def uri
  @uri
end

#xml_mini_backendObject (readonly)

Returns the value of attribute xml_mini_backend.



35
36
37
# File 'lib/lemon_way/client.rb', line 35

def xml_mini_backend
  @xml_mini_backend
end