Class: Velocify::GetReportResultsPayload
- Inherits:
-
Object
- Object
- Velocify::GetReportResultsPayload
- Includes:
- ERB::Util
- Defined in:
- lib/velocify/payload.rb
Instance Method Summary collapse
-
#authenticate(username:, password:) ⇒ Hash
Stores credentials for making an authenticated request.
-
#initialize(report_id, filter_items) ⇒ GetReportResultsPayload
constructor
A new instance of GetReportResultsPayload.
-
#render ⇒ String
The XML payload to send to Velocify’s GetReportResults operation.
Constructor Details
#initialize(report_id, filter_items) ⇒ GetReportResultsPayload
Returns a new instance of GetReportResultsPayload.
52 53 54 55 56 |
# File 'lib/velocify/payload.rb', line 52 def initialize report_id, filter_items @filter_items = filter_items @report_id = report_id @credentials = {} end |
Instance Method Details
#authenticate(username:, password:) ⇒ Hash
Stores credentials for making an authenticated request
63 64 65 |
# File 'lib/velocify/payload.rb', line 63 def authenticate username:, password: @credentials = Hash[:username, username, :password, password] end |
#render ⇒ String
Returns The XML payload to send to Velocify’s GetReportResults operation.
68 69 70 71 72 73 74 75 |
# File 'lib/velocify/payload.rb', line 68 def render relative_path = File.join '..', '..', 'templates', 'get_report_results.xml.erb' current_dir = File.dirname(__FILE__) path = File. relative_path, current_dir template = File.read(path) xml_str = ERB.new(template).result binding { xml: xml_str.gsub(/[\n\t]*/, '').gsub(/[ ]{2,}/, '') } end |