Class: Twilio::REST::Intelligence::V2::OperatorContext
- Inherits:
-
Twilio::REST::InstanceContext
- Object
- Twilio::REST::InstanceContext
- Twilio::REST::Intelligence::V2::OperatorContext
- Defined in:
- lib/twilio-ruby/rest/intelligence/v2/operator.rb
Instance Method Summary collapse
-
#fetch ⇒ OperatorInstance
Fetch the OperatorInstance.
-
#fetch_with_metadata ⇒ OperatorInstance
Fetch the OperatorInstanceMetadata.
-
#initialize(version, sid) ⇒ OperatorContext
constructor
Initialize the OperatorContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
Constructor Details
#initialize(version, sid) ⇒ OperatorContext
Initialize the OperatorContext
175 176 177 178 179 180 181 182 183 184 |
# File 'lib/twilio-ruby/rest/intelligence/v2/operator.rb', line 175 def initialize(version, sid) super(version) # Path Solution @solution = { sid: sid, } @uri = "/Operators/#{@solution[:sid]}" end |
Instance Method Details
#fetch ⇒ OperatorInstance
Fetch the OperatorInstance
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 |
# File 'lib/twilio-ruby/rest/intelligence/v2/operator.rb', line 188 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) OperatorInstance.new( @version, payload, sid: @solution[:sid], ) end |
#fetch_with_metadata ⇒ OperatorInstance
Fetch the OperatorInstanceMetadata
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 |
# File 'lib/twilio-ruby/rest/intelligence/v2/operator.rb', line 207 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('GET', @uri, headers: headers) operator_instance = OperatorInstance.new( @version, response.body, sid: @solution[:sid], ) OperatorInstanceMetadata.new( @version, operator_instance, response.headers, response.status_code ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
239 240 241 242 |
# File 'lib/twilio-ruby/rest/intelligence/v2/operator.rb', line 239 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Intelligence.V2.OperatorContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
232 233 234 235 |
# File 'lib/twilio-ruby/rest/intelligence/v2/operator.rb', line 232 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Intelligence.V2.OperatorContext #{context}>" end |