Module: ArcWeld::Relationships::HasCustomer

Defined in:
lib/arc_weld/relationships/has_customer.rb

Instance Method Summary collapse

Instance Method Details

#add_customer(cust) ⇒ Object



4
5
6
7
8
9
# File 'lib/arc_weld/relationships/has_customer.rb', line 4

def add_customer(cust)
  unless has_customer.include?(cust)
    has_customer.push(cust)
    cust.add_customer_resource(self)
  end
end

#add_customers(*customers) ⇒ Object



11
12
13
# File 'lib/arc_weld/relationships/has_customer.rb', line 11

def add_customers(*customers)
  customers.each { |cust| add_customer(cust) }
end

#has_customer_relationshipObject



19
20
21
22
23
24
25
# File 'lib/arc_weld/relationships/has_customer.rb', line 19

def has_customer_relationship
  unless has_customer.empty?
    { 'hasCustomer' => {
        'list!' => related_has_customer_references
    }}
  end
end


15
16
17
# File 'lib/arc_weld/relationships/has_customer.rb', line 15

def related_has_customer_references
  (has_customer.map { |cust| cust.ref.render }).join
end