Class: Axie::Account

Inherits:
Object show all
Defined in:
lib/axie/objects/account.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Object

#method_missing, #respond_to_missing?

Constructor Details

#initialize(data:, total:) ⇒ Account

Returns a new instance of Account.



13
14
15
16
# File 'lib/axie/objects/account.rb', line 13

def initialize(data:, total:)
  @data = data
  @total = total
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Axie::Object

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



3
4
5
# File 'lib/axie/objects/account.rb', line 3

def data
  @data
end

#totalObject (readonly)

Returns the value of attribute total.



3
4
5
# File 'lib/axie/objects/account.rb', line 3

def total
  @total
end

Class Method Details

.from_response(response) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/axie/objects/account.rb', line 5

def self.from_response(response)
  body = response.body
  new(
    data: body,
    total: body.dig("total")
  )
end

Instance Method Details

#get_slp_balanceObject



18
19
20
# File 'lib/axie/objects/account.rb', line 18

def get_slp_balance
  total
end