Class: C2eCore::Drops::CompanyBranchDrop

Inherits:
BaseDrop
  • Object
show all
Defined in:
/build/app/mailers/c2e_core/drops/company_branch_drop.rb

Instance Method Summary collapse

Constructor Details

#initialize(company_branch) ⇒ CompanyBranchDrop

Returns a new instance of CompanyBranchDrop.



7
8
9
10
# File '/build/app/mailers/c2e_core/drops/company_branch_drop.rb', line 7

def initialize(company_branch)
  super()
  @company_branch = company_branch
end

Instance Method Details

#addressC2eCore::Drops::AddressDrop

Returns - Default address of company branch as drop object.

Returns:



44
45
46
47
48
# File '/build/app/mailers/c2e_core/drops/company_branch_drop.rb', line 44

def address
  stored_value __method__ do
    AddressDrop.new(@company_branch.default_address.location || {})
  end
end

#clientCompanyClientDrop

Returns - Company to which company branch belongs as drop object.

Returns:



18
19
20
21
22
# File '/build/app/mailers/c2e_core/drops/company_branch_drop.rb', line 18

def client
  stored_value __method__ do
    CompanyClientDrop.new @company_branch.company
  end
end

#currencyCurrencyDrop

Returns - Default currency of company branch.

Returns:



51
52
53
54
55
# File '/build/app/mailers/c2e_core/drops/company_branch_drop.rb', line 51

def currency
  stored_value __method__ do
    CurrencyDrop.new @company_branch.default_currency
  end
end

#emailString

Returns - Default email of company branch. E.g.: “objednavky@pizzacipola.cz”.

Returns:

  • (String)
    • Default email of company branch. E.g.: “objednavky@pizzacipola.cz”



37
38
39
40
41
# File '/build/app/mailers/c2e_core/drops/company_branch_drop.rb', line 37

def email
  stored_value __method__ do
    @company_branch.default_email.try(:[], "email")
  end
end

#idInteger

Returns - ID of company branch in database.

Returns:

  • (Integer)
    • ID of company branch in database



13
14
15
# File '/build/app/mailers/c2e_core/drops/company_branch_drop.rb', line 13

def id
  @company_branch.id
end

#nameString

Returns - Name of company branch. E.g.: “Pizza Cipola Háje”.

Returns:

  • (String)
    • Name of company branch. E.g.: “Pizza Cipola Háje”



25
26
27
# File '/build/app/mailers/c2e_core/drops/company_branch_drop.rb', line 25

def name
  @company_branch.name
end

#phoneString

Returns - Default phone number of company branch. E.g.: “420987654321”.

Returns:

  • (String)
    • Default phone number of company branch. E.g.: “420987654321”



30
31
32
33
34
# File '/build/app/mailers/c2e_core/drops/company_branch_drop.rb', line 30

def phone
  stored_value __method__ do
    @company_branch.default_phone.try(:[], "phone")
  end
end