Class: RippleRest::Account

Inherits:
Object
  • Object
show all
Defined in:
lib/ripple-rest/helpers.rb

Instance Attribute Summary collapse

Private APIs collapse

Instance Method Summary collapse

Constructor Details

#initialize(address, secret = nil) ⇒ Account

Returns a new instance of Account.



11
12
13
14
# File 'lib/ripple-rest/helpers.rb', line 11

def initialize address, secret = nil
  @address = address
  @secret = secret
end

Instance Attribute Details

#addressString

Account’s Address (rXXXXXX…)

Returns:

  • (String)


5
6
7
# File 'lib/ripple-rest/helpers.rb', line 5

def address
  @address
end

#secretString

Account’s secret

Returns:

  • (String)


9
10
11
# File 'lib/ripple-rest/helpers.rb', line 9

def secret
  @secret
end

Instance Method Details

#balancesArray<Balance>

Get an account’s existing balances. This includes XRP balance (which does not include a counterparty) and trustline balances.

Returns:

Raises:



21
22
23
24
25
# File 'lib/ripple-rest/helpers.rb', line 21

def balances
  RippleRest
    .get("v1/accounts/#{@address}/balances")["balances"]
    .map(&Balance.method(:new))
end

#notificationsNotifications

Returns a Notifications object for this account.

Returns:



53
54
55
56
57
58
59
# File 'lib/ripple-rest/helpers.rb', line 53

def notifications
  @notifications ||= lambda {
    obj = Notifications.new
    obj. = self
    obj
  }.call
end

#paymentsPayments

Returns a Payments object for this account.

Returns:



63
64
65
66
67
68
69
# File 'lib/ripple-rest/helpers.rb', line 63

def payments
  payments ||= lambda {
    obj = Payments.new
    obj. = self
    obj
  }.call
end

#require_secretObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Raises:

  • (ArgumentError)


79
80
81
# File 'lib/ripple-rest/helpers.rb', line 79

def require_secret
  raise ArgumentError.new("Secret is required for this operation.") unless secret
end

#settingsAccountSettings

Returns a AccountSettings object for this account.

Returns:

Raises:



44
45
46
47
48
49
# File 'lib/ripple-rest/helpers.rb', line 44

def settings
  data = RippleRest.get("v1/accounts/#{@address}/settings")["settings"]
  obj = AccountSettings.new data
  obj. = self
  obj
end

#to_sString

Returns the address of attribute address.

Returns:

  • (String)


73
74
75
# File 'lib/ripple-rest/helpers.rb', line 73

def to_s
  address
end

#trustlinesTrustlines

Returns a Trustlines object for this account.

Returns:

Raises:



31
32
33
34
35
36
37
38
# File 'lib/ripple-rest/helpers.rb', line 31

def trustlines
  data = RippleRest
    .get("v1/accounts/#{@address}/trustlines")["trustlines"]
    .map(&Trustline.method(:new))
  obj = Trustlines.new data
  obj. = self
  obj
end