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



160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/twilio-ruby/rest/notify/v1/service/user/segment_memberships.rb', line 160

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



199
200
201
# File 'lib/twilio-ruby/rest/notify/v1/service/user/segment_memberships.rb', line 199

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



185
186
187
188
189
190
191
192
193
194
195
# File 'lib/twilio-ruby/rest/notify/v1/service/user/segment_memberships.rb', line 185

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



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

def delete
  context.delete
end

#fetchSegmentMembershipInstance

Fetch a SegmentMembershipInstance



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

def fetch
  context.fetch
end

#identityString



211
212
213
# File 'lib/twilio-ruby/rest/notify/v1/service/user/segment_memberships.rb', line 211

def identity
  @properties['identity']
end

#inspectObject

Provide a detailed, user friendly representation



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

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

#segmentString



217
218
219
# File 'lib/twilio-ruby/rest/notify/v1/service/user/segment_memberships.rb', line 217

def segment
  @properties['segment']
end

#service_sidString



205
206
207
# File 'lib/twilio-ruby/rest/notify/v1/service/user/segment_memberships.rb', line 205

def service_sid
  @properties['service_sid']
end

#to_sObject

Provide a user friendly representation



243
244
245
246
# File 'lib/twilio-ruby/rest/notify/v1/service/user/segment_memberships.rb', line 243

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

#urlString



223
224
225
# File 'lib/twilio-ruby/rest/notify/v1/service/user/segment_memberships.rb', line 223

def url
  @properties['url']
end