Class: Brightpearl::Contact
- Defined in:
- lib/brightpearl/resources/contact.rb
Overview
Instance Attribute Summary collapse
-
#company_name ⇒ Object
Returns the value of attribute company_name.
-
#created_on ⇒ Object
Returns the value of attribute created_on.
-
#exact_company_name ⇒ Object
Returns the value of attribute exact_company_name.
-
#first_name ⇒ Object
Returns the value of attribute first_name.
-
#id ⇒ Object
Returns the value of attribute id.
-
#is_customer ⇒ Object
Returns the value of attribute is_customer.
-
#is_primary ⇒ Object
Returns the value of attribute is_primary.
-
#is_staff ⇒ Object
Returns the value of attribute is_staff.
-
#is_supplier ⇒ Object
Returns the value of attribute is_supplier.
-
#last_contacted_on ⇒ Object
Returns the value of attribute last_contacted_on.
-
#last_name ⇒ Object
Returns the value of attribute last_name.
-
#last_ordered_on ⇒ Object
Returns the value of attribute last_ordered_on.
-
#mob ⇒ Object
Returns the value of attribute mob.
-
#nominal_code ⇒ Object
Returns the value of attribute nominal_code.
-
#pri ⇒ Object
Returns the value of attribute pri.
-
#primary_email ⇒ Object
Returns the value of attribute primary_email.
-
#sec ⇒ Object
Returns the value of attribute sec.
-
#secondary_email ⇒ Object
Returns the value of attribute secondary_email.
-
#tertiary_email ⇒ Object
Returns the value of attribute tertiary_email.
-
#title ⇒ Object
Returns the value of attribute title.
-
#updated_on ⇒ Object
Returns the value of attribute updated_on.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(ara) ⇒ Contact
constructor
ARA => API Record Array.
Methods included from APIOperations::Get
Methods included from APIOperations::Post
Methods included from APIOperations::Patch
Methods included from APIOperations::Options
Methods inherited from Resource
Constructor Details
#initialize(ara) ⇒ Contact
ARA => API Record Array
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/brightpearl/resources/contact.rb', line 35 def initialize(ara) @id = ara[0] @primary_email = ara[1] @secondary_email = ara[2] @tertiary_email = ara[3] @first_name = ara[4] @last_name = ara[5] @is_supplier = ara[6] @company_name = ara[7] @is_staff = ara[8] @is_customer = ara[9] @created_on = ara[10] @updated_on = ara[11] @last_contacted_on = ara[12] @last_ordered_on = ara[13] @nominal_code = ara[14] @is_primary = ara[15] @pri = ara[16] @sec = ara[17] @mob = ara[18] @exact_company_name = ara[19] @title = ara[20] end |
Instance Attribute Details
#company_name ⇒ Object
Returns the value of attribute company_name.
9 10 11 |
# File 'lib/brightpearl/resources/contact.rb', line 9 def company_name @company_name end |
#created_on ⇒ Object
Returns the value of attribute created_on.
9 10 11 |
# File 'lib/brightpearl/resources/contact.rb', line 9 def created_on @created_on end |
#exact_company_name ⇒ Object
Returns the value of attribute exact_company_name.
9 10 11 |
# File 'lib/brightpearl/resources/contact.rb', line 9 def exact_company_name @exact_company_name end |
#first_name ⇒ Object
Returns the value of attribute first_name.
9 10 11 |
# File 'lib/brightpearl/resources/contact.rb', line 9 def first_name @first_name end |
#id ⇒ Object
Returns the value of attribute id.
9 10 11 |
# File 'lib/brightpearl/resources/contact.rb', line 9 def id @id end |
#is_customer ⇒ Object
Returns the value of attribute is_customer.
9 10 11 |
# File 'lib/brightpearl/resources/contact.rb', line 9 def is_customer @is_customer end |
#is_primary ⇒ Object
Returns the value of attribute is_primary.
9 10 11 |
# File 'lib/brightpearl/resources/contact.rb', line 9 def is_primary @is_primary end |
#is_staff ⇒ Object
Returns the value of attribute is_staff.
9 10 11 |
# File 'lib/brightpearl/resources/contact.rb', line 9 def is_staff @is_staff end |
#is_supplier ⇒ Object
Returns the value of attribute is_supplier.
9 10 11 |
# File 'lib/brightpearl/resources/contact.rb', line 9 def is_supplier @is_supplier end |
#last_contacted_on ⇒ Object
Returns the value of attribute last_contacted_on.
9 10 11 |
# File 'lib/brightpearl/resources/contact.rb', line 9 def last_contacted_on @last_contacted_on end |
#last_name ⇒ Object
Returns the value of attribute last_name.
9 10 11 |
# File 'lib/brightpearl/resources/contact.rb', line 9 def last_name @last_name end |
#last_ordered_on ⇒ Object
Returns the value of attribute last_ordered_on.
9 10 11 |
# File 'lib/brightpearl/resources/contact.rb', line 9 def last_ordered_on @last_ordered_on end |
#mob ⇒ Object
Returns the value of attribute mob.
9 10 11 |
# File 'lib/brightpearl/resources/contact.rb', line 9 def mob @mob end |
#nominal_code ⇒ Object
Returns the value of attribute nominal_code.
9 10 11 |
# File 'lib/brightpearl/resources/contact.rb', line 9 def nominal_code @nominal_code end |
#pri ⇒ Object
Returns the value of attribute pri.
9 10 11 |
# File 'lib/brightpearl/resources/contact.rb', line 9 def pri @pri end |
#primary_email ⇒ Object
Returns the value of attribute primary_email.
9 10 11 |
# File 'lib/brightpearl/resources/contact.rb', line 9 def primary_email @primary_email end |
#sec ⇒ Object
Returns the value of attribute sec.
9 10 11 |
# File 'lib/brightpearl/resources/contact.rb', line 9 def sec @sec end |
#secondary_email ⇒ Object
Returns the value of attribute secondary_email.
9 10 11 |
# File 'lib/brightpearl/resources/contact.rb', line 9 def secondary_email @secondary_email end |
#tertiary_email ⇒ Object
Returns the value of attribute tertiary_email.
9 10 11 |
# File 'lib/brightpearl/resources/contact.rb', line 9 def tertiary_email @tertiary_email end |
#title ⇒ Object
Returns the value of attribute title.
9 10 11 |
# File 'lib/brightpearl/resources/contact.rb', line 9 def title @title end |
#updated_on ⇒ Object
Returns the value of attribute updated_on.
9 10 11 |
# File 'lib/brightpearl/resources/contact.rb', line 9 def updated_on @updated_on end |
Class Method Details
.resource_path ⇒ Object
16 17 18 |
# File 'lib/brightpearl/resources/contact.rb', line 16 def resource_path "contact-service/contact" end |
.search(query_params = {}) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/brightpearl/resources/contact.rb', line 26 def search(query_params = {}) response = send_request(path: "contact-service/contact-search?#{to_query(query_params)}", method: :get) return response.merge({ # modify final payload to set search results as objects records: response[:payload]["response"]["results"].map { |item| Contact.new(item) }, }) end |