Class: Plivo::Parameter

Inherits:
Object
  • Object
show all
Defined in:
lib/plivo/template.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type: nil, text: nil, media: nil, currency: nil, date_time: nil) ⇒ Parameter

Returns a new instance of Parameter.



46
47
48
49
50
51
52
# File 'lib/plivo/template.rb', line 46

def initialize(type: nil, text: nil, media: nil, currency: nil, date_time: nil)
  @type = type
  @text = text
  @media = media
  @currency = currency
  @date_time = date_time
end

Instance Attribute Details

#currencyObject

Returns the value of attribute currency.



44
45
46
# File 'lib/plivo/template.rb', line 44

def currency
  @currency
end

#date_timeObject

Returns the value of attribute date_time.



44
45
46
# File 'lib/plivo/template.rb', line 44

def date_time
  @date_time
end

#mediaObject

Returns the value of attribute media.



44
45
46
# File 'lib/plivo/template.rb', line 44

def media
  @media
end

#textObject

Returns the value of attribute text.



44
45
46
# File 'lib/plivo/template.rb', line 44

def text
  @text
end

#typeObject

Returns the value of attribute type.



44
45
46
# File 'lib/plivo/template.rb', line 44

def type
  @type
end

Instance Method Details

#to_hashObject



54
55
56
57
58
59
60
61
62
# File 'lib/plivo/template.rb', line 54

def to_hash
  {
    type: @type,
    text: @text,
    media: @media,
    currency: @currency&.to_hash,
    date_time: @date_time&.to_hash
  }.reject { |_, v| v.nil? }
end