Class: DoorLoop::Client

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_token, api_base_url: 'https://app.doorloop.com/api/', retry_on_rate_limit: false) ⇒ Client

Returns a new instance of Client.



34
35
36
37
38
39
40
# File 'lib/doorloop/client.rb', line 34

def initialize(api_token, api_base_url: 'https://app.doorloop.com/api/', retry_on_rate_limit: false)
  @api_token = api_token
  @api_base_url = api_base_url
  @retry_on_rate_limit = retry_on_rate_limit
  @logger = Logger.new($stdout)
  @error_handler = DoorLoop::ErrorHandler.new(@logger, self)
end

Instance Attribute Details

#api_base_urlObject

Returns the value of attribute api_base_url.



32
33
34
# File 'lib/doorloop/client.rb', line 32

def api_base_url
  @api_base_url
end

#api_tokenObject

Returns the value of attribute api_token.



32
33
34
# File 'lib/doorloop/client.rb', line 32

def api_token
  @api_token
end

#loggerObject

Returns the value of attribute logger.



32
33
34
# File 'lib/doorloop/client.rb', line 32

def logger
  @logger
end

#retry_on_rate_limitObject

Returns the value of attribute retry_on_rate_limit.



32
33
34
# File 'lib/doorloop/client.rb', line 32

def retry_on_rate_limit
  @retry_on_rate_limit
end

Instance Method Details

#accountsObject



42
43
44
# File 'lib/doorloop/client.rb', line 42

def accounts
  Accounts.new(self)
end

#communication_logsObject



122
123
124
# File 'lib/doorloop/client.rb', line 122

def communication_logs
  CommunicationLogs.new(self)
end

#delete(path) ⇒ Object



144
145
146
147
148
# File 'lib/doorloop/client.rb', line 144

def delete(path)
  url = build_url(path)
  response = make_delete_request(url)
  parse_response(response)
end

#expensesObject



98
99
100
# File 'lib/doorloop/client.rb', line 98

def expenses
  Expenses.new(self)
end

#filesObject



118
119
120
# File 'lib/doorloop/client.rb', line 118

def files
  Files.new(self)
end

#get(path, options = {}) ⇒ Object



126
127
128
129
130
# File 'lib/doorloop/client.rb', line 126

def get(path, options = {})
  url = build_url(path, options)
  response = make_request(url)
  parse_response(response)
end

#lease_chargesObject



74
75
76
# File 'lib/doorloop/client.rb', line 74

def lease_charges
  LeaseCharges.new(self)
end

#lease_creditsObject



78
79
80
# File 'lib/doorloop/client.rb', line 78

def lease_credits
  LeaseCredits.new(self)
end

#lease_paymentsObject



66
67
68
# File 'lib/doorloop/client.rb', line 66

def lease_payments
  LeasePayments.new(self)
end

#lease_returned_paymentsObject



70
71
72
# File 'lib/doorloop/client.rb', line 70

def lease_returned_payments
  LeaseReturnedPayments.new(self)
end

#leasesObject



58
59
60
# File 'lib/doorloop/client.rb', line 58

def leases
  Leases.new(self)
end

#notesObject



114
115
116
# File 'lib/doorloop/client.rb', line 114

def notes
  Notes.new(self)
end

#ownersObject



90
91
92
# File 'lib/doorloop/client.rb', line 90

def owners
  Owners.new(self)
end

#portfoliosObject



82
83
84
# File 'lib/doorloop/client.rb', line 82

def portfolios
  Portfolios.new(self)
end

#post(path, payload) ⇒ Object



132
133
134
135
136
# File 'lib/doorloop/client.rb', line 132

def post(path, payload)
  url = build_url(path)
  response = make_post_request(url, payload)
  parse_response(response)
end

#propertiesObject



46
47
48
# File 'lib/doorloop/client.rb', line 46

def properties
  Properties.new(self)
end

#put(path, payload) ⇒ Object



138
139
140
141
142
# File 'lib/doorloop/client.rb', line 138

def put(path, payload)
  url = build_url(path)
  response = make_put_request(url, payload)
  parse_response(response)
end

#reportsObject



110
111
112
# File 'lib/doorloop/client.rb', line 110

def reports
  Reports.new(self)
end

#tasksObject



86
87
88
# File 'lib/doorloop/client.rb', line 86

def tasks
  Tasks.new(self)
end

#tenantsObject



62
63
64
# File 'lib/doorloop/client.rb', line 62

def tenants
  Tenants.new(self)
end

#unitsObject



50
51
52
# File 'lib/doorloop/client.rb', line 50

def units
  Units.new(self)
end

#usersObject



54
55
56
# File 'lib/doorloop/client.rb', line 54

def users
  Users.new(self)
end

#vendor_billsObject



102
103
104
# File 'lib/doorloop/client.rb', line 102

def vendor_bills
  VendorBills.new(self)
end

#vendor_creditsObject



106
107
108
# File 'lib/doorloop/client.rb', line 106

def vendor_credits
  VendorCredits.new(self)
end

#vendorsObject



94
95
96
# File 'lib/doorloop/client.rb', line 94

def vendors
  Vendors.new(self)
end