Class: WebPay::CustomerRequestCreate

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 = {}) ⇒ CustomerRequestCreate

Returns a new instance of CustomerRequestCreate.



820
821
822
823
824
# File 'lib/webpay/data_types.rb', line 820

def initialize(hash = {})
  hash = normalize_hash(hash)
  hash['card'] = hash['card'].is_a?(Hash) ? WebPay::CardRequest.new(hash['card']) : hash['card']
  @attributes = hash
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



803
804
805
# File 'lib/webpay/data_types.rb', line 803

def attributes
  @attributes
end

Class Method Details

.create(params) ⇒ Object



810
811
812
813
814
815
816
817
818
# File 'lib/webpay/data_types.rb', line 810

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

.fieldsObject



805
806
807
# File 'lib/webpay/data_types.rb', line 805

def self.fields
  ['card', 'description', 'email', 'uuid']
end

Instance Method Details

#cardObject

attributes accessors



843
844
845
# File 'lib/webpay/data_types.rb', line 843

def card
  attributes['card']
end

#card=(value) ⇒ Object



847
848
849
850
# File 'lib/webpay/data_types.rb', line 847

def card=(value)
  value = value.is_a?(Hash) ? WebPay::CardRequest.new(value) : value
  attributes['card'] = value
end

#descriptionObject



852
853
854
# File 'lib/webpay/data_types.rb', line 852

def description
  attributes['description']
end

#description=(value) ⇒ Object



856
857
858
# File 'lib/webpay/data_types.rb', line 856

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

#emailObject



860
861
862
# File 'lib/webpay/data_types.rb', line 860

def email
  attributes['email']
end

#email=(value) ⇒ Object



864
865
866
# File 'lib/webpay/data_types.rb', line 864

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

#query_paramsObject



836
837
838
839
# File 'lib/webpay/data_types.rb', line 836

def query_params
  result = {}
  return result
end

#request_bodyObject



827
828
829
830
831
832
833
834
# File 'lib/webpay/data_types.rb', line 827

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

#uuidObject



868
869
870
# File 'lib/webpay/data_types.rb', line 868

def uuid
  attributes['uuid']
end

#uuid=(value) ⇒ Object



872
873
874
# File 'lib/webpay/data_types.rb', line 872

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