Sha256: 9002c1cb76aa13463d5f43fa98aeebfe86cff9c50b6e4d62ff3ebeb608452a73

Contents?: true

Size: 592 Bytes

Versions: 5

Compression:

Stored size: 592 Bytes

Contents

module Fizzy
  module Api
    module Endpoints
      class Endpoint < ActiveInteraction::Base
        protected

        def process_response(response)
          case response.code
          when 200
            response
          else
            invalid_response(response)
          end
        end

        def invalid_response(response)
          raise Errors::UnexpectedStatusError, "Status code #{response.code} not expected."
        end

        def select_measurement_text(response, default_message)
          response.body || default_message
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fizzy-api-0.1.4 lib/fizzy/api/endpoints/endpoint.rb
fizzy-api-0.1.3 lib/fizzy/api/endpoints/endpoint.rb
fizzy-api-0.1.2 lib/fizzy/api/endpoints/endpoint.rb
fizzy-api-0.1.1 lib/fizzy/api/endpoints/endpoint.rb
fizzy-api-0.1.0 lib/fizzy/api/endpoints/endpoint.rb