-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #198 from woocommerce/develop
Merging Mark 0.4 into Master
- Loading branch information
Showing
116 changed files
with
5,256 additions
and
448 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
Networking/Networking/Extensions/CodingUserInfoKey+Woo.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import Foundation | ||
|
||
|
||
/// WooCommerce CodingUserInfoKey(s) | ||
/// | ||
extension CodingUserInfoKey { | ||
|
||
/// Used to store the SiteID within a Coder/Decoder's userInfo dictionary. | ||
/// | ||
public static let siteID = CodingUserInfoKey(rawValue: "siteID")! | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import Foundation | ||
|
||
|
||
/// Mapper: OrderNote (Singular) | ||
/// | ||
class OrderNoteMapper: Mapper { | ||
|
||
/// (Attempts) to convert a dictionary into a single OrderNote | ||
/// | ||
func map(response: Data) throws -> OrderNote { | ||
let decoder = JSONDecoder() | ||
decoder.dateDecodingStrategy = .formatted(DateFormatter.Defaults.dateTimeFormatter) | ||
|
||
return try decoder.decode(OrderNoteEnvelope.self, from: response).orderNote | ||
} | ||
} | ||
|
||
|
||
/// OrderNote Disposable Entity: | ||
/// `Add Order Note` endpoint the single added note within the `data` key. This entity | ||
/// allows us to parse all the things with JSONDecoder. | ||
/// | ||
private struct OrderNoteEnvelope: Decodable { | ||
let orderNote: OrderNote | ||
|
||
private enum CodingKeys: String, CodingKey { | ||
case orderNote = "data" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.