Class: Twilio::REST::Notify::V1::ServiceContext::UserContext::SegmentMembershipList

Inherits:
ListResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/notify/v1/service/user/segment_memberships.rb

Overview

PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.

Instance Method Summary collapse

Constructor Details

#initialize(version, service_sid: nil, identity: nil) ⇒ SegmentMembershipList

Initialize the SegmentMembershipList

Parameters:

  • version (Version)

    Version that contains the resource

  • service_sid (String) (defaults to: nil)

    The service_sid

  • identity (String) (defaults to: nil)

    The identity



22
23
24
25
26
27
28
# File 'lib/twilio-ruby/rest/notify/v1/service/user/segment_memberships.rb', line 22

def initialize(version, service_sid: nil, identity: nil)
  super(version)

  # Path Solution
  @solution = {service_sid: service_sid, identity: identity}
  @uri = "/Services/#{@solution[:service_sid]}/Users/#{@solution[:identity]}/SegmentMemberships"
end

Instance Method Details

#create(segment: nil) ⇒ SegmentMembershipInstance

Retrieve a single page of SegmentMembershipInstance records from the API. Request is executed immediately.

Parameters:

  • segment (String) (defaults to: nil)

    The segment

Returns:



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/twilio-ruby/rest/notify/v1/service/user/segment_memberships.rb', line 35

def create(segment: nil)
  data = Twilio::Values.of({'Segment' => segment})

  payload = @version.create(
      'POST',
      @uri,
      data: data
  )

  SegmentMembershipInstance.new(
      @version,
      payload,
      service_sid: @solution[:service_sid],
      identity: @solution[:identity],
  )
end

#to_sObject

Provide a user friendly representation



54
55
56
# File 'lib/twilio-ruby/rest/notify/v1/service/user/segment_memberships.rb', line 54

def to_s
  '#<Twilio.Notify.V1.SegmentMembershipList>'
end