Class: Unit::Application::CreateBusinessApplicationRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/unit/models/application/create_business_application_request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, address, phone, state_of_incorporation, ein, industry, contact, officer, beneficial_owners, entity_type, dba = nil, ip = nil, website = nil, tags = nil, idempotency_key = nil, device_fingerprints = nil) ⇒ CreateBusinessApplicationRequest



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/unit/models/application/create_business_application_request.rb', line 34

def initialize(name, address, phone, state_of_incorporation, ein, industry, contact, officer,
               beneficial_owners, entity_type, dba = nil, ip = nil, website = nil, tags = nil, idempotency_key = nil,
               device_fingerprints = nil)
  @name = name
  @address = address
  @phone = phone
  @state_of_incorporation = state_of_incorporation
  @ein = ein
  @industry = industry
  @contact = contact
  @officer = officer
  @beneficial_owners = beneficial_owners.map(&:represent)
  @entity_type = entity_type
  @dba = dba
  @ip = ip
  @website = website
  @tags = tags
  @idempotency_key = idempotency_key
  @device_fingerprints = device_fingerprints
  @type = "businessApplication"
end

Instance Attribute Details

#addressObject (readonly)

Returns the value of attribute address.



15
16
17
# File 'lib/unit/models/application/create_business_application_request.rb', line 15

def address
  @address
end

#beneficial_ownersObject (readonly)

Returns the value of attribute beneficial_owners.



15
16
17
# File 'lib/unit/models/application/create_business_application_request.rb', line 15

def beneficial_owners
  @beneficial_owners
end

#contactObject (readonly)

Returns the value of attribute contact.



15
16
17
# File 'lib/unit/models/application/create_business_application_request.rb', line 15

def contact
  @contact
end

#dbaObject (readonly)

Returns the value of attribute dba.



15
16
17
# File 'lib/unit/models/application/create_business_application_request.rb', line 15

def dba
  @dba
end

#device_fingerprintsObject (readonly)

Returns the value of attribute device_fingerprints.



15
16
17
# File 'lib/unit/models/application/create_business_application_request.rb', line 15

def device_fingerprints
  @device_fingerprints
end

#einObject (readonly)

Returns the value of attribute ein.



15
16
17
# File 'lib/unit/models/application/create_business_application_request.rb', line 15

def ein
  @ein
end

#entity_typeObject (readonly)

Returns the value of attribute entity_type.



15
16
17
# File 'lib/unit/models/application/create_business_application_request.rb', line 15

def entity_type
  @entity_type
end

#idempotency_keyObject (readonly)

Returns the value of attribute idempotency_key.



15
16
17
# File 'lib/unit/models/application/create_business_application_request.rb', line 15

def idempotency_key
  @idempotency_key
end

#industryObject (readonly)

Returns the value of attribute industry.



15
16
17
# File 'lib/unit/models/application/create_business_application_request.rb', line 15

def industry
  @industry
end

#ipObject (readonly)

Returns the value of attribute ip.



15
16
17
# File 'lib/unit/models/application/create_business_application_request.rb', line 15

def ip
  @ip
end

#nameObject (readonly)

Returns the value of attribute name.



15
16
17
# File 'lib/unit/models/application/create_business_application_request.rb', line 15

def name
  @name
end

#officerObject (readonly)

Returns the value of attribute officer.



15
16
17
# File 'lib/unit/models/application/create_business_application_request.rb', line 15

def officer
  @officer
end

#phoneObject (readonly)

Returns the value of attribute phone.



15
16
17
# File 'lib/unit/models/application/create_business_application_request.rb', line 15

def phone
  @phone
end

#state_of_incorporationObject (readonly)

Returns the value of attribute state_of_incorporation.



15
16
17
# File 'lib/unit/models/application/create_business_application_request.rb', line 15

def state_of_incorporation
  @state_of_incorporation
end

#tagsObject (readonly)

Returns the value of attribute tags.



15
16
17
# File 'lib/unit/models/application/create_business_application_request.rb', line 15

def tags
  @tags
end

#typeObject (readonly)

Returns the value of attribute type.



15
16
17
# File 'lib/unit/models/application/create_business_application_request.rb', line 15

def type
  @type
end

#websiteObject (readonly)

Returns the value of attribute website.



15
16
17
# File 'lib/unit/models/application/create_business_application_request.rb', line 15

def website
  @website
end

Instance Method Details

#to_json_apiObject



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/unit/models/application/create_business_application_request.rb', line 56

def to_json_api
  payload = {
    data: {
      type: type,
      attributes: {
        name: name,
        address: address.represent,
        phone: phone.represent,
        stateOfIncorporation: state_of_incorporation,
        ein: ein,
        industry: industry,
        contact: contact.represent,
        officer: officer.represent,
        beneficialOwners: beneficial_owners,
        entityType: entity_type,
        dba: dba,
        ip: ip,
        website: website
      }
    }
  }
  payload[:data][:attributes].compact!
  payload.to_json
end