Class: Unit::Card::ReplaceCardRequest
- Inherits:
-
Object
- Object
- Unit::Card::ReplaceCardRequest
- Defined in:
- lib/unit/models/card/replace_card_request.rb
Instance Attribute Summary collapse
-
#card_id ⇒ Object
readonly
Returns the value of attribute card_id.
-
#shipping_address ⇒ Object
readonly
Returns the value of attribute shipping_address.
Instance Method Summary collapse
-
#initialize(card_id, shipping_address = nil) ⇒ ReplaceCardRequest
constructor
A new instance of ReplaceCardRequest.
- #to_json_api ⇒ Object
Constructor Details
#initialize(card_id, shipping_address = nil) ⇒ ReplaceCardRequest
Returns a new instance of ReplaceCardRequest.
12 13 14 15 |
# File 'lib/unit/models/card/replace_card_request.rb', line 12 def initialize(card_id, shipping_address = nil) @card_id = card_id @shipping_address = shipping_address end |
Instance Attribute Details
#card_id ⇒ Object (readonly)
Returns the value of attribute card_id.
8 9 10 |
# File 'lib/unit/models/card/replace_card_request.rb', line 8 def card_id @card_id end |
#shipping_address ⇒ Object (readonly)
Returns the value of attribute shipping_address.
8 9 10 |
# File 'lib/unit/models/card/replace_card_request.rb', line 8 def shipping_address @shipping_address end |
Instance Method Details
#to_json_api ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/unit/models/card/replace_card_request.rb', line 17 def to_json_api payload = { "data": { "type": "replaceCard", "attributes": { "shippingAddress": shipping_address&.represent } } } payload[:data][:attributes].compact! payload.to_json end |