Sha256: a539d88d08268196bee13db6c0cce652a4a4a6ce527b5c0812e9655156c16e23

Contents?: true

Size: 660 Bytes

Versions: 4

Compression:

Stored size: 660 Bytes

Contents

require 'garoon-cat/action'

class GaroonCat::Service

  # @return [GaroonCat::Client]
  attr_reader :client

  # @return [String]
  attr_reader :name

  # @return [URI]
  attr_reader :uri

  # @param client [GaroonCat::Client]
  # @param name [String]
  # @param uri [URI]
  def initialize(client:, name:, uri:)
    @client = client
    @name = name
    @uri = uri
  end

  private

  # @param key [Symbol] the key of an action.
  # @return [GaroonCat::Action #execute]
  def action(key)
    @actions ||= {}
    @actions[key] ||= GaroonCat::Action.create(service:self, key:key)
  end

  def method_missing(key, *args)
    action(key).execute(args)
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
garoon-cat-0.3.0 lib/garoon-cat/service.rb
garoon-cat-0.2.1 lib/garoon-cat/service.rb
garoon-cat-0.2.0 lib/garoon-cat/service.rb
garoon-cat-0.1.0 lib/garoon-cat/service.rb