Class: Flashboy::Client

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

Direct Known Subclasses

Exchange

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.docs(docs = nil) ⇒ Object



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

def self.docs(docs = nil)
  return @docs if docs.nil?
  @docs = docs
end

.host(host = nil) ⇒ Object



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

def self.host(host = nil)
  return @host if host.nil?
  @host = host
end

.keyObject



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

def self.key
  @name.to_s.downcase.gsub(' ', '_').to_sym
end

.name(name = nil) ⇒ Object



3
4
5
6
# File 'lib/flashboy/client.rb', line 3

def self.name(name = nil)
  return @name if name.nil?
  @name = name
end

.order_book_path(pair = nil, &path) ⇒ Object



60
61
62
63
# File 'lib/flashboy/client.rb', line 60

def self.order_book_path(pair = nil, &path)
  return @order_book_path.call(pair) unless block_given?
  @order_book_path = path
end

.quote_path(pair = nil, &path) ⇒ Object



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

def self.quote_path(pair = nil, &path)
  return @quote_path.call(pair) unless block_given?
  @quote_path = path
end

.trades_path(pair = nil, params = {}, &path) ⇒ Object



47
48
49
50
51
52
53
54
# File 'lib/flashboy/client.rb', line 47

def self.trades_path(pair = nil, params = {}, &path)
  if !block_given?
    raise RuntimeError, "You must define the trades_path on your exchange" if @trades_path.nil?
    return @trades_path.call(pair, params)
  end

  @trades_path = path
end

Instance Method Details

#docsObject



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

def docs
  self.class.docs
end

#hostObject



34
35
36
# File 'lib/flashboy/client.rb', line 34

def host
  self.class.host
end

#keyObject



16
17
18
# File 'lib/flashboy/client.rb', line 16

def key
  self.class.key
end

#nameObject



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

def name
  self.class.name
end

#order_book_path(pair) ⇒ Object



65
66
67
# File 'lib/flashboy/client.rb', line 65

def order_book_path(pair)
  self.class.order_book_path(pair)
end

#quote_path(pair) ⇒ Object



43
44
45
# File 'lib/flashboy/client.rb', line 43

def quote_path(pair)
  self.class.quote_path(pair)
end

#trades_path(pair, params = {}) ⇒ Object



56
57
58
# File 'lib/flashboy/client.rb', line 56

def trades_path(pair, params = {})
  self.class.trades_path(pair, params)
end