Class: Twilio::REST::Intelligence::V2::OperatorAttachmentContext

Inherits:
Twilio::REST::InstanceContext show all
Defined in:
lib/twilio-ruby/rest/intelligence/v2/operator_attachment.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, service_sid, operator_sid) ⇒ OperatorAttachmentContext

Initialize the OperatorAttachmentContext

Parameters:

  • version (Version)

    Version that contains the resource

  • service_sid (String)

    The unique SID identifier of the Service.

  • operator_sid (String)

    The unique SID identifier of the Operator. Allows both Custom and Pre-built Operators.



51
52
53
54
55
56
57
58
59
60
# File 'lib/twilio-ruby/rest/intelligence/v2/operator_attachment.rb', line 51

def initialize(version, service_sid, operator_sid)
    super(version)
    

    # Path Solution
    @solution = { service_sid: service_sid, operator_sid: operator_sid,  }
    @uri = "/Services/#{@solution[:service_sid]}/Operators/#{@solution[:operator_sid]}"

    
end

Instance Method Details

#createOperatorAttachmentInstance

Create the OperatorAttachmentInstance

Returns:



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/twilio-ruby/rest/intelligence/v2/operator_attachment.rb', line 64

def create

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.create('POST', @uri, headers: headers)
    OperatorAttachmentInstance.new(
        @version,
        payload,
        service_sid: @solution[:service_sid],
        operator_sid: @solution[:operator_sid],
    )
end

#create_with_metadataOperatorAttachmentInstance

Create the OperatorAttachmentInstanceMetadata

Returns:



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/twilio-ruby/rest/intelligence/v2/operator_attachment.rb', line 84

def 

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    response = @version.('POST', @uri, headers: headers)
    operator_attachment_instance = OperatorAttachmentInstance.new(
        @version,
        response.body,
        service_sid: @solution[:service_sid],
        operator_sid: @solution[:operator_sid],
    )
    .new(
        @version,
        operator_attachment_instance,
        response.headers,
        response.status_code
    )
end

#deleteBoolean

Delete the OperatorAttachmentInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



110
111
112
113
114
115
116
117
118
# File 'lib/twilio-ruby/rest/intelligence/v2/operator_attachment.rb', line 110

def delete

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    

    @version.delete('DELETE', @uri, headers: headers)
end

#delete_with_metadataBoolean

Delete the OperatorAttachmentInstanceMetadata

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/twilio-ruby/rest/intelligence/v2/operator_attachment.rb', line 123

def 

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
      response = @version.('DELETE', @uri, headers: headers)
      operatorAttachment_instance = OperatorAttachmentInstance.new(
          @version,
          response.body,
          account_sid: @solution[:account_sid],
          sid: @solution[:sid],
      )
      .new(@version, operatorAttachment_instance, response.headers, response.status_code)
end

#inspectObject

Provide a detailed, user friendly representation



149
150
151
152
# File 'lib/twilio-ruby/rest/intelligence/v2/operator_attachment.rb', line 149

def inspect
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Intelligence.V2.OperatorAttachmentContext #{context}>"
end

#to_sObject

Provide a user friendly representation



142
143
144
145
# File 'lib/twilio-ruby/rest/intelligence/v2/operator_attachment.rb', line 142

def to_s
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Intelligence.V2.OperatorAttachmentContext #{context}>"
end