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

Inherits:
InstanceContext
  • 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, identity, segment) ⇒ SegmentMembershipContext

Initialize the SegmentMembershipContext

Parameters:

  • version (Version)

    Version that contains the resource

  • service_sid (String)

    The service_sid

  • identity (String)

    The identity

  • segment (String)

    The segment



110
111
112
113
114
115
116
117
118
119
120
# File 'lib/twilio-ruby/rest/notify/v1/service/user/segment_memberships.rb', line 110

def initialize(version, service_sid, identity, segment)
  super(version)

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

Instance Method Details

#deleteBoolean

Deletes the SegmentMembershipInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



125
126
127
# File 'lib/twilio-ruby/rest/notify/v1/service/user/segment_memberships.rb', line 125

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

#fetchSegmentMembershipInstance

Fetch a SegmentMembershipInstance

Returns:



132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/twilio-ruby/rest/notify/v1/service/user/segment_memberships.rb', line 132

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

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

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

#to_sObject

Provide a user friendly representation



152
153
154
155
# File 'lib/twilio-ruby/rest/notify/v1/service/user/segment_memberships.rb', line 152

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