Class: WiteiWebApi::OfficeUser

Inherits:
Base
  • Object
show all
Defined in:
lib/witei_web_api/office_user.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Methods inherited from Base

agent, get, has_one, login

Instance Attribute Details

#emailObject

Returns the value of attribute email.



2
3
4
# File 'lib/witei_web_api/office_user.rb', line 2

def email
  @email
end

#idObject

Returns the value of attribute id.



2
3
4
# File 'lib/witei_web_api/office_user.rb', line 2

def id
  @id
end

#nameObject

Returns the value of attribute name.



2
3
4
# File 'lib/witei_web_api/office_user.rb', line 2

def name
  @name
end

#phoneObject

Returns the value of attribute phone.



2
3
4
# File 'lib/witei_web_api/office_user.rb', line 2

def phone
  @phone
end

Class Method Details

.find(id) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/witei_web_api/office_user.rb', line 4

def self.find(id)
  page = get("/pro/agencies/account_management/agency/user_update/#{id}/")

  form = page.forms_with(css: '.form-horizontal').first

  office_user = new
  office_user.assign_attributes(
    id: id,
    name: form['username'],
    email: form['email'],
    phone: form['phone']
  )
  office_user
end