Skip to content
This repository has been archived by the owner on Jan 28, 2019. It is now read-only.

Commit

Permalink
Merge pull request #8 from SlackKit/rename
Browse files Browse the repository at this point in the history
Rename url to requestURL
  • Loading branch information
pvzig authored Aug 7, 2017
2 parents 696fae3 + 945c6c0 commit c1b6169
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Sources/NetworkInterface.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public struct NetworkInterface {
successClosure: @escaping ([String: Any]) -> Void,
errorClosure: @escaping (SlackError) -> Void
) {
guard let url = self.url(for: endpoint, parameters: parameters) else {
guard let url = requestURL(for: endpoint, parameters: parameters) else {
errorClosure(SlackError.clientNetworkError)
return
}
Expand All @@ -57,7 +57,7 @@ public struct NetworkInterface {

//Adapted from https://gist.github.com/erica/baa8a187a5b4796dab27
internal func synchronusRequest(_ endpoint: Endpoint, parameters: [String: Any?]) -> [String: Any]? {
guard let url = self.url(for: endpoint, parameters: parameters) else {
guard let url = requestURL(for: endpoint, parameters: parameters) else {
return nil
}
let request = URLRequest(url: url)
Expand Down Expand Up @@ -107,7 +107,7 @@ public struct NetworkInterface {
successClosure: @escaping ([String: Any]) -> Void, errorClosure: @escaping (SlackError) -> Void
) {
guard
let url = self.url(for: Endpoint.filesUpload, parameters: parameters),
let url = requestURL(for: .filesUpload, parameters: parameters),
let filename = parameters["filename"] as? String,
let filetype = parameters["filetype"] as? String
else {
Expand Down Expand Up @@ -164,7 +164,7 @@ public struct NetworkInterface {
}
}

private func url(for endpoint: Endpoint, parameters: [String: Any?]) -> URL? {
private func requestURL(for endpoint: Endpoint, parameters: [String: Any?]) -> URL? {
var components = URLComponents(string: "\(apiUrl)\(endpoint.rawValue)")
if parameters.count > 0 {
components?.queryItems = filterNilParameters(parameters).map { URLQueryItem(name: $0.0, value: "\($0.1)") }
Expand Down

0 comments on commit c1b6169

Please sign in to comment.