Sha256: fd8c287af15f08ebcc6c5cbcf61fa45f321055489c8e62a2e286a98cf5b67ae8

Contents?: true

Size: 800 Bytes

Versions: 5

Compression:

Stored size: 800 Bytes

Contents

module Hominid
  module List
   
    # Find a list by name
    def find_list_by_name(list_name)
      lists['data'].find {|l| l["name"] == list_name}
    end
    
    # Find a list ID by name, returns nil if no list found
    def find_list_id_by_name(list_name)
      list = find_list_by_name(list_name)
      list && list["id"]
    end
    
    # Find a list by ID
    def find_list_by_id(list_id)
      lists['data'].find {|l| l["id"] == list_id}
    end
    
    # Find a list by web_id
    def find_list_by_web_id(list_web_id)
      lists['data'].find {|l| l["web_id"] == list_web_id}
    end
    
    # Find a list ID by web_id, returns nil if no list found
    def find_list_id_by_web_id(list_web_id)
      list = find_list_by_web_id(list_web_id)
      list && list["id"]
    end
    
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
hominid-wout-3.0.6 lib/hominid/list.rb
hominid-3.0.5 lib/hominid/list.rb
hominid-3.0.4 lib/hominid/list.rb
hominid-3.0.2 lib/hominid/list.rb
hominid-3.0.1 lib/hominid/list.rb