Class: Vonage::IdentityInsights::InsightsBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/vonage/identity_insights/insights_builder.rb

Instance Method Summary collapse

Constructor Details

#initializeInsightsBuilder

Returns a new instance of InsightsBuilder.



6
7
8
# File 'lib/vonage/identity_insights/insights_builder.rb', line 6

def initialize
  @insights = {}
end

Instance Method Details

#add_current_carrierInsightsBuilder

Add a Current Carrier insight.

Examples:

builder = Vonage::IdentityInsights::InsightsBuilder.new
builder.add_current_carrier

Returns:



45
46
47
48
# File 'lib/vonage/identity_insights/insights_builder.rb', line 45

def add_current_carrier
  @insights[:current_carrier] = {}
  self
end

#add_formatInsightsBuilder

Add a Format insight.

Examples:

builder = Vonage::IdentityInsights::InsightsBuilder.new
builder.add_format

Returns:



16
17
18
19
# File 'lib/vonage/identity_insights/insights_builder.rb', line 16

def add_format
  @insights[:format] = {}
  self
end

#add_original_carrierInsightsBuilder

Add an Original Carrier insight.

Examples:

builder = Vonage::IdentityInsights::InsightsBuilder.new
builder.add_original_carrier

Returns:



56
57
58
59
# File 'lib/vonage/identity_insights/insights_builder.rb', line 56

def add_original_carrier
  @insights[:original_carrier] = {}
  self
end

#add_sim_swap(period: nil) ⇒ InsightsBuilder

Add a Sim Swap insight.

Examples:

builder = Vonage::IdentityInsights::InsightsBuilder.new
builder.add_sim_swap(period: 180)

Parameters:

  • period (Integer) (defaults to: nil)

    The period for the sim swap insight.

    • Optional. If provided, must be between 1 and 2400.

Returns:



29
30
31
32
33
34
35
36
37
# File 'lib/vonage/identity_insights/insights_builder.rb', line 29

def add_sim_swap(period: nil)
  params = {}
  if period
    validate_sim_swap_period(period)
    params[:period] = period 
  end
  @insights[:sim_swap] = params
  self
end

#to_hHash

Convert the InsightsBuilder to a Hash.

Returns:

  • (Hash)

    The insights as a Hash.



64
65
66
# File 'lib/vonage/identity_insights/insights_builder.rb', line 64

def to_h
  @insights
end