Sha256: 19a86f3f565d132d6b3213cfddb28818855b2a9eae57cfb12f73948e7a334c43

Contents?: true

Size: 1.3 KB

Versions: 1

Compression:

Stored size: 1.3 KB

Contents

require 'hashie'
require 'tankard/api/request/get'
require 'tankard/api/utils/page_finders'

module Tankard
  module Api
    # Access for the /styles route on brewerydb
    #
    # @see http://www.brewerydb.com/developers/docs-endpoint/style_index
    # @author Matthew Shafer
    class Styles
      include Tankard::Api::Request::Get
      include Tankard::Api::Utils::PageFinders
      # @!parse include ::Enumerable

      # @!method each(&block)
      #   Calls the given block once for each style
      #
      #   @yieldparam [Hash] hash containing individual style information
      #   @raise [Tankard::Error::ApiKeyUnauthorized] when an api key is not valid
      #   @raise [Tankard::Error::InvalidResponse] when no data is returned fron the api
      #   @raise [Tankard::Error::HttpError] when a status other than 200 or 401 is returned
      #   @raise [Tankard::Error::LoadError] when multi json is unable to decode json

      # Initializes a new object
      #
      # @param request [Tankard::Request]
      # @return [Tankard::Api::Styles]
      def initialize(request)
        @request = request
      end

      private

        def http_request_uri
          "styles"
        end

        def http_client
          @request
        end

        def http_request_parameters
          {}
        end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tankard-0.1.0 lib/tankard/api/styles.rb