Class: WebPay::ChargeRequestRefund

Inherits:
Entity
  • Object
show all
Defined in:
lib/webpay/data_types.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Entity

#normalize_hash, #to_h, #to_s

Constructor Details

#initialize(hash = {}) ⇒ ChargeRequestRefund

Returns a new instance of ChargeRequestRefund.



501
502
503
504
# File 'lib/webpay/data_types.rb', line 501

def initialize(hash = {})
  hash = normalize_hash(hash)
  @attributes = hash
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



482
483
484
# File 'lib/webpay/data_types.rb', line 482

def attributes
  @attributes
end

Class Method Details

.create(params) ⇒ Object



489
490
491
492
493
494
495
496
497
498
499
# File 'lib/webpay/data_types.rb', line 489

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

.fieldsObject



484
485
486
# File 'lib/webpay/data_types.rb', line 484

def self.fields
  ['id', 'amount', 'uuid']
end

Instance Method Details

#amountObject



529
530
531
# File 'lib/webpay/data_types.rb', line 529

def amount
  attributes['amount']
end

#amount=(value) ⇒ Object



533
534
535
# File 'lib/webpay/data_types.rb', line 533

def amount=(value)
  attributes['amount'] = value
end

#idObject

attributes accessors



521
522
523
# File 'lib/webpay/data_types.rb', line 521

def id
  attributes['id']
end

#id=(value) ⇒ Object



525
526
527
# File 'lib/webpay/data_types.rb', line 525

def id=(value)
  attributes['id'] = value
end

#query_paramsObject



514
515
516
517
# File 'lib/webpay/data_types.rb', line 514

def query_params
  result = {}
  return result
end

#request_bodyObject



507
508
509
510
511
512
# File 'lib/webpay/data_types.rb', line 507

def request_body
  result = {}
  copy_if_exists(@attributes, result, 'amount', 'request_body');
  copy_if_exists(@attributes, result, 'uuid', 'request_body');
  result
end

#uuidObject



537
538
539
# File 'lib/webpay/data_types.rb', line 537

def uuid
  attributes['uuid']
end

#uuid=(value) ⇒ Object



541
542
543
# File 'lib/webpay/data_types.rb', line 541

def uuid=(value)
  attributes['uuid'] = value
end