Class: Amorail::Property

Inherits:
Object
  • Object
show all
Defined in:
lib/amorail/property.rb

Overview

:nodoc: all

Defined Under Namespace

Classes: Company, Contact, Lead, PropertyItem, StatusItem, Task

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Property

Returns a new instance of Property.



60
61
62
63
# File 'lib/amorail/property.rb', line 60

def initialize(client)
  @client = client
  reload
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



57
58
59
# File 'lib/amorail/property.rb', line 57

def client
  @client
end

#companyObject (readonly)

Returns the value of attribute company.



57
58
59
# File 'lib/amorail/property.rb', line 57

def company
  @company
end

#contactsObject (readonly)

Returns the value of attribute contacts.



57
58
59
# File 'lib/amorail/property.rb', line 57

def contacts
  @contacts
end

#dataObject (readonly)

Returns the value of attribute data.



57
58
59
# File 'lib/amorail/property.rb', line 57

def data
  @data
end

#leadsObject (readonly)

Returns the value of attribute leads.



57
58
59
# File 'lib/amorail/property.rb', line 57

def leads
  @leads
end

#tasksObject (readonly)

Returns the value of attribute tasks.



57
58
59
# File 'lib/amorail/property.rb', line 57

def tasks
  @tasks
end

Instance Method Details

#inspectObject



78
79
80
# File 'lib/amorail/property.rb', line 78

def inspect
  @data
end

#load_fieldsObject



70
71
72
73
74
75
76
# File 'lib/amorail/property.rb', line 70

def load_fields
  response = client.safe_request(
    :get,
    '/private/api/v2/json/accounts/current'
  )
  response.body["response"]["account"]
end

#reloadObject



65
66
67
68
# File 'lib/amorail/property.rb', line 65

def reload
  @data = load_fields
  parse_all_data
end