class Balboa::Interactor::InteractorBuilder

Public Class Methods

create(*args) click to toggle source
# File lib/balboa/interactor/interactor_builder.rb, line 12
def self.create(*args)
  new(*args).create
end
new(options) click to toggle source
# File lib/balboa/interactor/interactor_builder.rb, line 16
def initialize(options)
  @options = options
  @interactor = CapybaraInteractor.new(options)
end

Public Instance Methods

create() click to toggle source
# File lib/balboa/interactor/interactor_builder.rb, line 21
def create
  last_punch = Command::FetchLastPunchCommand.new

  @interactor.tap do |itr|
    itr.add_command(:punch, fill_punch)
    itr.add_command(:last, last_punch)
    itr.add_command(:login, login)
  end
end

Private Instance Methods

fill_punch() click to toggle source
# File lib/balboa/interactor/interactor_builder.rb, line 40
def fill_punch
  Command::FillPunchCommand.new(schedule, @options['project'])
end
login() click to toggle source
# File lib/balboa/interactor/interactor_builder.rb, line 44
def login
  Command::LoginCommand.new(@options['email'], @options['password'])
end
schedule() click to toggle source
# File lib/balboa/interactor/interactor_builder.rb, line 33
def schedule
  Balboa::Schedule.new(@options['start_at'],
                       @options['lunch_at'],
                       @options['restart_at'],
                       @options['leave_at'])
end