Class: MerbMerchant::Billing::Integrations::Return

Inherits:
Object
  • Object
show all
Defined in:
lib/merb_merchant/billing/integrations/return.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(query_string) ⇒ Return

Returns a new instance of Return.



7
8
9
# File 'lib/merb_merchant/billing/integrations/return.rb', line 7

def initialize(query_string)
  @params = parse(query_string)
end

Instance Attribute Details

#paramsObject

Returns the value of attribute params.



5
6
7
# File 'lib/merb_merchant/billing/integrations/return.rb', line 5

def params
  @params
end

Instance Method Details

#messageObject



16
17
18
# File 'lib/merb_merchant/billing/integrations/return.rb', line 16

def message
  
end

#parse(query_string) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/merb_merchant/billing/integrations/return.rb', line 20

def parse(query_string)
  return {} if query_string.blank?
  
  query_string.split('&').inject({}) do |memo, chunk|
    next if chunk.empty?
    key, value = chunk.split('=', 2)
    next if key.empty?
    value = value.nil? ? nil : CGI.unescape(value)
    memo[CGI.unescape(key)] = value
    memo
  end
end

#success?Boolean

Successful by default. Overridden in the child class

Returns:

  • (Boolean)


12
13
14
# File 'lib/merb_merchant/billing/integrations/return.rb', line 12

def success?
  true
end