Class: Twilio::REST::Messaging::V1::LinkshorteningMessagingServiceInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/messaging/v1/linkshortening_messaging_service.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, domain_sid: nil, messaging_service_sid: nil) ⇒ LinkshorteningMessagingServiceInstance

Initialize the LinkshorteningMessagingServiceInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • domain_sid (String) (defaults to: nil)

    The domain SID to dissociate from a messaging service. With URL shortening enabled, links in messages sent with the associated messaging service will be shortened to the provided domain

  • messaging_service_sid (String) (defaults to: nil)

    A messaging service SID to dissociate from a domain. With URL shortening enabled, links in messages sent with the provided messaging service will be shortened to the associated domain



136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# File 'lib/twilio-ruby/rest/messaging/v1/linkshortening_messaging_service.rb', line 136

def initialize(version, payload, domain_sid: nil, messaging_service_sid: nil)
  super(version)

  # Marshaled Properties
  @properties = {
      'domain_sid' => payload['domain_sid'],
      'messaging_service_sid' => payload['messaging_service_sid'],
      'url' => payload['url'],
  }

  # Context
  @instance_context = nil
  @params = {
      'domain_sid' => domain_sid || @properties['domain_sid'],
      'messaging_service_sid' => messaging_service_sid || @properties['messaging_service_sid'],
  }
end

Instance Method Details

#contextLinkshorteningMessagingServiceContext

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

Returns:



158
159
160
161
162
163
164
165
166
167
# File 'lib/twilio-ruby/rest/messaging/v1/linkshortening_messaging_service.rb', line 158

def context
  unless @instance_context
    @instance_context = LinkshorteningMessagingServiceContext.new(
        @version,
        @params['domain_sid'],
        @params['messaging_service_sid'],
    )
  end
  @instance_context
end

#createLinkshorteningMessagingServiceInstance

Create the LinkshorteningMessagingServiceInstance

Returns:



190
191
192
# File 'lib/twilio-ruby/rest/messaging/v1/linkshortening_messaging_service.rb', line 190

def create
  context.create
end

#deleteBoolean

Delete the LinkshorteningMessagingServiceInstance

Returns:

  • (Boolean)

    true if delete succeeds, false otherwise



197
198
199
# File 'lib/twilio-ruby/rest/messaging/v1/linkshortening_messaging_service.rb', line 197

def delete
  context.delete
end

#domain_sidString

Returns The unique string that identifies the domain resource.

Returns:

  • (String)

    The unique string that identifies the domain resource



171
172
173
# File 'lib/twilio-ruby/rest/messaging/v1/linkshortening_messaging_service.rb', line 171

def domain_sid
  @properties['domain_sid']
end

#inspectObject

Provide a detailed, user friendly representation



210
211
212
213
# File 'lib/twilio-ruby/rest/messaging/v1/linkshortening_messaging_service.rb', line 210

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

#messaging_service_sidString

Returns The unique string that identifies the messaging service.

Returns:

  • (String)

    The unique string that identifies the messaging service



177
178
179
# File 'lib/twilio-ruby/rest/messaging/v1/linkshortening_messaging_service.rb', line 177

def messaging_service_sid
  @properties['messaging_service_sid']
end

#to_sObject

Provide a user friendly representation



203
204
205
206
# File 'lib/twilio-ruby/rest/messaging/v1/linkshortening_messaging_service.rb', line 203

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

#urlString

Returns The url.

Returns:

  • (String)

    The url



183
184
185
# File 'lib/twilio-ruby/rest/messaging/v1/linkshortening_messaging_service.rb', line 183

def url
  @properties['url']
end