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.



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

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



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

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



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

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



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

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



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

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



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

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



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

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



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

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



124
125
126
127
128
129
130
131
132
133
# File 'lib/entrata/client.rb', line 124

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_general_leads(customer:, lead_source_id:, preferences:, property_id:) ⇒ Object



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

def send_general_leads(customer:, lead_source_id:, preferences:, property_id:)
  Request::SendGeneralLeads.new(
    conn: basic_auth_conn,
    customer: customer,
    lead_source_id: lead_source_id,
    preferences: preferences,
    property_id: property_id
  ).perform
end

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



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

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



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

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



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

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