Module: MetMuseum
- Defined in:
- lib/met_museum.rb,
lib/met_museum/version.rb,
lib/met_museum/endpoint.rb,
lib/met_museum/collection.rb,
lib/met_museum/api_expections.rb,
lib/met_museum/http_status_code.rb
Defined Under Namespace
Classes: Collection
Constant Summary collapse
- VERSION =
"1.4.2".freeze
- API_ENDPOINT =
"https://collectionapi.metmuseum.org".freeze
- PUBLIC_URI =
"/public/collection/v1/objects".freeze
- SEARCH_URI =
"/public/collection/v1/search".freeze
- DEPARTMENTS_URI =
"/public/collection/v1/departments".freeze
- MetMuseumError =
Class.new(StandardError)
- BadRequestError =
Class.new(MetMuseumError)
Class.new(MetMuseumError)
- ForbiddenError =
Class.new(MetMuseumError)
- NotFoundError =
Class.new(MetMuseumError)
- UnprocessableEntityError =
Class.new(MetMuseumError)
- ApiError =
Class.new(MetMuseumError)
- TypeError =
Class.new(MetMuseumError)
- HTTP_OK_CODE =
200
- HTTP_BAD_REQUEST_CODE =
400
- HTTP_UNAUTHORIZED_CODE =
401
- HTTP_FORBIDDEN_CODE =
403
- HTTP_NOT_FOUND_CODE =
404
- HTTP_UNPROCESSABLE_ENTITY_CODE =
429
Class Method Summary collapse
Class Method Details
.error_class(response_code) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/met_museum/http_status_code.rb', line 11 def self.error_class(response_code) case response_code when HTTP_BAD_REQUEST_CODE BadRequestError when HTTP_UNAUTHORIZED_CODE UnauthorizedError when HTTP_FORBIDDEN_CODE ForbiddenError when HTTP_NOT_FOUND_CODE NotFoundError when HTTP_UNPROCESSABLE_ENTITY_CODE UnprocessableEntityError else ApiError end end |