Class: Unit::Card::PatchBusinessCardRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/unit/models/card/patch_business_card_request.rb

Direct Known Subclasses

PatchBusinessCreditCardRequest

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(card_id, shipping_address = nil, address = nil, phone = nil, email = nil, design = nil, tags = nil, limits = nil) ⇒ PatchBusinessCardRequest

Returns a new instance of PatchBusinessCardRequest.

Parameters:

  • card_id (String)
  • shipping_address (Address) (defaults to: nil)
    • optional

  • address (Address) (defaults to: nil)
    • optional

  • phone (Phone) (defaults to: nil)
    • optional

  • email (String) (defaults to: nil)
    • optional

  • design (String) (defaults to: nil)
    • optional

  • tags (Hash) (defaults to: nil)
    • optional

  • limits (Hash) (defaults to: nil)
    • optional



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/unit/models/card/patch_business_card_request.rb', line 18

def initialize(card_id, shipping_address = nil, address = nil, phone = nil, email = nil, design = nil, tags = nil, limits = nil)
  @card_id = card_id
  @shipping_address = shipping_address
  @address = address
  @phone = phone
  @email = email
  @design = design
  @tags = tags
  @limits = limits
  @type = "businessDebitCard"
end

Instance Attribute Details

#addressObject (readonly)

Returns the value of attribute address.



8
9
10
# File 'lib/unit/models/card/patch_business_card_request.rb', line 8

def address
  @address
end

#card_idObject (readonly)

Returns the value of attribute card_id.



8
9
10
# File 'lib/unit/models/card/patch_business_card_request.rb', line 8

def card_id
  @card_id
end

#designObject (readonly)

Returns the value of attribute design.



8
9
10
# File 'lib/unit/models/card/patch_business_card_request.rb', line 8

def design
  @design
end

#emailObject (readonly)

Returns the value of attribute email.



8
9
10
# File 'lib/unit/models/card/patch_business_card_request.rb', line 8

def email
  @email
end

#limitsObject (readonly)

Returns the value of attribute limits.



8
9
10
# File 'lib/unit/models/card/patch_business_card_request.rb', line 8

def limits
  @limits
end

#phoneObject (readonly)

Returns the value of attribute phone.



8
9
10
# File 'lib/unit/models/card/patch_business_card_request.rb', line 8

def phone
  @phone
end

#shipping_addressObject (readonly)

Returns the value of attribute shipping_address.



8
9
10
# File 'lib/unit/models/card/patch_business_card_request.rb', line 8

def shipping_address
  @shipping_address
end

#tagsObject (readonly)

Returns the value of attribute tags.



8
9
10
# File 'lib/unit/models/card/patch_business_card_request.rb', line 8

def tags
  @tags
end

#typeObject (readonly)

Returns the value of attribute type.



8
9
10
# File 'lib/unit/models/card/patch_business_card_request.rb', line 8

def type
  @type
end

Instance Method Details

#to_json_apiObject



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/unit/models/card/patch_business_card_request.rb', line 30

def to_json_api
  payload = {
    "data": {
      "type": type,
      "attributes": {
        "shippingAddress": shipping_address,
        "address": address,
        "phone": phone,
        "email": email,
        "design": design,
        "tags": tags,
        "limits": limits
      }
    }
  }
  payload[:data][:attributes].compact!
  payload.to_json
end