Class: Eisenhower::Staff

Inherits:
Object
  • Object
show all
Defined in:
lib/eisenhower/staff.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Staff

Returns a new instance of Staff.



6
7
8
# File 'lib/eisenhower/staff.rb', line 6

def initialize(attributes={})
  attributes.each { |key, val| send("#{key}=", val) if respond_to?("#{key}=") }
end

Instance Attribute Details

#adminObject

Returns the value of attribute admin.



3
4
5
# File 'lib/eisenhower/staff.rb', line 3

def admin
  @admin
end

#emailObject

Returns the value of attribute email.



3
4
5
# File 'lib/eisenhower/staff.rb', line 3

def email
  @email
end

#full_nameObject Also known as: name

Returns the value of attribute full_name.



3
4
5
# File 'lib/eisenhower/staff.rb', line 3

def full_name
  @full_name
end

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/eisenhower/staff.rb', line 3

def id
  @id
end

Class Method Details

.find(staff_id) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/eisenhower/staff.rb', line 15

def find(staff_id)
  body = Eisenhower::Client.get_and_parse("/staff/get/id/#{staff_id}")
  Eisenhower::Staff.new({
    :id               => body["_id"],
    :full_name        => body["fullName"],
    :email            => body["email"],
    :admin            => body["admin"]
  })
end

Instance Method Details

#admin?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/eisenhower/staff.rb', line 10

def admin?
  @admin
end