Sha256: bfdb1d3672a5cb3cf2c2829b3a2de56883263fc01db2c72d9f6a4dadbf76a273

Contents?: true

Size: 759 Bytes

Versions: 2

Compression:

Stored size: 759 Bytes

Contents

require 'thor'

module SearchKit
  class Events
    class CLI < Thor
      # An extraction of the CLI command, "complete".
      #
      class Complete
        include Messaging

        attr_reader :client, :id

        def initialize(client, id)
          @client = client
          @id     = id
        end

        def perform
          client.complete(id)

          info "Event #{id} completed"
        rescue Errors::EventNotFound
          warning "No event found for #{id}"
        rescue Faraday::ConnectionFailed
          warning "Remote events service not found"
        rescue JSON::ParserError => error
          warning "Response unreadable: #{error}"
          error.backtrace.each(&method(:warning))
        end

      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
search-kit-0.0.2 lib/search_kit/events/cli/complete.rb
search-kit-0.0.1 lib/search_kit/events/cli/complete.rb