Sha256: 634d1c0e9d580d084d271b3eb3297b2af424bdefdcf815063ef00f6737606a62

Contents?: true

Size: 601 Bytes

Versions: 2

Compression:

Stored size: 601 Bytes

Contents

# frozen_string_literal: true

require "akashiyaki/client"
require "akashiyaki/errors"

module Akashiyaki
  class Command
    attr_reader :mode, :action, :account

    def initialize(mode, action, account)
      @mode = mode
      @action = action
      @account = account
    end

    def run
      client.send(:"#{action}_#{mode}")
      puts "Succeeded!"
    rescue NotAuthorized => e
      puts "Failed! #{e.message}"
    end

    private

    def client
      @client ||=
        Client.new(
          account.company,
          account.id,
          account.password
        )
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
akashiyaki-0.2.2 lib/akashiyaki/command.rb
akashiyaki-0.2.1 lib/akashiyaki/command.rb