* add conveyor price info

* remove comment

* correct getPrices response type and add test stub

* run swift format

* fixup integration test for getPrices endpoint

* CI kick
This commit is contained in:
Iain Maitland 2018-10-02 15:16:47 -04:00 committed by GitHub
parent 2819c3c9df
commit 8619f66130
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 0 deletions

View File

@ -61,6 +61,18 @@ public struct API {
public init() {}
}
public struct SteemPrices: Decodable {
public let steemSbd: Float32
public let steemUsd: Float32
public let steemVest: Float32
}
public struct GetPrices: Request {
public typealias Response = SteemPrices
public let method = "conveyor.get_prices"
public init() {}
}
public struct FeedHistory: Decodable {
public let currentMedianHistory: Price
public let priceHistory: [Price]

View File

@ -105,6 +105,7 @@ public struct Price: Equatable, SteemEncodable, Decodable {
throw PriceError.cannotConvert(asset: asset, usingPrice: self)
}
}
public init(base: Asset, quote: Asset) {
self.base = base
self.quote = quote

View File

@ -81,6 +81,22 @@ class ClientTest: XCTestCase {
}
}
func testGetPrices() {
let test = expectation(description: "Response")
let req = API.GetPrices()
client.send(req) { res, error in
XCTAssertNil(error)
XCTAssertNotNil(res)
test.fulfill()
}
waitForExpectations(timeout: 5) { error in
if let error = error {
print("Error: \(error.localizedDescription)")
}
}
}
func testGetBlock() {
let test = expectation(description: "Response")
let req = API.GetBlock(blockNum: 12_345_678)