Class: Twilio::REST::Bulkexports::V1::ExportConfigurationInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/bulkexports/v1/export_configuration.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, resource_type: nil) ⇒ ExportConfigurationInstance

Initialize the ExportConfigurationInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • resource_type (String) (defaults to: nil)

    The type of communication – Messages, Calls, Conferences, and Participants


130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/twilio-ruby/rest/bulkexports/v1/export_configuration.rb', line 130

def initialize(version, payload, resource_type: nil)
  super(version)

  # Marshaled Properties
  @properties = {
      'enabled' => payload['enabled'],
      'webhook_url' => payload['webhook_url'],
      'webhook_method' => payload['webhook_method'],
      'resource_type' => payload['resource_type'],
      'url' => payload['url'],
  }

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

Instance Method Details

#contextExportConfigurationContext

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

Returns:


151
152
153
154
155
156
# File 'lib/twilio-ruby/rest/bulkexports/v1/export_configuration.rb', line 151

def context
  unless @instance_context
    @instance_context = ExportConfigurationContext.new(@version, @params['resource_type'], )
  end
  @instance_context
end

#enabledBoolean

Returns Whether files are automatically generated.

Returns:

  • (Boolean)

    Whether files are automatically generated


160
161
162
# File 'lib/twilio-ruby/rest/bulkexports/v1/export_configuration.rb', line 160

def enabled
  @properties['enabled']
end

#fetchExportConfigurationInstance

Fetch the ExportConfigurationInstance

Returns:


191
192
193
# File 'lib/twilio-ruby/rest/bulkexports/v1/export_configuration.rb', line 191

def fetch
  context.fetch
end

#inspectObject

Provide a detailed, user friendly representation


218
219
220
221
# File 'lib/twilio-ruby/rest/bulkexports/v1/export_configuration.rb', line 218

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

#resource_typeString

Returns The type of communication – Messages, Calls, Conferences, and Participants.

Returns:

  • (String)

    The type of communication – Messages, Calls, Conferences, and Participants


178
179
180
# File 'lib/twilio-ruby/rest/bulkexports/v1/export_configuration.rb', line 178

def resource_type
  @properties['resource_type']
end

#to_sObject

Provide a user friendly representation


211
212
213
214
# File 'lib/twilio-ruby/rest/bulkexports/v1/export_configuration.rb', line 211

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

#update(enabled: :unset, webhook_url: :unset, webhook_method: :unset) ⇒ ExportConfigurationInstance

Update the ExportConfigurationInstance

Parameters:

  • enabled (Boolean) (defaults to: :unset)

    If true, Twilio will automatically generate every day's file when the day is over.

  • webhook_url (String) (defaults to: :unset)

    Stores the URL destination for the method specified in webhook_method.

  • webhook_method (String) (defaults to: :unset)

    Sets whether Twilio should call a webhook URL when the automatic generation is complete, using GET or POST. The actual destination is set in the webhook_url

Returns:


205
206
207
# File 'lib/twilio-ruby/rest/bulkexports/v1/export_configuration.rb', line 205

def update(enabled: :unset, webhook_url: :unset, webhook_method: :unset)
  context.update(enabled: enabled, webhook_url: webhook_url, webhook_method: webhook_method, )
end

#urlString

Returns The URL of this resource.

Returns:

  • (String)

    The URL of this resource.


184
185
186
# File 'lib/twilio-ruby/rest/bulkexports/v1/export_configuration.rb', line 184

def url
  @properties['url']
end

#webhook_methodString

Returns Whether to GET or POST to the webhook url.

Returns:

  • (String)

    Whether to GET or POST to the webhook url


172
173
174
# File 'lib/twilio-ruby/rest/bulkexports/v1/export_configuration.rb', line 172

def webhook_method
  @properties['webhook_method']
end

#webhook_urlString

Returns URL targeted at export.

Returns:

  • (String)

    URL targeted at export


166
167
168
# File 'lib/twilio-ruby/rest/bulkexports/v1/export_configuration.rb', line 166

def webhook_url
  @properties['webhook_url']
end