class Esignatur::APIClient
Public Class Methods
new(headers)
click to toggle source
# File lib/ruby/api/esignatur/esignatur_client.rb, line 10 def initialize(headers) @headers = headers @connection = set_connection end
Public Instance Methods
create_order(options = {})
click to toggle source
# File lib/ruby/api/esignatur/esignatur_client.rb, line 15 def create_order options = {} response = @connection.post do |req| req.url URI.encode('/Order/Create') req.headers.merge!(@headers) req.body = options.to_json end JSON.parse(response.body) end
get_document(options = {})
click to toggle source
# File lib/ruby/api/esignatur/esignatur_client.rb, line 42 def get_document options = {} response = @connection.post do |req| req.url URI.encode('/Pades/Download') req.headers.merge!(@headers) req.body = options.to_json end JSON.parse(response.body) end
order_status(email, order_no)
click to toggle source
# File lib/ruby/api/esignatur/esignatur_client.rb, line 33 def order_status email, order_no response = @connection.get do |req| req.url URI.encode('/Status/Get/{'+order_no+'}') req.headers.merge!(@headers) req.body = {Email: email}.to_json end JSON.parse(response.body) end
pending_orders(email)
click to toggle source
# File lib/ruby/api/esignatur/esignatur_client.rb, line 24 def pending_orders email response = @connection.post do |req| req.url '/Order/Pending' req.headers.merge!(@headers) req.body = {Email: email}.to_json end JSON.parse(response.body) end
validate_document(options = {})
click to toggle source
# File lib/ruby/api/esignatur/esignatur_client.rb, line 51 def validate_document options = {} response = @connection.post do |req| req.url URI.encode('/PdfValidator/Validate') req.headers.merge!(@headers) req.body = options.to_json end JSON.parse(response.body) end
Private Instance Methods
set_connection()
click to toggle source
# File lib/ruby/api/esignatur/esignatur_client.rb, line 65 def set_connection Faraday.new(:url => API_URL) do |faraday| faraday.request :url_encoded faraday.response :logger faraday.adapter Faraday.default_adapter end end