I hereby claim:
- I am eofster on github.
- I am eofster (https://keybase.io/eofster) on keybase.
- I have a public key ASBLRnkd3pm4-zVlXrNsijcfT-E1LcnumZWjXSrw-yg7xQo
To claim this, I am signing this object:
| #import "ReceiptAttributesValidation.h" | |
| #import "ReceiptChecksum.h" | |
| #import "ReceiptPayload.h" | |
| NS_ASSUME_NONNULL_BEGIN | |
| @interface ReceiptAttributesValidation () | |
| @property(nonatomic, readonly) id<ReceiptValidation> origin; | |
| @property(nonatomic, readonly) id<ReceiptAttributes> attributes; |
| @import Foundation; | |
| #import "ReceiptValidation.h" | |
| @protocol ReceiptAttributes; | |
| NS_ASSUME_NONNULL_BEGIN | |
| @interface ReceiptAttributesValidation : NSObject <ReceiptValidation> | |
| - (instancetype)initWithOrigin:(id<ReceiptValidation>)origin attributes:(id<ReceiptAttributes>)attributes NS_DESIGNATED_INITIALIZER; |
| import Foundation | |
| final class ReceiptAttributesValidation: NSObject { | |
| private let origin: ReceiptValidation | |
| private let attributes: ReceiptAttributes | |
| init(origin: ReceiptValidation, attributes: ReceiptAttributes) { | |
| self.origin = origin | |
| self.attributes = attributes | |
| } |
| @import Foundation; | |
| #import "ReceiptChecksum.h" | |
| #import "ReceiptPayload.h" | |
| #import "ReceiptValidation.h" | |
| @protocol ReceiptAttributes; | |
| NS_ASSUME_NONNULL_BEGIN |
| struct Item { | |
| let price: Int | |
| let name: String | |
| var count: Int | |
| } | |
| protocol Inventory { | |
| func itemNamed(name: String) throws -> Item | |
| func remove(item: Item) throws | |
| } |
I hereby claim:
To claim this, I am signing this object:
| func vend(itemNamed name: String) throws { | |
| let item = try validatedItemNamed(name) | |
| reduceDepositedCoinsBy(item.price) | |
| removeFromInventory(item, name: name) | |
| dispense(name) | |
| } | |
| private func validatedItemNamed(name: String) throws -> Item { | |
| let item = try itemNamed(name) | |
| try validate(item) |
| struct Item { | |
| var price: Int | |
| var count: Int | |
| } | |
| enum VendingMachineError: ErrorType { | |
| case InvalidSelection | |
| case InsufficientFunds(coinsNeeded: Int) | |
| case OutOfStock | |
| } |
| let viewController = TrackSummaryViewController( | |
| observer: TrackSummaryViewEventHandler( | |
| interactorFactory: InteractorFactoryImpl(repository: TrackRepositoryImpl()), | |
| presenterFactory: PresenterFactoryImpl() | |
| ) | |
| ) | |
| navigationController.pushViewController(viewController, animated: true) |
| class TrackSummaryViewDummy {} | |
| extension TrackSummaryViewDummy: TrackSummaryView { | |
| func setTrackID(trackID: Int) {} | |
| func setName(name: String) {} | |
| func setDate(date: String) {} | |
| func setDistance(distance: String) {} | |
| } |