Class: RippleRest::Trustlines
- Inherits:
-
Object
- Object
- RippleRest::Trustlines
- Includes:
- Enumerable
- Defined in:
- lib/ripple-rest/helpers.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#add(obj, allow_rippling = true) ⇒ Object
Add trustline.
-
#each(*args, &block) ⇒ Object
Use with Enumerable.
-
#initialize(data) ⇒ Trustlines
constructor
A new instance of Trustlines.
Constructor Details
#initialize(data) ⇒ Trustlines
Returns a new instance of Trustlines.
181 182 183 |
# File 'lib/ripple-rest/helpers.rb', line 181 def initialize data @data = data end |
Instance Attribute Details
#account ⇒ Account
179 180 181 |
# File 'lib/ripple-rest/helpers.rb', line 179 def account @account end |
Instance Method Details
#add(obj, allow_rippling = true) ⇒ Object
Add trustline
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
# File 'lib/ripple-rest/helpers.rb', line 196 def add obj, allow_rippling = true raise ArgumentError.new("Account is missing.") unless account account.require_secret hash = {} hash["allow_rippling"] = allow_rippling hash["secret"] = account.secret if obj.is_a? String hash["trustline"] = { "limit" => obj } else hash["trustline"] = obj.to_hash end RippleRest.post "v1/accounts/#{account.address}/trustlines", hash end |
#each(*args, &block) ⇒ Object
Use with Enumerable
186 187 188 |
# File 'lib/ripple-rest/helpers.rb', line 186 def each *args, &block @data.each *args, &block end |