Class: Cryptohopper::Resources::Templates

Inherits:
Object
  • Object
show all
Defined in:
lib/cryptohopper/resources/template.rb

Overview

‘client.template` — bot templates (reusable hopper configurations).

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Templates

Returns a new instance of Templates.



7
8
9
# File 'lib/cryptohopper/resources/template.rb', line 7

def initialize(client)
  @client = client
end

Instance Method Details

#basic(template_id) ⇒ Object



20
21
22
23
# File 'lib/cryptohopper/resources/template.rb', line 20

def basic(template_id)
  @client._request("GET", "/template/basic",
                   params: { template_id: template_id })
end

#delete(template_id) ⇒ Object



41
42
43
44
# File 'lib/cryptohopper/resources/template.rb', line 41

def delete(template_id)
  @client._request("POST", "/template/delete",
                   body: { template_id: template_id })
end

#get(template_id) ⇒ Object



15
16
17
18
# File 'lib/cryptohopper/resources/template.rb', line 15

def get(template_id)
  @client._request("GET", "/template/get",
                   params: { template_id: template_id })
end

#listObject



11
12
13
# File 'lib/cryptohopper/resources/template.rb', line 11

def list
  @client._request("GET", "/template/templates")
end

#load(template_id, hopper_id) ⇒ Object



34
35
36
37
38
39
# File 'lib/cryptohopper/resources/template.rb', line 34

def load(template_id, hopper_id)
  @client._request(
    "POST", "/template/load",
    body: { template_id: template_id, hopper_id: hopper_id }
  )
end

#save(data) ⇒ Object



25
26
27
# File 'lib/cryptohopper/resources/template.rb', line 25

def save(data)
  @client._request("POST", "/template/save-template", body: data)
end

#update(template_id, data) ⇒ Object



29
30
31
32
# File 'lib/cryptohopper/resources/template.rb', line 29

def update(template_id, data)
  @client._request("POST", "/template/update",
                   body: { template_id: template_id }.merge(data))
end