Class: Twilio::REST::Voice::V2::Configuration::DefaultList

Inherits:
ListResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/voice/v2/configuration/default.rb

Defined Under Namespace

Classes: DefaultConfigurationRequest

Instance Method Summary collapse

Constructor Details

#initialize(version, type: nil) ⇒ DefaultList

Initialize the DefaultList

Parameters:

  • version (Version)

    Version that contains the resource



42
43
44
45
46
47
48
49
# File 'lib/twilio-ruby/rest/voice/v2/configuration/default.rb', line 42

def initialize(version, type: nil)
    super(version)
    
    # Path Solution
    @solution = { type: type }
    @uri = "/Configurations/#{@solution[:type]}/Default"
    
end

Instance Method Details

#create(default_configuration_request: :unset) ⇒ DefaultInstance

Create the DefaultInstance

Parameters:

Returns:



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/twilio-ruby/rest/voice/v2/configuration/default.rb', line 54

def create(default_configuration_request: :unset
)

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    headers['Content-Type'] = 'application/json'
    
    
    
    
    payload = @version.create('POST', @uri, headers: headers, data: default_configuration_request.to_json)
    DefaultInstance.new(
        @version,
        payload,
        type: @solution[:type],
    )
end

#create_with_metadata(default_configuration_request: :unset) ⇒ DefaultInstance

Create the DefaultInstanceMetadata

Parameters:

Returns:



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/twilio-ruby/rest/voice/v2/configuration/default.rb', line 75

def (default_configuration_request: :unset
)

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    headers['Content-Type'] = 'application/json'
    
    
    
    
    response = @version.('POST', @uri, headers: headers, data: default_configuration_request.to_json)
    default_instance = DefaultInstance.new(
        @version,
        response.body,
        type: @solution[:type],
    )
    DefaultInstanceMetadata.new(
        @version,
        default_instance,
        response.headers,
        response.status_code
    )
end

#fetchDefaultInstance

Fetch the DefaultInstance

Returns:



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/twilio-ruby/rest/voice/v2/configuration/default.rb', line 101

def fetch

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.fetch('GET', @uri, headers: headers)
    DefaultInstance.new(
        @version,
        payload,
        type: @solution[:type],
    )
end

#fetch_with_metadataDefaultInstance

Fetch the DefaultInstanceMetadata

Returns:



120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# File 'lib/twilio-ruby/rest/voice/v2/configuration/default.rb', line 120

def 

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    response = @version.('GET', @uri, headers: headers)
    default_instance = DefaultInstance.new(
        @version,
        response.body,
        type: @solution[:type],
    )
    DefaultInstanceMetadata.new(
        @version,
        default_instance,
        response.headers,
        response.status_code
    )
end

#to_sObject

Provide a user friendly representation



146
147
148
# File 'lib/twilio-ruby/rest/voice/v2/configuration/default.rb', line 146

def to_s
    '#<Twilio.Voice.V2.DefaultList>'
end