Class: Unit::Customer::PatchIndividualCustomerRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/unit/models/customer/patch_individual_customer_request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(customer_id, address = nil, phone = nil, email = nil, dba = nil, authorized_users = nil, tags = nil, jwt_subject = nil) ⇒ PatchIndividualCustomerRequest

Parameters:

  • The id of individual customer

  • address [Address] The address of individual customer

  • phone [Phone] The phone of individual customer

  • email [String] The email of individual customer

  • dba [String] The dba of individual customer. If the individual is a sole proprietor who is doing business under a different name.

  • authorized_users [Array<AuthorizedUser>] The authorized users of individual customer

  • tags [Hash] Provides opportunity to add, update or delete tags from resources with the tags attribute on the corresponding Update operation

  • jwt_subject [String] The subject of the JWT



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

def initialize(customer_id, address = nil, phone = nil, email = nil, dba = nil, authorized_users = nil, tags = nil, jwt_subject = nil)
  @customer_id = customer_id
  @address = address
  @phone = phone
  @email = email
  @dba = dba
  @authorized_users = authorized_users
  @tags = tags
  @jwt_subject = jwt_subject
end

Instance Attribute Details

#addressObject (readonly)

Returns the value of attribute address.



8
9
10
# File 'lib/unit/models/customer/patch_individual_customer_request.rb', line 8

def address
  @address
end

#authorized_usersObject (readonly)

Returns the value of attribute authorized_users.



8
9
10
# File 'lib/unit/models/customer/patch_individual_customer_request.rb', line 8

def authorized_users
  @authorized_users
end

#customer_idObject (readonly)

Returns the value of attribute customer_id.



8
9
10
# File 'lib/unit/models/customer/patch_individual_customer_request.rb', line 8

def customer_id
  @customer_id
end

#dbaObject (readonly)

Returns the value of attribute dba.



8
9
10
# File 'lib/unit/models/customer/patch_individual_customer_request.rb', line 8

def dba
  @dba
end

#emailObject (readonly)

Returns the value of attribute email.



8
9
10
# File 'lib/unit/models/customer/patch_individual_customer_request.rb', line 8

def email
  @email
end

#jwt_subjectObject (readonly)

Returns the value of attribute jwt_subject.



8
9
10
# File 'lib/unit/models/customer/patch_individual_customer_request.rb', line 8

def jwt_subject
  @jwt_subject
end

#phoneObject (readonly)

Returns the value of attribute phone.



8
9
10
# File 'lib/unit/models/customer/patch_individual_customer_request.rb', line 8

def phone
  @phone
end

#tagsObject (readonly)

Returns the value of attribute tags.



8
9
10
# File 'lib/unit/models/customer/patch_individual_customer_request.rb', line 8

def tags
  @tags
end

Instance Method Details

#to_json_apiObject



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

def to_json_api
  payload = {
    data: {
      type: "individualCustomer",
      attributes: {
        address: address&.represent,
        phone: phone&.represent,
        email: email,
        dba: dba,
        authorized_users: authorized_users&.map(&:represent),
        tags: tags
      }
    }
  }
  payload[:data][:attributes].compact!
  payload.to_json
end