Module: Hominid::List

Included in:
API
Defined in:
lib/hominid/list.rb

Instance Method Summary collapse

Instance Method Details

#find_list_by_id(list_id) ⇒ Object

Find a list by ID



16
17
18
# File 'lib/hominid/list.rb', line 16

def find_list_by_id(list_id)
  lists['data'].find {|l| l["id"] == list_id}
end

#find_list_by_name(list_name) ⇒ Object

Find a list by name



5
6
7
# File 'lib/hominid/list.rb', line 5

def find_list_by_name(list_name)
  lists['data'].find {|l| l["name"] == list_name}
end

#find_list_by_web_id(list_web_id) ⇒ Object

Find a list by web_id



21
22
23
# File 'lib/hominid/list.rb', line 21

def find_list_by_web_id(list_web_id)
  lists['data'].find {|l| l["web_id"] == list_web_id}
end

#find_list_id_by_name(list_name) ⇒ Object

Find a list ID by name, returns nil if no list found



10
11
12
13
# File 'lib/hominid/list.rb', line 10

def find_list_id_by_name(list_name)
  list = find_list_by_name(list_name)
  list && list["id"]
end

#find_list_id_by_web_id(list_web_id) ⇒ Object

Find a list ID by web_id, returns nil if no list found



26
27
28
29
# File 'lib/hominid/list.rb', line 26

def find_list_id_by_web_id(list_web_id)
  list = find_list_by_web_id(list_web_id)
  list && list["id"]
end