class Rushover::Cli::Rush

This class is accessing helper methods used in the bin file.

Public Instance Methods

add_key(key_symbol, key_value) click to toggle source

@param key_symbol [Symbol] symbol to add @param key_value [String] value to assign to key_symbol @return [Psych::Store] updated YAML Store @since 0.0.2 @note Currently not used by rushover-cli @todo Add ability to set :user and :rush keys

# File lib/rushover/cli.rb, line 76
def add_key(key_symbol, key_value)
  store = config
  store.transaction do
    store[key_symbol] = key_value
  end
end
client(app_token) click to toggle source

@!group Rushover objects @param app_token [String] @return [Rushover::Client] Client object to be used in notify @see notify @since 0.0.2

# File lib/rushover/cli.rb, line 22
def client(app_token)
  Rushover::Client.new(app_token)
end
config() click to toggle source

@return [Psych::Store] YAML Store consisting of a :user and :rush keys @since 0.0.2

# File lib/rushover/cli.rb, line 54
def config
  YAML::Store.new(rc_file)
end
get_key(key_symbol) click to toggle source

@!group Key management @param key_symbol [Symbol] symbol to fetch @return [String] value of fetched key @since 0.0.2

# File lib/rushover/cli.rb, line 63
def get_key(key_symbol)
  store = config
  store.transaction do
    store.fetch(key_symbol)
  end
end
notify(user) click to toggle source

@param user [Rushover::User] @return [Hash] response from Pushover @since 0.0.2 @see user @see client

# File lib/rushover/cli.rb, line 41
def notify(user)
  user.notify(message, title: opts[:title])
end
rc_file() click to toggle source

@!group Configuration management @return [Pathname] location of .rushrc file @since 0.0.2

# File lib/rushover/cli.rb, line 48
def rc_file
  Pathname.new("#{ENV['HOME']}/.rushrc")
end
user(user_key, client) click to toggle source

@param user_key [String] @param client [Rushover::Client] @return [Rushover::User] User object to be used in notify @see notify @since 0.0.2

# File lib/rushover/cli.rb, line 31
def user(user_key, client)
  Rushover::User.new(user_key, client)
end
version() click to toggle source

@!group Miscellaneous @return [String] version number of `rushover-cli` as a String @since 0.0.2

# File lib/rushover/cli.rb, line 87
def version
  Rushover::Cli::VERSION
end