Class: PrexViewService::Transform
- Inherits:
-
Object
- Object
- PrexViewService::Transform
- Defined in:
- lib/PrexView/prex_view_service.rb
Instance Method Summary collapse
-
#initialize(data_string, options = {}) ⇒ Transform
constructor
A new instance of Transform.
- #send_json ⇒ Object
- #send_xml ⇒ Object
Constructor Details
#initialize(data_string, options = {}) ⇒ Transform
Returns a new instance of Transform.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/PrexView/prex_view_service.rb', line 8 def initialize data_string, = {} @data_string = data_string @uri = URI("https://api.prexview.com/v1/transform") @token = .fetch(:token, "#{ENV['PREXVIEW_TOKEN']}") @type = .fetch(:type, nil) @design = .fetch(:design, nil) @output = .fetch(:options, 'pdf') @note = .fetch(:note, '') end |
Instance Method Details
#send_json ⇒ Object
24 25 26 27 |
# File 'lib/PrexView/prex_view_service.rb', line 24 def send_json body = { "json" => JSON.dump(@data_string), "design" => @design, "output" => @output, "note" => @note} _post body end |
#send_xml ⇒ Object
19 20 21 22 |
# File 'lib/PrexView/prex_view_service.rb', line 19 def send_xml body = { "xml" => @data_string, "design" => @design, "output" => @output, "note" => @note} _post body end |