Class: Blupee::API::Token
- Inherits:
-
Object
- Object
- Blupee::API::Token
- Defined in:
- lib/blupee/api/token.rb
Instance Attribute Summary collapse
-
#balance ⇒ Object
readonly
Returns the value of attribute balance.
-
#coin_symbol ⇒ Object
readonly
Returns the value of attribute coin_symbol.
-
#transaction_hash ⇒ Object
readonly
Returns the value of attribute transaction_hash.
-
#wallet ⇒ Object
readonly
Returns the value of attribute wallet.
Class Method Summary collapse
-
.balance(args, options = {}) ⇒ Object
:wallet_address=>“”.
-
.transfer(args, options = {}) ⇒ Object
:from_address=>“”, :password=>“”, :quantity=>0.001, :contract_address=>“”.
Instance Method Summary collapse
-
#initialize(attributes) ⇒ Token
constructor
A new instance of Token.
Constructor Details
#initialize(attributes) ⇒ Token
Returns a new instance of Token.
9 10 11 12 13 |
# File 'lib/blupee/api/token.rb', line 9 def initialize(attributes) @coin_symbol = attributes["coin_symbol"] @balance = attributes["balance"] @wallet_address = attributes["wallet_address"] end |
Instance Attribute Details
#balance ⇒ Object (readonly)
Returns the value of attribute balance.
7 8 9 |
# File 'lib/blupee/api/token.rb', line 7 def balance @balance end |
#coin_symbol ⇒ Object (readonly)
Returns the value of attribute coin_symbol.
7 8 9 |
# File 'lib/blupee/api/token.rb', line 7 def coin_symbol @coin_symbol end |
#transaction_hash ⇒ Object (readonly)
Returns the value of attribute transaction_hash.
7 8 9 |
# File 'lib/blupee/api/token.rb', line 7 def transaction_hash @transaction_hash end |
#wallet ⇒ Object (readonly)
Returns the value of attribute wallet.
7 8 9 |
# File 'lib/blupee/api/token.rb', line 7 def wallet @wallet end |
Class Method Details
.balance(args, options = {}) ⇒ Object
:wallet_address=>“”
16 17 18 19 20 21 22 23 |
# File 'lib/blupee/api/token.rb', line 16 def self.balance(args, = {}) contract_id = args[:contract_id] wallet_address = args[:wallet_address] response = Blupee.make_request("/token/#{contract_id}/#{wallet_address}", {}, "get", {:use_ssl => true}.merge!()) 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, :contract_address=>“”
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/blupee/api/token.rb', line 26 def self.transfer(args, = {}) response = Blupee.make_request("/token/send", {}.merge!(args), "post", {:use_ssl => true, format: :json}.merge!()) raise ServerError.new(response.status, response.body) if response.status >= 500 raise OAuthTokenRequestError.new(response.status, response.body) if response.status >= 400 response end |