Class: Twilio::REST::Messaging::V1::DeactivationsInstance

Inherits:
InstanceResource show all
Defined in:
lib/twilio-ruby/rest/messaging/v1/deactivations.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload) ⇒ DeactivationsInstance

Initialize the DeactivationsInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • account_sid (String)

    The SID of the Account that created this Deactivations resource.

  • sid (String)

    The SID of the Call resource to fetch.



128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/twilio-ruby/rest/messaging/v1/deactivations.rb', line 128

def initialize(version, payload )
    super(version)
    
    # Marshaled Properties
    @properties = { 
        'redirect_to' => payload['redirect_to'],
    }

    # Context
    @instance_context = nil
    @params = {  }
end

Instance Method Details

#contextDeactivationsContext

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

Returns:



145
146
147
148
149
150
# File 'lib/twilio-ruby/rest/messaging/v1/deactivations.rb', line 145

def context
    unless @instance_context
        @instance_context = DeactivationsContext.new(@version )
    end
    @instance_context
end

#fetch(date: :unset) ⇒ DeactivationsInstance

Fetch the DeactivationsInstance

Parameters:

  • date (Date) (defaults to: :unset)

    The request will return a list of all United States Phone Numbers that were deactivated on the day specified by this parameter. This date should be specified in YYYY-MM-DD format.

Returns:



162
163
164
165
166
167
168
169
# File 'lib/twilio-ruby/rest/messaging/v1/deactivations.rb', line 162

def fetch(
    date: :unset
)

    context.fetch(
        date: date, 
    )
end

#inspectObject

Provide a detailed, user friendly representation



180
181
182
183
# File 'lib/twilio-ruby/rest/messaging/v1/deactivations.rb', line 180

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

#redirect_toString

Returns an authenticated url that redirects to a file containing the deactivated numbers for the requested day. This url is valid for up to two minutes.

Returns:

  • (String)

    Returns an authenticated url that redirects to a file containing the deactivated numbers for the requested day. This url is valid for up to two minutes.



154
155
156
# File 'lib/twilio-ruby/rest/messaging/v1/deactivations.rb', line 154

def redirect_to
    @properties['redirect_to']
end

#to_sObject

Provide a user friendly representation



173
174
175
176
# File 'lib/twilio-ruby/rest/messaging/v1/deactivations.rb', line 173

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