Class: Twilio::REST::Content::V1::ContentContext::ApprovalCreateList

Inherits:
ListResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/content/v1/content/approval_create.rb

Defined Under Namespace

Classes: ContentApprovalRequest, ContentApprovalUpdateRequest

Instance Method Summary collapse

Constructor Details

#initialize(version, content_sid: nil) ⇒ ApprovalCreateList

Initialize the ApprovalCreateList

Parameters:

  • version (Version) —

    Version that contains the resource



100
101
102
103
104
105
106
107
# File 'lib/twilio-ruby/rest/content/v1/content/approval_create.rb', line 100

def initialize(version, content_sid: nil)
    super(version)
    
    # Path Solution
    @solution = { content_sid: content_sid }
    @uri = "/Content/#{@solution[:content_sid]}/ApprovalRequests/whatsapp"
    
end

Instance Method Details

#create(content_approval_request: nil) ⇒ ApprovalCreateInstance

Create the ApprovalCreateInstance

Parameters:

Returns:



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/twilio-ruby/rest/content/v1/content/approval_create.rb', line 112

def create(content_approval_request: nil
)

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

#create_with_metadata(content_approval_request: nil) ⇒ ApprovalCreateInstance

Create the ApprovalCreateInstanceMetadata

Parameters:

Returns:



133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/twilio-ruby/rest/content/v1/content/approval_create.rb', line 133

def (content_approval_request: nil
)

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    headers['Content-Type'] = 'application/json'
    
    
    
    
    response = @version.('POST', @uri, headers: headers, data: content_approval_request.to_json)
    approval_create_instance = ApprovalCreateInstance.new(
        @version,
        response.body,
        content_sid: @solution[:content_sid],
    )
    ApprovalCreateInstanceMetadata.new(
        @version,
        approval_create_instance,
        response.headers,
        response.status_code
    )
end

#to_s ⇒ Object

Provide a user friendly representation



208
209
210
# File 'lib/twilio-ruby/rest/content/v1/content/approval_create.rb', line 208

def to_s
    '#<Twilio.Content.V1.ApprovalCreateList>'
end

#update(content_approval_update_request: nil) ⇒ ApprovalCreateInstance

Update the ApprovalCreateInstance

Parameters:

Returns:



160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# File 'lib/twilio-ruby/rest/content/v1/content/approval_create.rb', line 160

def update(content_approval_update_request: nil
)

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    headers['Content-Type'] = 'application/json'
    
    
    
    
    payload = @version.update('PATCH', @uri, headers: headers, data: content_approval_update_request.to_json)
    ApprovalCreateInstance.new(
        @version,
        payload,
        content_sid: @solution[:content_sid],
    )
end

#update_with_metadata(content_approval_update_request: nil) ⇒ ApprovalCreateInstance

Update the ApprovalCreateInstanceMetadata

Parameters:

Returns:



181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
# File 'lib/twilio-ruby/rest/content/v1/content/approval_create.rb', line 181

def (content_approval_update_request: nil
)

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    headers['Content-Type'] = 'application/json'
    
    
    
    
    response = @version.('PATCH', @uri, headers: headers, data: content_approval_update_request.to_json)
    approval_create_instance = ApprovalCreateInstance.new(
        @version,
        response.body,
        content_sid: @solution[:content_sid],
    )
    ApprovalCreateInstanceMetadata.new(
        @version,
        approval_create_instance,
        response.headers,
        response.status_code
    )
end