Class: SlidePay::Report
- Inherits:
-
Hash
- Object
- Hash
- SlidePay::Report
- Defined in:
- lib/slidepay/reports/report.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#endpoint ⇒ Object
Returns the value of attribute endpoint.
-
#report_type ⇒ Object
Returns the value of attribute report_type.
-
#sfa ⇒ Object
Returns the value of attribute sfa.
-
#token ⇒ Object
Returns the value of attribute token.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(search_params = {}) ⇒ Report
constructor
A new instance of Report.
- #retrieve(options = {}) ⇒ Object
Constructor Details
#initialize(search_params = {}) ⇒ Report
Returns a new instance of Report.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/slidepay/reports/report.rb', line 9 def initialize(search_params={}) # Initialize search_filter_arrays if search_params.is_a? Hash @sfa = [search_params] elsif search_params.is_a? Array @sfa = search_params else @sfa = [] end end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
7 8 9 |
# File 'lib/slidepay/reports/report.rb', line 7 def api_key @api_key end |
#endpoint ⇒ Object
Returns the value of attribute endpoint.
7 8 9 |
# File 'lib/slidepay/reports/report.rb', line 7 def endpoint @endpoint end |
#report_type ⇒ Object
Returns the value of attribute report_type.
5 6 7 |
# File 'lib/slidepay/reports/report.rb', line 5 def report_type @report_type end |
#sfa ⇒ Object
Returns the value of attribute sfa.
3 4 5 |
# File 'lib/slidepay/reports/report.rb', line 3 def sfa @sfa end |
#token ⇒ Object
Returns the value of attribute token.
7 8 9 |
# File 'lib/slidepay/reports/report.rb', line 7 def token @token end |
#url ⇒ Object
Returns the value of attribute url.
4 5 6 |
# File 'lib/slidepay/reports/report.rb', line 4 def url @url end |
Instance Method Details
#retrieve(options = {}) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/slidepay/reports/report.rb', line 20 def retrieve(={}) token = @token || [:token] api_key = @api_key || [:api_key] endpoint = @endpoint || [:endpoint] if @report_type == :put response = SlidePay.put(path: @url, data: data_from_sfa, token: token, api_key: api_key, endpoint: endpoint) elsif @report_type == :post response = SlidePay.post(path: @url, data: data_from_sfa, token: token, api_key: api_key, endpoint: endpoint) end if response.was_successful? populate_from_response(response) end end |