Class: Twilio::REST::IpMessaging::V2::ServiceContext::UserContext::UserBindingContext

Inherits:
Twilio::REST::InstanceContext show all
Defined in:
lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_binding.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, service_sid, user_sid, sid) ⇒ UserBindingContext

Initialize the UserBindingContext

Parameters:

  • version (Version)

    Version that contains the resource

  • service_sid (String)
  • user_sid (String)
  • sid (String)


148
149
150
151
152
153
154
155
156
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_binding.rb', line 148

def initialize(version, service_sid, user_sid, sid)
    super(version)

    # Path Solution
    @solution = { service_sid: service_sid, user_sid: user_sid, sid: sid,  }
    @uri = "/Services/#{@solution[:service_sid]}/Users/#{@solution[:user_sid]}/Bindings/#{@solution[:sid]}"

    
end

Instance Method Details

#deleteBoolean

Delete the UserBindingInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



160
161
162
163
164
165
166
167
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_binding.rb', line 160

def delete

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    @version.delete('DELETE', @uri, headers: headers)
end

#fetchUserBindingInstance

Fetch the UserBindingInstance

Returns:



172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_binding.rb', line 172

def fetch

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.fetch('GET', @uri, headers: headers)
    UserBindingInstance.new(
        @version,
        payload,
        service_sid: @solution[:service_sid],
        user_sid: @solution[:user_sid],
        sid: @solution[:sid],
    )
end

#inspectObject

Provide a detailed, user friendly representation



200
201
202
203
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_binding.rb', line 200

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

#to_sObject

Provide a user friendly representation



193
194
195
196
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_binding.rb', line 193

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