Sha256: 7d74ff0cf4a25b21d0e8696a5a49446e9df2a272396e84df53f75b3c172b8486

Contents?: true

Size: 811 Bytes

Versions: 8

Compression:

Stored size: 811 Bytes

Contents

require 'ansi'

module SearchKit
  class Messages
    autoload :Messaging, 'search_kit/messages/messaging'

    include Messaging

    def unauthorized
      warning(I18n.t('http.401'))
    end

    def bad_request
      warning(I18n.t('http.400'))
    end

    def not_found(type = 'Resource')
      message = I18n.t('http.404', type: type)
      warning(message)
    end

    def json_parse_error(type = 'Argument')
      message = I18n.t('cli.errors.json_parse', type: type)
      warning(message)
    end

    def no_service
      message = I18n.t('cli.errors.no_service', uri: SearchKit.config.app_uri)
      warning(message)
    end

    def unprocessable
      warning(I18n.t('http.422'))
    end

    def unreadable(error)
      warning(I18n.t('cli.errors.unreadable', error: error))
    end

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
search-kit-0.0.10 lib/search_kit/messages.rb
search-kit-0.0.9 lib/search_kit/messages.rb
search-kit-0.0.8 lib/search_kit/messages.rb
search-kit-0.0.7 lib/search_kit/messages.rb
search-kit-0.0.6 lib/search_kit/messages.rb
search-kit-0.0.5 lib/search_kit/messages.rb
search-kit-0.0.4 lib/search_kit/messages.rb
search-kit-0.0.3 lib/search_kit/messages.rb