Class: Twilio::REST::Accounts::V1::SafelistList
- Inherits:
-
ListResource
- Object
- ListResource
- Twilio::REST::Accounts::V1::SafelistList
- Defined in:
- lib/twilio-ruby/rest/accounts/v1/safelist.rb
Instance Method Summary collapse
-
#create(phone_number: nil) ⇒ SafelistInstance
Create the SafelistInstance.
-
#create_with_metadata(phone_number: nil) ⇒ SafelistInstance
Create the SafelistInstanceMetadata.
-
#delete(phone_number: :unset) ⇒ Boolean
Delete the SafelistInstance.
-
#delete_with_metadata(phone_number: :unset) ⇒ Boolean
Delete the SafelistInstanceMetadata.
-
#fetch(phone_number: :unset) ⇒ SafelistInstance
Fetch the SafelistInstance.
-
#fetch_with_metadata(phone_number: :unset) ⇒ SafelistInstance
Fetch the SafelistInstanceMetadata.
-
#initialize(version) ⇒ SafelistList
constructor
Initialize the SafelistList.
-
#to_s ⇒ Object
Provide a user friendly representation.
Constructor Details
#initialize(version) ⇒ SafelistList
Initialize the SafelistList
26 27 28 29 30 31 32 33 |
# 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
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/twilio-ruby/rest/accounts/v1/safelist.rb', line 38 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 |
#create_with_metadata(phone_number: nil) ⇒ SafelistInstance
Create the SafelistInstanceMetadata
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/twilio-ruby/rest/accounts/v1/safelist.rb', line 63 def ( phone_number: nil ) data = Twilio::Values.of({ 'PhoneNumber' => phone_number, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('POST', @uri, data: data, headers: headers) safelist_instance = SafelistInstance.new( @version, response.body, ) SafelistInstanceMetadata.new( @version, safelist_instance, response.headers, response.status_code ) end |
#delete(phone_number: :unset) ⇒ Boolean
Delete the SafelistInstance
94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/twilio-ruby/rest/accounts/v1/safelist.rb', line 94 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 |
#delete_with_metadata(phone_number: :unset) ⇒ Boolean
Delete the SafelistInstanceMetadata
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/twilio-ruby/rest/accounts/v1/safelist.rb', line 113 def ( phone_number: :unset ) params = Twilio::Values.of({ 'PhoneNumber' => phone_number, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('DELETE', @uri, params: params, headers: headers) safelist_instance = SafelistInstance.new( @version, response.body, account_sid: @solution[:account_sid], sid: @solution[:sid], ) SafelistInstanceMetadata.new(@version, safelist_instance, response.headers, response.status_code) end |
#fetch(phone_number: :unset) ⇒ SafelistInstance
Fetch the SafelistInstance
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/twilio-ruby/rest/accounts/v1/safelist.rb', line 138 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 |
#fetch_with_metadata(phone_number: :unset) ⇒ SafelistInstance
Fetch the SafelistInstanceMetadata
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
# File 'lib/twilio-ruby/rest/accounts/v1/safelist.rb', line 162 def ( phone_number: :unset ) params = Twilio::Values.of({ 'PhoneNumber' => phone_number, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('GET', @uri, params: params, headers: headers) safelist_instance = SafelistInstance.new( @version, response.body, ) SafelistInstanceMetadata.new( @version, safelist_instance, response.headers, response.status_code ) end |
#to_s ⇒ Object
Provide a user friendly representation
192 193 194 |
# File 'lib/twilio-ruby/rest/accounts/v1/safelist.rb', line 192 def to_s '#<Twilio.Accounts.V1.SafelistList>' end |