Class: Twilio::REST::IpMessaging::V2::ServiceContext::ChannelContext::InviteContext

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

Instance Method Summary collapse

Constructor Details

#initialize(version, service_sid, channel_sid, sid) ⇒ InviteContext

Initialize the InviteContext

Parameters:

  • version (Version)

    Version that contains the resource

  • service_sid (String)

    The SID of the [Service](www.twilio.com/docs/chat/rest/services) to fetch the Invite resource from.

  • channel_sid (String)

    The SID of the [Channel](www.twilio.com/docs/chat/channels) the Invite resource to fetch belongs to. This value can be the Channel resource’s ‘sid` or `unique_name`.

  • sid (String)

    The SID of the Invite resource to fetch.



210
211
212
213
214
215
216
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/channel/invite.rb', line 210

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

  # Path Solution
  @solution = {service_sid: service_sid, channel_sid: channel_sid, sid: sid, }
  @uri = "/Services/#{@solution[:service_sid]}/Channels/#{@solution[:channel_sid]}/Invites/#{@solution[:sid]}"
end

Instance Method Details

#deleteBoolean

Deletes the InviteInstance

Returns:

  • (Boolean)

    true if delete succeeds, false otherwise



242
243
244
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/channel/invite.rb', line 242

def delete
  @version.delete('delete', @uri)
end

#fetchInviteInstance

Fetch a InviteInstance

Returns:



221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/channel/invite.rb', line 221

def fetch
  params = Twilio::Values.of({})

  payload = @version.fetch(
      'GET',
      @uri,
      params,
  )

  InviteInstance.new(
      @version,
      payload,
      service_sid: @solution[:service_sid],
      channel_sid: @solution[:channel_sid],
      sid: @solution[:sid],
  )
end

#inspectObject

Provide a detailed, user friendly representation



255
256
257
258
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/channel/invite.rb', line 255

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

#to_sObject

Provide a user friendly representation



248
249
250
251
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/channel/invite.rb', line 248

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