Class: GlobalSign::Client
- Inherits:
-
Object
- Object
- GlobalSign::Client
- Defined in:
- lib/global_sign/client.rb
Instance Method Summary collapse
- #find_response_class_for(request) ⇒ Object
-
#initialize(options: {}) ⇒ Client
constructor
A new instance of Client.
- #process(request) ⇒ Object
Constructor Details
#initialize(options: {}) ⇒ Client
Returns a new instance of Client.
5 6 7 8 9 10 11 12 13 |
# File 'lib/global_sign/client.rb', line 5 def initialize(options: {}) @configuration = GlobalSign.configuration @connection = Faraday::Connection.new(url: @configuration.endpoint) do |conn| conn.request :url_encoded conn.adapter Faraday.default_adapter conn.[:timeout] = [:timeout] if [:timeout].present? end end |
Instance Method Details
#find_response_class_for(request) ⇒ Object
#process(request) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/global_sign/client.rb', line 15 def process(request) response_class = find_response_class_for(request) response = @connection.post do |req| req.url request.path req.headers['Content-Type'] = 'text/xml' req.body = request.to_xml end response_class.new(response.body) end |