Class: Bitcoin::Currency
- Inherits:
-
Object
- Object
- Bitcoin::Currency
- Defined in:
- lib/bitcoin/currency.rb
Instance Attribute Summary collapse
-
#crypto ⇒ Object
Returns the value of attribute crypto.
-
#delisted ⇒ Object
Returns the value of attribute delisted.
-
#fullName ⇒ Object
Returns the value of attribute fullName.
-
#id ⇒ Object
Returns the value of attribute id.
-
#payinConfirmations ⇒ Object
Returns the value of attribute payinConfirmations.
-
#payinEnabled ⇒ Object
Returns the value of attribute payinEnabled.
-
#payinPaymentId ⇒ Object
Returns the value of attribute payinPaymentId.
-
#payoutEnabled ⇒ Object
Returns the value of attribute payoutEnabled.
-
#payoutFee ⇒ Object
Returns the value of attribute payoutFee.
-
#payoutIsPaymentId ⇒ Object
Returns the value of attribute payoutIsPaymentId.
-
#transferEnabled ⇒ Object
Returns the value of attribute transferEnabled.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#crypto ⇒ Object
Returns the value of attribute crypto.
3 4 5 |
# File 'lib/bitcoin/currency.rb', line 3 def crypto @crypto end |
#delisted ⇒ Object
Returns the value of attribute delisted.
3 4 5 |
# File 'lib/bitcoin/currency.rb', line 3 def delisted @delisted end |
#fullName ⇒ Object
Returns the value of attribute fullName.
3 4 5 |
# File 'lib/bitcoin/currency.rb', line 3 def fullName @fullName end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/bitcoin/currency.rb', line 3 def id @id end |
#payinConfirmations ⇒ Object
Returns the value of attribute payinConfirmations.
3 4 5 |
# File 'lib/bitcoin/currency.rb', line 3 def @payinConfirmations end |
#payinEnabled ⇒ Object
Returns the value of attribute payinEnabled.
3 4 5 |
# File 'lib/bitcoin/currency.rb', line 3 def @payinEnabled end |
#payinPaymentId ⇒ Object
Returns the value of attribute payinPaymentId.
3 4 5 |
# File 'lib/bitcoin/currency.rb', line 3 def @payinPaymentId end |
#payoutEnabled ⇒ Object
Returns the value of attribute payoutEnabled.
3 4 5 |
# File 'lib/bitcoin/currency.rb', line 3 def payoutEnabled @payoutEnabled end |
#payoutFee ⇒ Object
Returns the value of attribute payoutFee.
3 4 5 |
# File 'lib/bitcoin/currency.rb', line 3 def payoutFee @payoutFee end |
#payoutIsPaymentId ⇒ Object
Returns the value of attribute payoutIsPaymentId.
3 4 5 |
# File 'lib/bitcoin/currency.rb', line 3 def payoutIsPaymentId @payoutIsPaymentId end |
#transferEnabled ⇒ Object
Returns the value of attribute transferEnabled.
3 4 5 |
# File 'lib/bitcoin/currency.rb', line 3 def transferEnabled @transferEnabled end |
Class Method Details
.all ⇒ Object
7 8 9 10 11 12 |
# File 'lib/bitcoin/currency.rb', line 7 def self.all data = JSON.parse(RestClient.get("#{Bitcoin::BASE}/public/currency")) data.map{ |currency| Bitcoin::Currency.new_from_object(currency) } end |
.new_from_currency_name(name) ⇒ Object
14 15 16 17 |
# File 'lib/bitcoin/currency.rb', line 14 def self.new_from_currency_name(name) data = JSON.parse(RestClient.get("#{Bitcoin::BASE}/public/currency/#{name}")) Bitcoin::Currency.new_from_object(data) end |
.new_from_object(data) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/bitcoin/currency.rb', line 19 def self.new_from_object(data) c = Bitcoin::Currency.new c.id = data['id'] c.fullName = data['fullName'] c.crypto = data['crypto'] c.payoutFee = data['payoutFee'] c.payoutFee = c.payoutFee.to_f / 100 if c.id == 'USD' c end |
Instance Method Details
#display_details ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/bitcoin/currency.rb', line 29 def display_details puts <<-DOC #{@id} (#{@fullName}) Cryptocurrency?: #{@crypto.to_s} Delisted?: #{@delisted.to_s} Pay-Out Fee: #{@payoutFee} #{@id} DOC end |