Class: Foxtrot::Client

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

Class Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key, version = 'v1') ⇒ Client

Returns a new instance of Client.



18
19
20
21
22
# File 'lib/foxtrot/client.rb', line 18

def initialize(api_key, version='v1')
  @api_key = api_key
  @version = version
  @headers = {:content_type => :json, :accept => :json}
end

Class Attribute Details

.hostObject

Returns the value of attribute host.



12
13
14
# File 'lib/foxtrot/client.rb', line 12

def host
  @host
end

.sslObject

Returns the value of attribute ssl.



12
13
14
# File 'lib/foxtrot/client.rb', line 12

def ssl
  @ssl
end

Instance Method Details

#optimize!(data, args = {}) ⇒ Object



29
30
31
32
33
# File 'lib/foxtrot/client.rb', line 29

def optimize!(data, args={})
  check_required 'optimize', data
  resp = post_request 'optimize', data, args
  Foxtrot::Response::Response.response_for('optimize', resp, self)
end

#poll!(endpoint, txid, args = {}) ⇒ Object



24
25
26
27
# File 'lib/foxtrot/client.rb', line 24

def poll!(endpoint, txid, args={})
  resp = get_request(endpoint, {txid: txid})
  Foxtrot::Response::Response.response_for(endpoint, resp, self)
end