Class: Twilio::REST::Verify::V2::SafelistContext

Inherits:
InstanceContext show all
Defined in:
lib/twilio-ruby/rest/verify/v2/safelist.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, phone_number) ⇒ SafelistContext

Initialize the SafelistContext

Parameters:



74
75
76
77
78
79
80
81
82
# File 'lib/twilio-ruby/rest/verify/v2/safelist.rb', line 74

def initialize(version, phone_number)
    super(version)

    # Path Solution
    @solution = { phone_number: phone_number,  }
    @uri = "/SafeList/Numbers/#{@solution[:phone_number]}"

    
end

Instance Method Details

#deleteBoolean

Delete the SafelistInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



86
87
88
89
90
91
92
93
# File 'lib/twilio-ruby/rest/verify/v2/safelist.rb', line 86

def delete

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    @version.delete('DELETE', @uri, headers: headers)
end

#fetchSafelistInstance

Fetch the SafelistInstance

Returns:



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/twilio-ruby/rest/verify/v2/safelist.rb', line 98

def fetch

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.fetch('GET', @uri, headers: headers)
    SafelistInstance.new(
        @version,
        payload,
        phone_number: @solution[:phone_number],
    )
end

#inspectObject

Provide a detailed, user friendly representation



124
125
126
127
# File 'lib/twilio-ruby/rest/verify/v2/safelist.rb', line 124

def inspect
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Verify.V2.SafelistContext #{context}>"
end

#to_sObject

Provide a user friendly representation



117
118
119
120
# File 'lib/twilio-ruby/rest/verify/v2/safelist.rb', line 117

def to_s
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Verify.V2.SafelistContext #{context}>"
end