Class: FreeAgent::Contact
- Defined in:
- lib/free_agent/contact.rb
Overview
Represents a Contact in FreeAgent.
Instance Attribute Summary collapse
-
#first_name ⇒ String
The current value of first_name.
-
#last_name ⇒ String
The current value of last_name.
-
#organisation_name ⇒ String
The current value of organisation_name.
Instance Method Summary collapse
-
#invoices(options = {}) ⇒ Array<FreeAgent::Invoice>
Gets all the invoices associated to this contact.
-
#name ⇒ String?
(also: #name?)
Creates the name of the contact, composed by the interpolation of #first_name and #last_name.
Methods inherited from Base
Instance Attribute Details
#first_name ⇒ String
Returns the current value of first_name.
9 10 11 |
# File 'lib/free_agent/contact.rb', line 9 def first_name @first_name end |
#last_name ⇒ String
Returns the current value of last_name.
9 10 11 |
# File 'lib/free_agent/contact.rb', line 9 def last_name @last_name end |
#organisation_name ⇒ String
Returns the current value of organisation_name.
9 10 11 |
# File 'lib/free_agent/contact.rb', line 9 def organisation_name @organisation_name end |
Instance Method Details
#invoices(options = {}) ⇒ Array<FreeAgent::Invoice>
Gets all the invoices associated to this contact.
69 70 71 72 |
# File 'lib/free_agent/contact.rb', line 69 def invoices(*args) = args. Invoice.all(.merge!(:from => "/contacts/#{id}/invoices.xml")) end |
#name ⇒ String? Also known as: name?
Creates the name of the contact, composed by the interpolation of #first_name and #last_name.
47 48 49 50 |
# File 'lib/free_agent/contact.rb', line 47 def name attrs = [first_name, last_name].reject(&:blank?) attrs.empty? ? nil : attrs.join(" ") end |