Class: WebPay::CustomerRequestUpdate
- Inherits:
-
Entity
- Object
- Entity
- WebPay::CustomerRequestUpdate
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
Returns a new instance of CustomerRequestUpdate.
1009
1010
1011
1012
1013
|
# File 'lib/webpay/data_types.rb', line 1009
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
#attributes ⇒ Object
Returns the value of attribute attributes.
990
991
992
|
# File 'lib/webpay/data_types.rb', line 990
def attributes
@attributes
end
|
Class Method Details
.create(params) ⇒ Object
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
|
# File 'lib/webpay/data_types.rb', line 997
def self.create(params)
return params if params.is_a?(self)
hash = case params
when Hash; params
when WebPay::CustomerResponse; {'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
|
.fields ⇒ Object
992
993
994
|
# File 'lib/webpay/data_types.rb', line 992
def self.fields
['id', 'card', 'description', 'email']
end
|
Instance Method Details
#card ⇒ Object
1039
1040
1041
|
# File 'lib/webpay/data_types.rb', line 1039
def card
attributes['card']
end
|
#card=(value) ⇒ Object
1043
1044
1045
1046
|
# File 'lib/webpay/data_types.rb', line 1043
def card=(value)
value = value.is_a?(Hash) ? WebPay::CardRequest.new(value) : value
attributes['card'] = value
end
|
#description ⇒ Object
1048
1049
1050
|
# File 'lib/webpay/data_types.rb', line 1048
def description
attributes['description']
end
|
#description=(value) ⇒ Object
1052
1053
1054
|
# File 'lib/webpay/data_types.rb', line 1052
def description=(value)
attributes['description'] = value
end
|
#email ⇒ Object
1056
1057
1058
|
# File 'lib/webpay/data_types.rb', line 1056
def email
attributes['email']
end
|
#email=(value) ⇒ Object
1060
1061
1062
|
# File 'lib/webpay/data_types.rb', line 1060
def email=(value)
attributes['email'] = value
end
|
#id ⇒ Object
1031
1032
1033
|
# File 'lib/webpay/data_types.rb', line 1031
def id
attributes['id']
end
|
#id=(value) ⇒ Object
1035
1036
1037
|
# File 'lib/webpay/data_types.rb', line 1035
def id=(value)
attributes['id'] = value
end
|
#query_params ⇒ Object
1024
1025
1026
1027
|
# File 'lib/webpay/data_types.rb', line 1024
def query_params
result = {}
return result
end
|
#request_body ⇒ Object
1016
1017
1018
1019
1020
1021
1022
|
# File 'lib/webpay/data_types.rb', line 1016
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');
result
end
|