Class: Trustdock::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/trustdock/client.rb

Constant Summary collapse

PRODUCTION_URL =
"https://api.trustdock.io"
SANDBOX_URL =
"https://api.test.trustdock.io"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_token, sandbox: false) ⇒ Client

Returns a new instance of Client.



8
9
10
11
# File 'lib/trustdock/client.rb', line 8

def initialize(api_token, sandbox: false)
  @api_token = api_token
  @sandbox = sandbox
end

Instance Attribute Details

#last_responseObject (readonly)

Returns the value of attribute last_response.



6
7
8
# File 'lib/trustdock/client.rb', line 6

def last_response
  @last_response
end

Instance Method Details

#create_verification(options = {}) ⇒ Object



19
20
21
22
23
# File 'lib/trustdock/client.rb', line 19

def create_verification(options = {})
  @last_response = request(:post, "/v2/verifications", options)

  Response::Verification.new JSON.parse(@last_response.body, symbolize_names: true)
end

#update_comparing_data(verification_id, options) ⇒ Object



37
38
39
40
41
# File 'lib/trustdock/client.rb', line 37

def update_comparing_data(verification_id, options)
  @last_response = request(:put, "/v2/verifications/#{verification_id}/comparing_data", options)

  nil
end

#update_document(verification_id, plan_id, options) ⇒ Object



31
32
33
34
35
# File 'lib/trustdock/client.rb', line 31

def update_document(verification_id, plan_id, options)
  @last_response = request(:put, "/v2/verifications/#{verification_id}/plans/#{plan_id}/documents", options)

  nil
end

#update_plan(verification_id, options) ⇒ Object



25
26
27
28
29
# File 'lib/trustdock/client.rb', line 25

def update_plan(verification_id, options)
  @last_response = request(:put, "/v2/verifications/#{verification_id}/plans", options)

  nil
end

#verification(id) ⇒ Object



13
14
15
16
17
# File 'lib/trustdock/client.rb', line 13

def verification(id)
  @last_response = request(:get, "/v2/verifications/#{id}")

  Response::Verification.new JSON.parse(@last_response.body, symbolize_names: true)
end