Class: Twilio::REST::Voice::V1::ConnectionPolicyContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Voice::V1::ConnectionPolicyContext
- Defined in:
- lib/twilio-ruby/rest/voice/v1/connection_policy.rb,
lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb
Defined Under Namespace
Classes: ConnectionPolicyTargetContext, ConnectionPolicyTargetInstance, ConnectionPolicyTargetList, ConnectionPolicyTargetPage
Instance Method Summary collapse
-
#delete ⇒ Boolean
Delete the ConnectionPolicyInstance.
-
#fetch ⇒ ConnectionPolicyInstance
Fetch the ConnectionPolicyInstance.
-
#initialize(version, sid) ⇒ ConnectionPolicyContext
constructor
Initialize the ConnectionPolicyContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#targets(sid = :unset) ⇒ ConnectionPolicyTargetList, ConnectionPolicyTargetContext
Access the targets.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(friendly_name: :unset) ⇒ ConnectionPolicyInstance
Update the ConnectionPolicyInstance.
Constructor Details
#initialize(version, sid) ⇒ ConnectionPolicyContext
Initialize the ConnectionPolicyContext
161 162 163 164 165 166 167 168 169 170 |
# File 'lib/twilio-ruby/rest/voice/v1/connection_policy.rb', line 161 def initialize(version, sid) super(version) # Path Solution @solution = { sid: sid, } @uri = "/ConnectionPolicies/#{@solution[:sid]}" # Dependents @targets = nil end |
Instance Method Details
#delete ⇒ Boolean
Delete the ConnectionPolicyInstance
174 175 176 177 178 179 180 181 |
# File 'lib/twilio-ruby/rest/voice/v1/connection_policy.rb', line 174 def delete headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) @version.delete('DELETE', @uri, headers: headers) end |
#fetch ⇒ ConnectionPolicyInstance
Fetch the ConnectionPolicyInstance
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 |
# File 'lib/twilio-ruby/rest/voice/v1/connection_policy.rb', line 186 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) ConnectionPolicyInstance.new( @version, payload, sid: @solution[:sid], ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
257 258 259 260 |
# File 'lib/twilio-ruby/rest/voice/v1/connection_policy.rb', line 257 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Voice.V1.ConnectionPolicyContext #{context}>" end |
#targets(sid = :unset) ⇒ ConnectionPolicyTargetList, ConnectionPolicyTargetContext
Access the targets
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 |
# File 'lib/twilio-ruby/rest/voice/v1/connection_policy.rb', line 232 def targets(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return ConnectionPolicyTargetContext.new(@version, @solution[:sid],sid ) end unless @targets @targets = ConnectionPolicyTargetList.new( @version, connection_policy_sid: @solution[:sid], ) end @targets end |
#to_s ⇒ Object
Provide a user friendly representation
250 251 252 253 |
# File 'lib/twilio-ruby/rest/voice/v1/connection_policy.rb', line 250 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Voice.V1.ConnectionPolicyContext #{context}>" end |
#update(friendly_name: :unset) ⇒ ConnectionPolicyInstance
Update the ConnectionPolicyInstance
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 |
# File 'lib/twilio-ruby/rest/voice/v1/connection_policy.rb', line 206 def update( friendly_name: :unset ) data = Twilio::Values.of({ 'FriendlyName' => friendly_name, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.update('POST', @uri, data: data, headers: headers) ConnectionPolicyInstance.new( @version, payload, sid: @solution[:sid], ) end |