Class: Twilio::REST::Voice::V2::ConfigurationContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Voice::V2::ConfigurationContext
- Defined in:
- lib/twilio-ruby/rest/voice/v2/configuration.rb
Instance Method Summary collapse
-
#create(voice_v2_configuration_request: :unset) ⇒ ConfigurationInstance
Create the ConfigurationInstance.
-
#create_with_metadata(voice_v2_configuration_request: :unset) ⇒ ConfigurationInstance
Create the ConfigurationInstanceMetadata.
-
#default ⇒ DefaultList, DefaultContext
Access the default.
-
#initialize(version, type) ⇒ ConfigurationContext
constructor
Initialize the ConfigurationContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
Constructor Details
#initialize(version, type) ⇒ ConfigurationContext
Initialize the ConfigurationContext
70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/twilio-ruby/rest/voice/v2/configuration.rb', line 70 def initialize(version, type) super(version) # Path Solution @solution = { type: type, } @uri = "/Configurations/#{@solution[:type]}" # Dependents @default = nil end |
Instance Method Details
#create(voice_v2_configuration_request: :unset) ⇒ ConfigurationInstance
Create the ConfigurationInstance
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/twilio-ruby/rest/voice/v2/configuration.rb', line 85 def create(voice_v2_configuration_request: :unset ) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) headers['Content-Type'] = 'application/json' payload = @version.create('POST', @uri, headers: headers, data: voice_v2_configuration_request.to_json) ConfigurationInstance.new( @version, payload, type: @solution[:type], ) end |
#create_with_metadata(voice_v2_configuration_request: :unset) ⇒ ConfigurationInstance
Create the ConfigurationInstanceMetadata
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/twilio-ruby/rest/voice/v2/configuration.rb', line 106 def (voice_v2_configuration_request: :unset ) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) headers['Content-Type'] = 'application/json' response = @version.('POST', @uri, headers: headers, data: voice_v2_configuration_request.to_json) configuration_instance = ConfigurationInstance.new( @version, response.body, type: @solution[:type], ) ConfigurationInstanceMetadata.new( @version, configuration_instance, response.headers, response.status_code ) end |
#default ⇒ DefaultList, DefaultContext
Access the default
133 134 135 136 137 138 139 |
# File 'lib/twilio-ruby/rest/voice/v2/configuration.rb', line 133 def default unless @default @default = DefaultList.new( @version, ) end @default end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
150 151 152 153 |
# File 'lib/twilio-ruby/rest/voice/v2/configuration.rb', line 150 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Voice.V2.ConfigurationContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
143 144 145 146 |
# File 'lib/twilio-ruby/rest/voice/v2/configuration.rb', line 143 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Voice.V2.ConfigurationContext #{context}>" end |