Module: Rentlinx

Defined in:
lib/rentlinx.rb,
lib/rentlinx/client.rb,
lib/rentlinx/errors.rb,
lib/rentlinx/default.rb,
lib/rentlinx/version.rb,
lib/rentlinx/models/base.rb,
lib/rentlinx/models/lead.rb,
lib/rentlinx/models/unit.rb,
lib/rentlinx/models/company.rb,
lib/rentlinx/models/property.rb,
lib/rentlinx/models/unit_link.rb,
lib/rentlinx/modules/linkable.rb,
lib/rentlinx/models/unit_photo.rb,
lib/rentlinx/modules/photoable.rb,
lib/rentlinx/models/unit_amenity.rb,
lib/rentlinx/modules/amenityable.rb,
lib/rentlinx/models/property_link.rb,
lib/rentlinx/models/property_photo.rb,
lib/rentlinx/models/property_amenity.rb,
lib/rentlinx/validators/url_validator.rb,
lib/rentlinx/validators/zip_validator.rb,
lib/rentlinx/validators/base_validator.rb,
lib/rentlinx/validators/city_validator.rb,
lib/rentlinx/validators/phone_validator.rb,
lib/rentlinx/validators/state_validator.rb,
lib/rentlinx/modules/lead_client_methods.rb,
lib/rentlinx/modules/link_client_methods.rb,
lib/rentlinx/modules/unit_client_methods.rb,
lib/rentlinx/validators/amount_validator.rb,
lib/rentlinx/modules/photo_client_methods.rb,
lib/rentlinx/validators/address_validator.rb,
lib/rentlinx/modules/amenity_client_methods.rb,
lib/rentlinx/modules/company_client_methods.rb,
lib/rentlinx/modules/property_client_methods.rb,
lib/rentlinx/modules/websites_client_methods.rb,
lib/rentlinx/validators/attribute_processor_service.rb

Overview

This is the main rentlinx module. All Rentlinx objects and methods are namespaced under this module.

Defined Under Namespace

Modules: AmenityClientMethods, Amenityable, CompanyClientMethods, Default, LeadClientMethods, LinkClientMethods, Linkable, PhotoClientMethods, Photoable, PropertyClientMethods, UnitClientMethods, WebsitesClientMethods Classes: AddressValidator, AmountValidator, AttributeProcessor, BadRequest, Base, BaseValidator, CityValidator, Client, Company, Conflict, Forbidden, HTTPError, IncompatibleGroupOfObjectsForPost, InvalidObject, InvalidTypeParam, Lead, NotConfigured, NotFound, PhoneValidator, Property, PropertyAmenity, PropertyLink, PropertyPhoto, RentlinxError, ServerError, StateValidator, UnexpectedAttributes, Unit, UnitAmenity, UnitLink, UnitPhoto, UrlValidator, ZipValidator

Constant Summary collapse

VERSION =
'0.14.0'.freeze

Class Method Summary collapse

Class Method Details

.clientObject

The client object used for communicating with Rentlinx



76
77
78
# File 'lib/rentlinx.rb', line 76

def client
  @client ||= Rentlinx::Client.new
end

.configure {|_self| ... } ⇒ Object

Allows the configuration of Rentlinx in a configure-block style.

Examples:

Rentlinx.configure do |rentlinx|
  rentlinx.username ENV['RENTLINX_USERNAME']
  rentlinx.password ENV['RENTLINX_PASSWORD']
  rentlinx.site_url 'https://rentlinx.com/api/v2'
  rentlinx.log_level :error
end

Yields:

  • (_self)

Yield Parameters:

  • _self (Rentlinx)

    the object that the method was called on



34
35
36
# File 'lib/rentlinx.rb', line 34

def configure
  yield(self)
end

.log(message) ⇒ Object

Write to the log with filtered output



91
92
93
94
# File 'lib/rentlinx.rb', line 91

def log(message)
  message = message.gsub(Rentlinx.username, '<filtered_username>').gsub(Rentlinx.password, '<filtered_password>')
  Rentlinx.logger.info message
end

.log_level(*args) ⇒ Object

Sets and retrieves the log level, currently only :error and :debug are supported



67
68
69
70
71
72
73
# File 'lib/rentlinx.rb', line 67

def log_level(*args)
  if args.empty?
    @log_level
  else
    @log_level = args.first
  end
end

.logger(*args) ⇒ Object

The logger object



81
82
83
84
85
86
87
88
# File 'lib/rentlinx.rb', line 81

def logger(*args)
  if args.empty?
    @logger ||= Logging.logger(STDOUT)
    @logger
  else
    @logger = args.first
  end
end

.password(*args) ⇒ Object

Sets and retrieves the password used to log in to Rentlinx



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

def password(*args)
  if args.empty?
    @password
  else
    @password = args.first
  end
end

.site_url(*args) ⇒ Object

Sets and retrieves the URL where the API is hosted.



57
58
59
60
61
62
63
# File 'lib/rentlinx.rb', line 57

def site_url(*args)
  if args.empty?
    @site_url
  else
    @site_url = args.first
  end
end

.username(*args) ⇒ Object

Sets and retrieves the username used to log in to Rentlinx



39
40
41
42
43
44
45
# File 'lib/rentlinx.rb', line 39

def username(*args)
  if args.empty?
    @username
  else
    @username = args.first
  end
end