Class: Twilio::REST::Accounts::V1::SafelistList

Inherits:
ListResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/accounts/v1/safelist.rb

Instance Method Summary collapse

Constructor Details

#initialize(version) ⇒ SafelistList

Initialize the SafelistList

Parameters:

  • version (Version)

    Version that contains the resource



26
27
28
29
30
31
32
# File 'lib/twilio-ruby/rest/accounts/v1/safelist.rb', line 26

def initialize(version)
    super(version)
    # Path Solution
    @solution = {  }
    @uri = "/SafeList/Numbers"
    
end

Instance Method Details

#create(phone_number: nil) ⇒ SafelistInstance

Create the SafelistInstance

Parameters:

Returns:



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/twilio-ruby/rest/accounts/v1/safelist.rb', line 37

def create(
    phone_number: nil
)

    data = Twilio::Values.of({
        'PhoneNumber' => phone_number,
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.create('POST', @uri, data: data, headers: headers)
    SafelistInstance.new(
        @version,
        payload,
    )
end

#delete(phone_number: :unset) ⇒ Boolean

Delete the SafelistInstance

Parameters:

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/twilio-ruby/rest/accounts/v1/safelist.rb', line 62

def delete(
    phone_number: :unset
)

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

#fetch(phone_number: :unset) ⇒ SafelistInstance

Fetch the SafelistInstance

Parameters:

Returns:



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/twilio-ruby/rest/accounts/v1/safelist.rb', line 80

def fetch(
    phone_number: :unset
)

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

#to_sObject

Provide a user friendly representation



104
105
106
# File 'lib/twilio-ruby/rest/accounts/v1/safelist.rb', line 104

def to_s
    '#<Twilio.Accounts.V1.SafelistList>'
end