Class: Playbook::PbOwnerPhone::OwnerPhone

Inherits:
Playbook::PbKit::Base show all
Defined in:
app/pb_kits/playbook/pb_owner_phone/owner_phone.rb

Constant Summary collapse

PROPS =
%i[configured_classname
configured_data
configured_id
configured_first_name
configured_last_name
configured_number
configured_icon].freeze

Instance Method Summary collapse

Methods inherited from Playbook::PbKit::Base

#adjusted_value, #aria, #classname, #concat_value, #data, #default_value, #false_value, #id, #is_boolean?, #is_integer?, #is_set?, #is_string?, #is_true?, #merge_value, #one_of?, #one_of_value, #true_value

Constructor Details

#initialize(classname: default_configuration, data: default_configuration, id: default_configuration, first_name: default_configuration, last_name: default_configuration, number: default_configuration, icon: default_configuration) ⇒ OwnerPhone

Returns a new instance of OwnerPhone.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/pb_kits/playbook/pb_owner_phone/owner_phone.rb', line 14

def initialize(classname: default_configuration,
               data: default_configuration,
               id: default_configuration,
               first_name: default_configuration,
               last_name: default_configuration,
               number: default_configuration,
               icon: default_configuration)
  self.configured_classname = classname
  self.configured_data = data
  self.configured_id = id
  self.configured_first_name = first_name
  self.configured_last_name = last_name
  self.configured_number = number
  self.configured_icon = icon
end

Instance Method Details

#iconObject



30
31
32
# File 'app/pb_kits/playbook/pb_owner_phone/owner_phone.rb', line 30

def icon
  configured_icon if is_set? configured_icon
end

#nameObject



39
40
41
42
# File 'app/pb_kits/playbook/pb_owner_phone/owner_phone.rb', line 39

def name
  owner = Playbook::PbOwner::Owner.new(first_name: configured_first_name, last_name: configured_last_name)
  ApplicationController.renderer.render(partial: owner, as: :object)
end

#numberObject



44
45
46
# File 'app/pb_kits/playbook/pb_owner_phone/owner_phone.rb', line 44

def number
  configured_number if is_set? configured_number
end

#phoneObject



34
35
36
37
# File 'app/pb_kits/playbook/pb_owner_phone/owner_phone.rb', line 34

def phone
  phone = Playbook::PbPhone::Phone.new(icon: configured_icon, number: configured_number)
  ApplicationController.renderer.render(partial: phone, as: :object)
end

#to_partial_pathObject



48
49
50
# File 'app/pb_kits/playbook/pb_owner_phone/owner_phone.rb', line 48

def to_partial_path
  "pb_owner_phone/owner_phone"
end