Class: Buckaruby::Response
- Inherits:
-
Object
- Object
- Buckaruby::Response
show all
- Defined in:
- lib/buckaruby/response.rb
Overview
Base class for any response.
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(body, config) ⇒ Response
Returns a new instance of Response.
13
14
15
16
17
18
|
# File 'lib/buckaruby/response.rb', line 13
def initialize(body, config)
@response = parse_response(body)
logger = config.logger
logger.debug("[response] params: #{params.inspect}")
end
|
Instance Attribute Details
#response ⇒ Object
Returns the value of attribute response.
11
12
13
|
# File 'lib/buckaruby/response.rb', line 11
def response
@response
end
|
Instance Method Details
#additional ⇒ Object
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# File 'lib/buckaruby/response.rb', line 47
def additional
@additional ||= begin
additional = Support::CaseInsensitiveHash.new
params.each do |key, value|
next unless key.upcase.start_with?('ADD_')
new_key = key.to_s[4..]
additional[new_key] = value
end
additional
end
end
|
#custom ⇒ Object
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/buckaruby/response.rb', line 32
def custom
@custom ||= begin
custom = Support::CaseInsensitiveHash.new
params.each do |key, value|
next unless key.upcase.start_with?('CUST_')
new_key = key.to_s[5..]
custom[new_key] = value
end
custom
end
end
|
#status ⇒ Object
24
25
26
|
# File 'lib/buckaruby/response.rb', line 24
def status
TransactionStatus.parse(params[:brq_statuscode])
end
|
#timestamp ⇒ Object
28
29
30
|
# File 'lib/buckaruby/response.rb', line 28
def timestamp
parse_time(params[:brq_timestamp])
end
|