Class: SixSaferpay::Phone

Inherits:
Object
  • Object
show all
Defined in:
lib/six_saferpay/models/phone.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(main: nil, mobile: nil, work: nil) ⇒ Phone

Returns a new instance of Phone.



10
11
12
13
14
15
16
17
18
# File 'lib/six_saferpay/models/phone.rb', line 10

def initialize(
  main: nil,
  mobile: nil,
  work: nil
  )
  @main = main
  @mobile = mobile
  @work = work
end

Instance Attribute Details

#mainObject

Returns the value of attribute main.



4
5
6
# File 'lib/six_saferpay/models/phone.rb', line 4

def main
  @main
end

#mobileObject

Returns the value of attribute mobile.



4
5
6
# File 'lib/six_saferpay/models/phone.rb', line 4

def mobile
  @mobile
end

Instance Method Details

#to_hashObject Also known as: to_h



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/six_saferpay/models/phone.rb', line 20

def to_hash
  hash = Hash.new
  if @main
    hash.merge!(main: @main)
  end
  if @mobile
    hash.merge!(mobile: @mobile)
  end
  if @work
    hash.merge!(work: @work)
  end
  hash
end