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
29
30
31
# 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:



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/twilio-ruby/rest/notify/v1/service/user/segment_memberships.rb', line 38

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



59
60
61
# File 'lib/twilio-ruby/rest/notify/v1/service/user/segment_memberships.rb', line 59

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