Sha256: 558202aa04a4ccd349489ef248e310efe222db90db3c8709f129d04ba55a6af7

Contents?: true

Size: 420 Bytes

Versions: 1

Compression:

Stored size: 420 Bytes

Contents

# frozen_string_literal: true

module Yookassa
  class Response
    extend Dry::Initializer
    option :id, proc(&:to_s)
    option :status, proc(&:to_s), default: proc { nil }

    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/response.rb