Class: WebPay::ChargeRequestCreate
- Defined in:
- lib/webpay/data_types.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Class Method Summary collapse
Instance Method Summary collapse
-
#amount ⇒ Object
attributes accessors.
- #amount=(value) ⇒ Object
- #capture ⇒ Object
- #capture=(value) ⇒ Object
- #card ⇒ Object
- #card=(value) ⇒ Object
- #currency ⇒ Object
- #currency=(value) ⇒ Object
- #customer ⇒ Object
- #customer=(value) ⇒ Object
- #description ⇒ Object
- #description=(value) ⇒ Object
- #expire_days ⇒ Object
- #expire_days=(value) ⇒ Object
-
#initialize(hash = {}) ⇒ ChargeRequestCreate
constructor
A new instance of ChargeRequestCreate.
- #query_params ⇒ Object
- #request_body ⇒ Object
- #shop ⇒ Object
- #shop=(value) ⇒ Object
- #uuid ⇒ Object
- #uuid=(value) ⇒ Object
Methods inherited from Entity
Constructor Details
#initialize(hash = {}) ⇒ ChargeRequestCreate
Returns a new instance of ChargeRequestCreate.
147 148 149 150 151 |
# File 'lib/webpay/data_types.rb', line 147 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 (readonly)
Returns the value of attribute attributes.
130 131 132 |
# File 'lib/webpay/data_types.rb', line 130 def attributes @attributes end |
Class Method Details
.create(params) ⇒ Object
137 138 139 140 141 142 143 144 145 |
# File 'lib/webpay/data_types.rb', line 137 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 |
.fields ⇒ Object
132 133 134 |
# File 'lib/webpay/data_types.rb', line 132 def self.fields ['amount', 'currency', 'customer', 'shop', 'card', 'description', 'capture', 'expire_days', 'uuid'] end |
Instance Method Details
#amount ⇒ Object
attributes accessors
175 176 177 |
# File 'lib/webpay/data_types.rb', line 175 def amount attributes['amount'] end |
#amount=(value) ⇒ Object
179 180 181 |
# File 'lib/webpay/data_types.rb', line 179 def amount=(value) attributes['amount'] = value end |
#capture ⇒ Object
224 225 226 |
# File 'lib/webpay/data_types.rb', line 224 def capture attributes['capture'] end |
#capture=(value) ⇒ Object
228 229 230 |
# File 'lib/webpay/data_types.rb', line 228 def capture=(value) attributes['capture'] = value end |
#card ⇒ Object
207 208 209 |
# File 'lib/webpay/data_types.rb', line 207 def card attributes['card'] end |
#card=(value) ⇒ Object
211 212 213 214 |
# File 'lib/webpay/data_types.rb', line 211 def card=(value) value = value.is_a?(Hash) ? WebPay::CardRequest.new(value) : value attributes['card'] = value end |
#currency ⇒ Object
183 184 185 |
# File 'lib/webpay/data_types.rb', line 183 def currency attributes['currency'] end |
#currency=(value) ⇒ Object
187 188 189 |
# File 'lib/webpay/data_types.rb', line 187 def currency=(value) attributes['currency'] = value end |
#customer ⇒ Object
191 192 193 |
# File 'lib/webpay/data_types.rb', line 191 def customer attributes['customer'] end |
#customer=(value) ⇒ Object
195 196 197 |
# File 'lib/webpay/data_types.rb', line 195 def customer=(value) attributes['customer'] = value end |
#description ⇒ Object
216 217 218 |
# File 'lib/webpay/data_types.rb', line 216 def description attributes['description'] end |
#description=(value) ⇒ Object
220 221 222 |
# File 'lib/webpay/data_types.rb', line 220 def description=(value) attributes['description'] = value end |
#expire_days ⇒ Object
232 233 234 |
# File 'lib/webpay/data_types.rb', line 232 def expire_days attributes['expire_days'] end |
#expire_days=(value) ⇒ Object
236 237 238 |
# File 'lib/webpay/data_types.rb', line 236 def expire_days=(value) attributes['expire_days'] = value end |
#query_params ⇒ Object
168 169 170 171 |
# File 'lib/webpay/data_types.rb', line 168 def query_params result = {} return result end |
#request_body ⇒ Object
154 155 156 157 158 159 160 161 162 163 164 165 166 |
# File 'lib/webpay/data_types.rb', line 154 def request_body result = {} copy_if_exists(@attributes, result, 'amount', 'request_body'); copy_if_exists(@attributes, result, 'currency', 'request_body'); copy_if_exists(@attributes, result, 'customer', 'request_body'); copy_if_exists(@attributes, result, 'shop', 'request_body'); copy_if_exists(@attributes, result, 'card', 'request_body'); copy_if_exists(@attributes, result, 'description', 'request_body'); copy_if_exists(@attributes, result, 'capture', 'request_body'); copy_if_exists(@attributes, result, 'expire_days', 'request_body'); copy_if_exists(@attributes, result, 'uuid', 'request_body'); result end |
#shop ⇒ Object
199 200 201 |
# File 'lib/webpay/data_types.rb', line 199 def shop attributes['shop'] end |
#shop=(value) ⇒ Object
203 204 205 |
# File 'lib/webpay/data_types.rb', line 203 def shop=(value) attributes['shop'] = value end |
#uuid ⇒ Object
240 241 242 |
# File 'lib/webpay/data_types.rb', line 240 def uuid attributes['uuid'] end |
#uuid=(value) ⇒ Object
244 245 246 |
# File 'lib/webpay/data_types.rb', line 244 def uuid=(value) attributes['uuid'] = value end |