Class: RIQ::List
Overview
A List is an object that can be created and customized by a User to represent Accounts (companies) or Contacts (people) in a process (such as a sales pipeline).
Instance Attribute Summary collapse
-
#list_items ⇒ Object
readonly
Returns the value of attribute list_items.
-
#title ⇒ Object
(also: #name)
readonly
can’t create a list through API, so these don’t need to write.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Attributes inherited from RIQObject
Class Method Summary collapse
-
.node(id = nil) ⇒ String
Endpoint.
Instance Method Summary collapse
-
#data ⇒ Hash
All relevant stored data.
-
#fields(id = nil) ⇒ Hash?
Gets field if it exists.
-
#initialize(id = nil) ⇒ RIQObject
constructor
Self.
-
#list_item(oid = nil) ⇒ Object
Convenience method for fetching or creating a listitem from the given list.
-
#node ⇒ String
Endpoint.
-
#save ⇒ Object
Overwriting parent because lists can’t be saved through the API.
Methods inherited from RIQObject
Constructor Details
#initialize(id = nil) ⇒ RIQObject
Returns Self.
15 16 17 18 |
# File 'lib/riq/list.rb', line 15 def initialize(id = nil) super @list_items = ListItemManager.new(@id) end |
Instance Attribute Details
#list_items ⇒ Object (readonly)
Returns the value of attribute list_items.
10 11 12 |
# File 'lib/riq/list.rb', line 10 def list_items @list_items end |
#title ⇒ Object (readonly) Also known as: name
can’t create a list through API, so these don’t need to write
8 9 10 |
# File 'lib/riq/list.rb', line 8 def title @title end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
9 10 11 |
# File 'lib/riq/list.rb', line 9 def type @type end |
Class Method Details
.node(id = nil) ⇒ String
Returns endpoint.
26 27 28 |
# File 'lib/riq/list.rb', line 26 def self.node(id = nil) "lists/#{id}" end |
Instance Method Details
#data ⇒ Hash
Returns all relevant stored data.
31 32 33 34 35 36 37 38 |
# File 'lib/riq/list.rb', line 31 def data { id: @id, title: @title, type: @type, fields: @fields } end |
#fields(id = nil) ⇒ Hash?
Gets field if it exists
48 49 50 51 52 53 54 |
# File 'lib/riq/list.rb', line 48 def fields(id = nil) unless id.nil? @fields.select{|f| f[:id] == id.to_s}.first else @fields end end |
#list_item(oid = nil) ⇒ Object
Convenience method for fetching or creating a listitem from the given list
58 59 60 |
# File 'lib/riq/list.rb', line 58 def list_item(oid = nil) RIQ::ListItem.new(oid, lid: @id) end |
#node ⇒ String
Returns endpoint.
21 22 23 |
# File 'lib/riq/list.rb', line 21 def node self.class.node(@id) end |
#save ⇒ Object
Overwriting parent because lists can’t be saved through the API
41 42 43 |
# File 'lib/riq/list.rb', line 41 def save raise NotImplementedError, "Lists can't be edited through the API" end |