Class: HeyYou::Builder::Nexmo

Inherits:
Base
  • Object
show all
Defined in:
lib/hey_you/builder/nexmo.rb

Defined Under Namespace

Classes: MissingRequiredParameter

Constant Summary collapse

LINE_BREAKS_BEFORE_AUTOFILL_HASH =
2

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#fromObject (readonly)

Returns the value of attribute from.



4
5
6
# File 'lib/hey_you/builder/nexmo.rb', line 4

def from
  @from
end

#is_unicodeObject (readonly)

Returns the value of attribute is_unicode.



4
5
6
# File 'lib/hey_you/builder/nexmo.rb', line 4

def is_unicode
  @is_unicode
end

#textObject (readonly)

Returns the value of attribute text.



4
5
6
# File 'lib/hey_you/builder/nexmo.rb', line 4

def text
  @text
end

Instance Method Details

#buildObject



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/hey_you/builder/nexmo.rb', line 7

def build
  @text = interpolate(ch_data.fetch('text'), options)
  if options[:google_autofill_code_hash]
    @text << "\n" * (options[:line_breaks_before_hash] || LINE_BREAKS_BEFORE_AUTOFILL_HASH)
    @text << "#{options[:google_autofill_code_hash]}"
  end
  @from = ch_data.fetch('from', nil)
  @is_unicode = ch_data.fetch('is_unicode', false)
rescue KeyError => e
  fail MissingRequiredParameter, e
end