Class: Twilio::REST::Bulkexports::V1::ExportConfigurationContext

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

Instance Method Summary collapse

Constructor Details

#initialize(version, resource_type) ⇒ ExportConfigurationContext

Initialize the ExportConfigurationContext

Parameters:

  • version (Version)

    Version that contains the resource

  • resource_type (String)

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



48
49
50
51
52
53
54
55
56
# File 'lib/twilio-ruby/rest/bulkexports/v1/export_configuration.rb', line 48

def initialize(version, resource_type)
    super(version)

    # Path Solution
    @solution = { resource_type: resource_type,  }
    @uri = "/Exports/#{@solution[:resource_type]}/Configuration"

    
end

Instance Method Details

#fetchExportConfigurationInstance

Fetch the ExportConfigurationInstance

Returns:



60
61
62
63
64
65
66
67
68
# File 'lib/twilio-ruby/rest/bulkexports/v1/export_configuration.rb', line 60

def fetch

    payload = @version.fetch('GET', @uri)
    ExportConfigurationInstance.new(
        @version,
        payload,
        resource_type: @solution[:resource_type],
    )
end

#inspectObject

Provide a detailed, user friendly representation



106
107
108
109
# File 'lib/twilio-ruby/rest/bulkexports/v1/export_configuration.rb', line 106

def inspect
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Bulkexports.V1.ExportConfigurationContext #{context}>"
end

#to_sObject

Provide a user friendly representation



99
100
101
102
# File 'lib/twilio-ruby/rest/bulkexports/v1/export_configuration.rb', line 99

def to_s
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Bulkexports.V1.ExportConfigurationContext #{context}>"
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:



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/twilio-ruby/rest/bulkexports/v1/export_configuration.rb', line 76

def update(
    enabled: :unset, 
    webhook_url: :unset, 
    webhook_method: :unset
)

    data = Twilio::Values.of({
        'Enabled' => enabled,
        'WebhookUrl' => webhook_url,
        'WebhookMethod' => webhook_method,
    })

    payload = @version.update('POST', @uri, data: data)
    ExportConfigurationInstance.new(
        @version,
        payload,
        resource_type: @solution[:resource_type],
    )
end