Sha256: 185f455b24ab8066090ac23a7142c6ac6cbc09a38f69149f2fb02efca9e23acc
Contents?: true
Size: 671 Bytes
Versions: 1
Compression:
Stored size: 671 Bytes
Contents
# frozen_string_literal: true module Yookassa class Error extend Dry::Initializer extend Yookassa::Callable include Yookassa::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 |
---|---|
yookassa-0.1.0 | lib/yookassa/error.rb |