Class: Entrata::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/entrata/client.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(subdomain:, token:) ⇒ Client

Returns a new instance of Client.



15
16
17
18
# File 'lib/entrata/client.rb', line 15

def initialize(subdomain:, token:)
  @subdomain = subdomain
  @token = token
end

Class Method Details

.get_access_token(auth_code:, client_id:, client_secret:, conn: Faraday.new('https://sync.entrata.com')) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/entrata/client.rb', line 21

def get_access_token(auth_code:, client_id:, client_secret:,
                     conn: Faraday.new('https://sync.entrata.com'))
  Request::GetAccessToken.new(
    conn: conn,
    auth_code: auth_code,
    client_id: client_id,
    client_secret: client_secret
  ).perform
end

.get_client_info(token, conn: Faraday.new('https://sync.entrata.com')) ⇒ Object

requires token directly; typical use is to #get_access_token, then #get_client_info immediately with the same client



33
34
35
36
37
# File 'lib/entrata/client.rb', line 33

def get_client_info(token, conn: Faraday.new('https://sync.entrata.com'))
  conn.authorization :Bearer, token

  Request::GetClientInfo.new(conn: conn).perform
end

Instance Method Details

#get_ils_properties_data(property_ids) ⇒ Object



55
56
57
58
59
60
# File 'lib/entrata/client.rb', line 55

def get_ils_properties_data(property_ids)
  Request::GetIlsPropertiesData.new(
    conn: conn,
    property_ids: property_ids
  ).perform_with_curl
end

#get_property_info(property_id) ⇒ Object



40
41
42
43
44
45
# File 'lib/entrata/client.rb', line 40

def get_property_info(property_id)
  Request::GetPropertyInfo.new(
    conn: conn,
    property_id: property_id
  ).perform
end

#inactive_lead_request_body(customer:, lead_source_id:, leasing_agent_id:, preferences:, property_id:) ⇒ Object



102
103
104
105
106
107
108
109
110
111
# File 'lib/entrata/client.rb', line 102

def inactive_lead_request_body(customer:, lead_source_id:, leasing_agent_id:, preferences:, property_id:)
  Request::SendInactiveLeads.new(
    conn: basic_auth_conn,
    customer: customer,
    lead_source_id: lead_source_id,
    leasing_agent_id: leasing_agent_id,
    preferences: preferences,
    property_id: property_id
  ).body
end

#lead_details_request_body(customer:, property_id:, preferences: nil) ⇒ Object



93
94
95
96
97
98
99
100
# File 'lib/entrata/client.rb', line 93

def lead_details_request_body(customer:, property_id:, preferences: nil)
  Request::SendLeadDetails.new(
    conn: conn,
    customer: customer,
    preferences: preferences,
    property_id: property_id
  ).body
end

#process_property_activation(property_id, activation_status: 'approve') ⇒ Object



47
48
49
50
51
52
53
# File 'lib/entrata/client.rb', line 47

def process_property_activation(property_id, activation_status: 'approve')
  Request::ProcessPropertyActivation.new(
    conn: conn,
    property_id: property_id,
    activation_status: activation_status
  ).perform
end

#reactivate_lead_request_body(applicant_id:, application_id:, customer:, preferences:, property_id:) ⇒ Object



113
114
115
116
117
118
119
120
121
122
# File 'lib/entrata/client.rb', line 113

def reactivate_lead_request_body(applicant_id:, application_id:, customer:, preferences:, property_id:)
  Request::SendReactivateLeads.new(
    conn: basic_auth_conn,
    applicant_id: applicant_id,
    application_id: application_id,
    customer: customer,
    preferences: preferences,
    property_id: property_id
  ).body
end

#send_inactive_leads(customer:, lead_source_id:, leasing_agent_id:, preferences:, property_id:) ⇒ Object



71
72
73
74
75
76
77
78
79
80
# File 'lib/entrata/client.rb', line 71

def send_inactive_leads(customer:, lead_source_id:, leasing_agent_id:, preferences:, property_id:)
  Request::SendInactiveLeads.new(
    conn: basic_auth_conn,
    customer: customer,
    lead_source_id: lead_source_id,
    leasing_agent_id: leasing_agent_id,
    preferences: preferences,
    property_id: property_id
  ).perform
end

#send_lead_details(customer:, property_id:, preferences: nil) ⇒ Object



62
63
64
65
66
67
68
69
# File 'lib/entrata/client.rb', line 62

def send_lead_details(customer:, property_id:, preferences: nil)
  Request::SendLeadDetails.new(
    conn: conn,
    customer: customer,
    preferences: preferences,
    property_id: property_id
  ).perform
end

#send_reactivate_leads(applicant_id:, application_id:, customer:, preferences:, property_id:) ⇒ Object



82
83
84
85
86
87
88
89
90
91
# File 'lib/entrata/client.rb', line 82

def send_reactivate_leads(applicant_id:, application_id:, customer:, preferences:, property_id:)
  Request::SendReactivateLeads.new(
    conn: basic_auth_conn,
    applicant_id: applicant_id,
    application_id: application_id,
    customer: customer,
    preferences: preferences,
    property_id: property_id
  ).perform
end