Class: AFHTTPSessionManager

Inherits:
Object
  • Object
show all
Includes:
AFMotion::ClientShared
Defined in:
lib/afmotion/session_client.rb

Instance Method Summary collapse

Methods included from AFMotion::ClientShared

#all_headers, #authorization=, #create_multipart_operation, #create_operation, #headers, #multipart_post, #multipart_put

Instance Method Details

#PUT(url_string, options = {}) ⇒ Object

options = , constructingBodyWithBlock: , success:, failure:



130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/afmotion/session_client.rb', line 130

def PUT(url_string, options = {})
  parameters = options[:parameters]
  block = options[:constructingBodyWithBlock]
  success = options[:success]
  failure = options[:failure]

  request = self.requestSerializer.multipartFormRequestWithMethod("PUT", URLString: NSURL.URLWithString(url_string, relativeToURL: self.baseURL).absoluteString, parameters:parameters, constructingBodyWithBlock:block)

  task = self.dataTaskWithRequest(request, completionHandler: ->(response, responseObject, error) {
    if error && failure
      failure.call(task, error)
    elsif success
      success.call(task, responseObject)
    end
  })

  task.resume

  task
end