Class: Restforce::Bulk::Client
- Inherits:
-
Object
- Object
- Restforce::Bulk::Client
- Defined in:
- lib/restforce/bulk/client.rb
Instance Method Summary collapse
- #connection ⇒ Object
-
#initialize(restforce_client = nil) ⇒ Client
constructor
A new instance of Client.
- #perform_request(method, path, data = nil, content_type = :xml, headers = {}) ⇒ Object
Constructor Details
#initialize(restforce_client = nil) ⇒ Client
Returns a new instance of Client.
4 5 6 |
# File 'lib/restforce/bulk/client.rb', line 4 def initialize(restforce_client=nil) @restforce_client = restforce_client end |
Instance Method Details
#connection ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/restforce/bulk/client.rb', line 8 def connection @connection ||= (@restforce_client || Restforce.new).tap do |client| client.authenticate! client.middleware.insert_after Restforce::Middleware::Authorization, Restforce::Bulk::Middleware::Authorization, client, client. client.middleware.response :xml, content_type: /\bxml$/ client.middleware.use Restforce::Bulk::Middleware::ParseCsv, content_type: /\bcsv$/ end end |
#perform_request(method, path, data = nil, content_type = :xml, headers = {}) ⇒ Object
17 18 19 20 21 |
# File 'lib/restforce/bulk/client.rb', line 17 def perform_request(method, path, data=nil, content_type=:xml, headers={}) result_headers = content_type_header_for(content_type).merge(headers) connection.send(method, [base_path, path].join('/'), data, result_headers) end |