Class: Bluepay::Report
Constant Summary
BPDAILYREPORT2::PATH
Constants included
from Parameters
Parameters::BOOLEAN_CONVERTER, Parameters::DEFAULT_CONVERTER
Instance Attribute Summary
Attributes inherited from Base
#request, #response
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Interface
#data, #path
Methods included from Parameters
#bluepay_params, #converted_params, included, #params
#hash, #tps
Constructor Details
#initialize(params = {}) ⇒ Report
Returns a new instance of Report.
11
12
13
|
# File 'lib/bluepay/report.rb', line 11
def initialize(params={})
super(params)
end
|
Class Method Details
.generate!(params = {}) ⇒ Object
7
8
9
|
# File 'lib/bluepay/report.rb', line 7
def self.generate!(params={})
new(params).generate!
end
|
Instance Method Details
#[](id) ⇒ Object
48
49
50
51
52
53
54
55
|
# File 'lib/bluepay/report.rb', line 48
def [](id)
return nil unless self.respond_to?(:rows)
@_lookup ||= self.rows.inject({}) { |memo, row|
memo[row.id] = row
memo
}
@_lookup[id]
end
|
#generate! ⇒ Object
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/bluepay/report.rb', line 36
def generate!
@request = Request.new(self)
@response = request.execute!
_data = response.data
(class << self; self; end).class_eval do
_data.each { |k, v| define_method(k) { v } }
end
self
end
|
#request_params ⇒ Object
28
29
30
31
32
33
34
|
# File 'lib/bluepay/report.rb', line 28
def request_params
bluepay_params.
merge(tps(
:report_start_date,
:report_end_date
))
end
|