Class: Twilio::REST::Voice::V2::TypeContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Voice::V2::TypeContext
- Defined in:
- lib/twilio-ruby/rest/voice/v2/type.rb
Instance Method Summary collapse
-
#delete ⇒ Boolean
Delete the TypeInstance.
-
#delete_with_metadata ⇒ Boolean
Delete the TypeInstanceMetadata.
-
#fetch ⇒ TypeInstance
Fetch the TypeInstance.
-
#fetch_with_metadata ⇒ TypeInstance
Fetch the TypeInstanceMetadata.
-
#initialize(version, type, id_or_unique_name) ⇒ TypeContext
constructor
Initialize the TypeContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(voice_v2_configuration_request: :unset) ⇒ TypeInstance
Update the TypeInstance.
-
#update_with_metadata(voice_v2_configuration_request: :unset) ⇒ TypeInstance
Update the TypeInstanceMetadata.
Constructor Details
#initialize(version, type, id_or_unique_name) ⇒ TypeContext
Initialize the TypeContext
71 72 73 74 75 76 77 78 79 80 |
# File 'lib/twilio-ruby/rest/voice/v2/type.rb', line 71 def initialize(version, type, id_or_unique_name) super(version) # Path Solution @solution = { type: type, id_or_unique_name: id_or_unique_name, } @uri = "/Configurations/#{@solution[:type]}/#{@solution[:id_or_unique_name]}" end |
Instance Method Details
#delete ⇒ Boolean
Delete the TypeInstance
84 85 86 87 88 89 90 91 92 |
# File 'lib/twilio-ruby/rest/voice/v2/type.rb', line 84 def delete headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) @version.delete('DELETE', @uri, headers: headers) end |
#delete_with_metadata ⇒ Boolean
Delete the TypeInstanceMetadata
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/twilio-ruby/rest/voice/v2/type.rb', line 97 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('DELETE', @uri, headers: headers) type_instance = TypeInstance.new( @version, response.body, account_sid: @solution[:account_sid], sid: @solution[:sid], ) TypeInstanceMetadata.new(@version, type_instance, response.headers, response.status_code) end |
#fetch ⇒ TypeInstance
Fetch the TypeInstance
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/twilio-ruby/rest/voice/v2/type.rb', line 116 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) TypeInstance.new( @version, payload, type: @solution[:type], id_or_unique_name: @solution[:id_or_unique_name], ) end |
#fetch_with_metadata ⇒ TypeInstance
Fetch the TypeInstanceMetadata
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
# File 'lib/twilio-ruby/rest/voice/v2/type.rb', line 136 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('GET', @uri, headers: headers) type_instance = TypeInstance.new( @version, response.body, type: @solution[:type], id_or_unique_name: @solution[:id_or_unique_name], ) TypeInstanceMetadata.new( @version, type_instance, response.headers, response.status_code ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
219 220 221 222 |
# File 'lib/twilio-ruby/rest/voice/v2/type.rb', line 219 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Voice.V2.TypeContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
212 213 214 215 |
# File 'lib/twilio-ruby/rest/voice/v2/type.rb', line 212 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Voice.V2.TypeContext #{context}>" end |
#update(voice_v2_configuration_request: :unset) ⇒ TypeInstance
Update the TypeInstance
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 |
# File 'lib/twilio-ruby/rest/voice/v2/type.rb', line 163 def update(voice_v2_configuration_request: :unset ) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) headers['Content-Type'] = 'application/json' payload = @version.update('PUT', @uri, headers: headers, data: voice_v2_configuration_request.to_json) TypeInstance.new( @version, payload, type: @solution[:type], id_or_unique_name: @solution[:id_or_unique_name], ) end |
#update_with_metadata(voice_v2_configuration_request: :unset) ⇒ TypeInstance
Update the TypeInstanceMetadata
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 |
# File 'lib/twilio-ruby/rest/voice/v2/type.rb', line 185 def (voice_v2_configuration_request: :unset ) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) headers['Content-Type'] = 'application/json' response = @version.('PUT', @uri, headers: headers, data: voice_v2_configuration_request.to_json) type_instance = TypeInstance.new( @version, response.body, type: @solution[:type], id_or_unique_name: @solution[:id_or_unique_name], ) TypeInstanceMetadata.new( @version, type_instance, response.headers, response.status_code ) end |