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, payload: nil, currency: nil, date_time: nil, location: nil, parameter_name: nil) ⇒ Parameter

Returns a new instance of Parameter.



47
48
49
50
51
52
53
54
55
56
# File 'lib/plivo/template.rb', line 47

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

Instance Attribute Details

#currencyObject

Returns the value of attribute currency.



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

def currency
  @currency
end

#date_timeObject

Returns the value of attribute date_time.



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

def date_time
  @date_time
end

#locationObject

Returns the value of attribute location.



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

def location
  @location
end

#mediaObject

Returns the value of attribute media.



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

def media
  @media
end

#parameter_nameObject

Returns the value of attribute parameter_name.



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

def parameter_name
  @parameter_name
end

#payloadObject

Returns the value of attribute payload.



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

def payload
  @payload
end

#textObject

Returns the value of attribute text.



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

def text
  @text
end

#typeObject

Returns the value of attribute type.



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

def type
  @type
end

Instance Method Details

#to_hashObject



58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/plivo/template.rb', line 58

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