Class: Unit::Customer::AddAuthorizedUsersRequest

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(customer_id, authorized_users) ⇒ AddAuthorizedUsersRequest

Returns a new instance of AddAuthorizedUsersRequest.

Parameters:

  • customer_id (String)
  • authorized_users (Array<AuthorizedUser>)


12
13
14
15
# File 'lib/unit/models/customer/add_authorized_users_request.rb', line 12

def initialize(customer_id, authorized_users)
  @customer_id = customer_id
  @authorized_users = authorized_users
end

Instance Attribute Details

#authorized_usersObject (readonly)

Returns the value of attribute authorized_users.



8
9
10
# File 'lib/unit/models/customer/add_authorized_users_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/add_authorized_users_request.rb', line 8

def customer_id
  @customer_id
end

Instance Method Details

#to_json_apiObject



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

def to_json_api
  payload = {
    data: {
      type: "addAuthorizedUsers",
      attributes: {
        authorizedUsers: authorized_users.map(&:represent)
      }
    }
  }
  payload[:data][:attributes].compact!
  payload.to_json
end