Class: YandexCheckout::Error

Inherits:
Object
  • Object
show all
Extended by:
Dry::Initializer, Callable
Includes:
Optional
Defined in:
lib/yandex-checkout/error.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Callable

call

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class YandexCheckout::Optional

Class Method Details

.build(*res) ⇒ Object



20
21
22
23
# File 'lib/yandex-checkout/error.rb', line 20

def build(*res)
  body = res.last
  new JSON.parse(body.first)
end

.new(opts) ⇒ Object



25
26
27
# File 'lib/yandex-checkout/error.rb', line 25

def new(opts)
  super opts.each_with_object({}) { |(key, val), obj| obj[key.to_sym] = val }
end

Instance Method Details

#error?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/yandex-checkout/error.rb', line 15

def error?
  type == 'error'
end