-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Networking: Remote Infrastructure #54
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Needs a little 💟on some nitpicky spelling items, then !
|
||
/// Date And Time Formatter | ||
/// | ||
static let dateTimeFormatter: DateFormatter = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this not part of the WPShared pod? I thought it had several date helpers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't really checked! but since it's a Woo-Backend format, it's okay to add a few lines here (vs linking an entire dependency!!). Goal is to keep this fellow as lightweight as possible ❤️
} | ||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nuke extra line
|
||
|
||
/// OrderList Disposable Entity: | ||
/// `Load All Orders` endpoint returns all of it's orders within the `data` key. This entity |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpicky!!! its
instead of it's
/// - Parameters: | ||
/// - request: Request that should be performed. | ||
/// - completion: Closure to be executed upon completion. | ||
/// - completion: Closure to be executed upon completion. Will receive the JSON Parsed Response (if successfull) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpicky - successful
instead of successfull
Thanks A LOT for the review @mindgraffiti (all of the feedback addressed, thanks thanks thanks!!!!) |
Description:
This PR implements the basic Remote infrastructure we'll be using to call remote API's.
Ref. #24
Details:
Remote
(this is analog to WPiOS).Remote
comes, from factory, with a newMapping
mechanism, along with Unit Testing support (without requiring external dependencies).Order
+OrderStatus
+Address
. This is not 100% finished, yet, and will be addressed in a third PR.Response Mapping:
This concept was envisioned by @diegoreymendez. The idea is all about defining the piece of code that parses Backend Responses, establishing a protocol with the expected API, and implementing "Mapping" objects, which will be responsible for parsing documents.
Huge benefits of this approach are, mostly:
Mapper
Remote
implementation is no longer responsible for doing everything.Unit Testing
In Unit Testing Targets, we'll be able to access a
Remote
internal initializer which allows us to injectNetworkMockup
(seeOrderRemoteTests
).By means of
NetworkMockup
, we'll be able to specify whichjson
file should be returned, whenever a given remote RPC is performed.Testing:
@mindgraffiti May i bug you with this one Thuy?.
cc @diegoreymendez @astralbodies We should seriously consider bringing this architecture back to WPiOS