Module: Radiator::Mixins::ActsAsVoter

Included in:
Chain
Defined in:
lib/radiator/mixins/acts_as_voter.rb

Instance Method Summary collapse

Instance Method Details

#vote(weight, *args) ⇒ Object

Create a vote operation.

Examples:

steem = Radiator::Chain.new(chain: :steem, account_name: 'your account name', wif: 'your wif')
steem.vote(10000, 'author', 'permlink')
steem.broadcast!

… or …

steem = Radiator::Chain.new(chain: :steem, account_name: 'your account name', wif: 'your wif')
steem.vote(10000, '@author/permlink')
steem.broadcast!

Parameters:

  • weight (Integer)

    value between -10000 and 10000.

  • args (author, permlink || slug)

    pass either ‘author` and `permlink` or string containing both like `@author/permlink`.



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/radiator/mixins/acts_as_voter.rb', line 20

def vote(weight, *args)
  author, permlink = normalize_author_permlink(args)
  
  @operations << {
    type: :vote,
    voter: ,
    author: author,
    permlink: permlink,
    weight: weight
  }
  
  self
end

#vote!(weight, *args) ⇒ Object

Create a vote operation and broadcasts it right away.

Examples:

steem = Radiator::Chain.new(chain: :steem, account_name: 'your account name', wif: 'your wif')
steem.vote!(10000, 'author', 'permlink')

… or …

steem = Radiator::Chain.new(chain: :steem, account_name: 'your account name', wif: 'your wif')
steem.vote!(10000, '@author/permlink')

See Also:



47
# File 'lib/radiator/mixins/acts_as_voter.rb', line 47

def vote!(weight, *args); vote(weight, *args).broadcast!(true); end