Class: Bloopi::API::OmiseGo

Inherits:
Object
  • Object
show all
Defined in:
lib/bloopi/api/omise_go.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ OmiseGo

Returns a new instance of OmiseGo.



9
10
11
12
13
# File 'lib/bloopi/api/omise_go.rb', line 9

def initialize(attributes)
  @coin_symbol = attributes["coin_symbol"]
  @balance = attributes["balance"]
  @wallet_address = attributes["wallet_address"]
end

Instance Attribute Details

#balanceObject (readonly)

Returns the value of attribute balance.



7
8
9
# File 'lib/bloopi/api/omise_go.rb', line 7

def balance
  @balance
end

#coin_symbolObject (readonly)

Returns the value of attribute coin_symbol.



7
8
9
# File 'lib/bloopi/api/omise_go.rb', line 7

def coin_symbol
  @coin_symbol
end

#transaction_hashObject (readonly)

Returns the value of attribute transaction_hash.



7
8
9
# File 'lib/bloopi/api/omise_go.rb', line 7

def transaction_hash
  @transaction_hash
end

#walletObject (readonly)

Returns the value of attribute wallet.



7
8
9
# File 'lib/bloopi/api/omise_go.rb', line 7

def wallet
  @wallet
end

Class Method Details

.balance(args, options = {}) ⇒ Object

:wallet_address=>“”

Raises:



16
17
18
19
20
21
22
# File 'lib/bloopi/api/omise_go.rb', line 16

def self.balance(args, options = {})
  wallet_address = args[:wallet_address]
  response = Bloopi.make_request("/omg/#{wallet_address}", {}, "get", {:use_ssl => true}.merge!(options))
  raise ServerError.new(response.status, response.body) if response.status >= 500
  raise OAuthTokenRequestError.new(response.status, response.body) if response.status >= 400
  response
end

.transfer(args, options = {}) ⇒ Object

:from_address=>“”, :password=>“”, :quantity=>0.001

Raises:



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/bloopi/api/omise_go.rb', line 25

def self.transfer(args, options = {})
  response = Bloopi.make_request("/omg/send", 
                                 {}.merge!(args),
                                 "post",
                                 {:use_ssl => true,
                                  format: :json}.merge!(options))

  raise ServerError.new(response.status, response.body) if response.status >= 500
  raise OAuthTokenRequestError.new(response.status, response.body) if response.status >= 400
  response
end