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

Inherits:
InstanceResource
  • 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, payload, service_sid: nil, identity: nil, segment: nil) ⇒ SegmentMembershipInstance

Initialize the SegmentMembershipInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • service_sid (String) (defaults to: nil)

    The service_sid

  • identity (String) (defaults to: nil)

    The identity

  • segment (String) (defaults to: nil)

    The segment



169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# File 'lib/twilio-ruby/rest/notify/v1/service/user/segment_memberships.rb', line 169

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

  # Marshaled Properties
  @properties = {
      'account_sid' => payload['account_sid'],
      'service_sid' => payload['service_sid'],
      'identity' => payload['identity'],
      'segment' => payload['segment'],
      'url' => payload['url'],
  }

  # Context
  @instance_context = nil
  @params = {
      'service_sid' => service_sid,
      'identity' => identity,
      'segment' => segment || @properties['segment'],
  }
end

Instance Method Details

#account_sidString

Returns The account_sid.

Returns:

  • (String)

    The account_sid



208
209
210
# File 'lib/twilio-ruby/rest/notify/v1/service/user/segment_memberships.rb', line 208

def 
  @properties['account_sid']
end

#contextSegmentMembershipContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:



194
195
196
197
198
199
200
201
202
203
204
# File 'lib/twilio-ruby/rest/notify/v1/service/user/segment_memberships.rb', line 194

def context
  unless @instance_context
    @instance_context = SegmentMembershipContext.new(
        @version,
        @params['service_sid'],
        @params['identity'],
        @params['segment'],
    )
  end
  @instance_context
end

#deleteBoolean

Deletes the SegmentMembershipInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



239
240
241
# File 'lib/twilio-ruby/rest/notify/v1/service/user/segment_memberships.rb', line 239

def delete
  context.delete
end

#fetchSegmentMembershipInstance

Fetch a SegmentMembershipInstance

Returns:



246
247
248
# File 'lib/twilio-ruby/rest/notify/v1/service/user/segment_memberships.rb', line 246

def fetch
  context.fetch
end

#identityString

Returns The identity.

Returns:

  • (String)

    The identity



220
221
222
# File 'lib/twilio-ruby/rest/notify/v1/service/user/segment_memberships.rb', line 220

def identity
  @properties['identity']
end

#inspectObject

Provide a detailed, user friendly representation



259
260
261
262
# File 'lib/twilio-ruby/rest/notify/v1/service/user/segment_memberships.rb', line 259

def inspect
  values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Notify.V1.SegmentMembershipInstance #{values}>"
end

#segmentString

Returns The segment.

Returns:

  • (String)

    The segment



226
227
228
# File 'lib/twilio-ruby/rest/notify/v1/service/user/segment_memberships.rb', line 226

def segment
  @properties['segment']
end

#service_sidString

Returns The service_sid.

Returns:

  • (String)

    The service_sid



214
215
216
# File 'lib/twilio-ruby/rest/notify/v1/service/user/segment_memberships.rb', line 214

def service_sid
  @properties['service_sid']
end

#to_sObject

Provide a user friendly representation



252
253
254
255
# File 'lib/twilio-ruby/rest/notify/v1/service/user/segment_memberships.rb', line 252

def to_s
  values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Notify.V1.SegmentMembershipInstance #{values}>"
end

#urlString

Returns The url.

Returns:

  • (String)

    The url



232
233
234
# File 'lib/twilio-ruby/rest/notify/v1/service/user/segment_memberships.rb', line 232

def url
  @properties['url']
end