Module: EasyLabs

Defined in:
lib/easylabs/http.rb,
lib/easylabs/util.rb,
lib/easylabs/error.rb,
lib/easylabs/client.rb,
lib/easylabs/api_url.rb,
lib/easylabs/version.rb,
lib/easylabs/webhooks.rb,
lib/easylabs/resources/base.rb,
lib/easylabs/resources/orders.rb,
lib/easylabs/resources/coupons.rb,
lib/easylabs/resources/checkout.rb,
lib/easylabs/resources/disputes.rb,
lib/easylabs/resources/invoices.rb,
lib/easylabs/resources/products.rb,
lib/easylabs/resources/analytics.rb,
lib/easylabs/resources/customers.rb,
lib/easylabs/resources/transfers.rb,
lib/easylabs/resources/settlements.rb,
lib/easylabs/resources/payment_links.rb,
lib/easylabs/resources/subscriptions.rb,
lib/easylabs/resources/authorizations.rb,
lib/easylabs/resources/dunning_config.rb,
lib/easylabs/resources/product_prices.rb,
lib/easylabs/resources/promotion_codes.rb,
lib/easylabs/resources/compliance_forms.rb,
lib/easylabs/resources/embedded_checkout.rb,
lib/easylabs/resources/payment_instruments.rb,
lib/easylabs/resources/webhooks_management.rb,
lib/easylabs/resources/revenue_recovery_automations.rb

Defined Under Namespace

Modules: ApiUrl, Resources, Util, Webhooks Classes: AuthenticationError, Client, ConflictError, Error, HTTP, InvalidRequestError, NotFoundError, PermissionError, RateLimitError, ServerError

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.error_class_for(status) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Maps an HTTP status to the most specific error subclass.



45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/easylabs/error.rb', line 45

def self.error_class_for(status)
  case status
  when 400, 422 then InvalidRequestError
  when 401 then AuthenticationError
  when 403 then PermissionError
  when 404 then NotFoundError
  when 409 then ConflictError
  when 429 then RateLimitError
  when 500..599 then ServerError
  else Error
  end
end