Method: WebPay::ChargeIdRequest.create

Defined in:
lib/webpay/data_types.rb

.create(params) ⇒ Object



442
443
444
445
446
447
448
449
450
451
452
# File 'lib/webpay/data_types.rb', line 442

def self.create(params)
  return params if params.is_a?(self)
  hash = case params
    when Hash; params
    when WebPay::ChargeResponse; {'id' => params.id}
    when String; {'id' => params}
    else
      raise WebPay::InvalidRequestError.new("#{self} does not accept the given value", params)
    end
  self.new(hash)
end