Sha256: 7455d15fc39ddeda0bb8d2e80f4f670a664b5ca0bdf0f22b0c50a2c9fc1ff49a
Contents?: true
Size: 689 Bytes
Versions: 1
Compression:
Stored size: 689 Bytes
Contents
# frozen_string_literal: true module YandexCheckout class Error extend Dry::Initializer extend YandexCheckout::Callable include YandexCheckout::Optional option :type, proc(&:to_s) option :id, proc(&:to_s), optional: true option :code, proc(&:to_s), optional: true option :description, proc(&:to_s), optional: true option :parameter, proc(&:to_s), optional: true def error? type == 'error' end class << self def build(*res) body = res.last new JSON.parse(body.first) end def new(opts) super opts.each_with_object({}) { |(key, val), obj| obj[key.to_sym] = val } end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
yandex-checkout-0.1.1 | lib/yandex-checkout/error.rb |