1
0
mirror of https://github.com/oceanprotocol-archive/squid-js.git synced 2024-02-02 15:31:51 +01:00

Merge pull request #33 from oceanprotocol/feature/rename_provider_aquarius

rename provider -> aquarius
This commit is contained in:
Sebastian Gerske 2018-10-26 10:00:49 +02:00 committed by GitHub
commit bc08121a39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 25 additions and 25 deletions

View File

@ -1,7 +1,7 @@
import fetch from "node-fetch"
import Logger from "../utils/Logger"
export default class Provider {
export default class Aquarius {
public static async getAccessUrl(accessToken: any, payload: any): Promise<string> {
const accessUrl = await fetch(`${accessToken.service_endpoint}/${accessToken.resource_id}`, {

View File

@ -0,0 +1,14 @@
export default class AquariusProvider {
public static setAquarius(aquarius) {
AquariusProvider.aquarius = aquarius
}
public static getAquarius() {
return AquariusProvider.aquarius
}
private static aquarius
}

View File

@ -1,8 +1,8 @@
import Aquarius from "../aquarius/Aquarius"
import AquariusProvider from "../aquarius/AquariusProvider"
import ConfigProvider from "../ConfigProvider"
import Keeper from "../keeper/Keeper"
import Web3Provider from "../keeper/Web3Provider"
import Provider from "../provider/Provider"
import ProviderProvider from "../provider/ProviderProvider"
import Logger from "../utils/Logger"
import Account from "./Account"
import Asset from "./Asset"
@ -14,7 +14,7 @@ export default class Ocean {
if (!Ocean.instance) {
ConfigProvider.configure(config)
ProviderProvider.setProvider(Provider)
AquariusProvider.setAquarius(Aquarius)
Ocean.instance = new Ocean(await Keeper.getInstance())
}

View File

@ -1,9 +1,9 @@
import * as EthEcies from "eth-ecies"
import * as JWT from "jsonwebtoken"
import AquariusProvider from "../aquarius/AquariusProvider"
import Keeper from "../keeper/Keeper"
import Web3Provider from "../keeper/Web3Provider"
import AccessStatus from "../models/AccessStatus"
import ProviderProvider from "../provider/ProviderProvider"
import Logger from "../utils/Logger"
import Account from "./Account"
import Asset from "./Asset"
@ -87,7 +87,7 @@ export default class Order extends OceanBase {
jwt: accessTokenEncoded,
})
const accessUrl = await ProviderProvider.getProvider().getAccessUrl(accessToken, payload)
const accessUrl = await AquariusProvider.getAquarius().getAccessUrl(accessToken, payload)
Logger.log("consume url: ", accessUrl)

View File

@ -1,14 +0,0 @@
export default class ProviderProvider {
public static setProvider(provider) {
ProviderProvider.provider = provider
}
public static getProvider() {
return ProviderProvider.provider
}
private static provider
}

View File

@ -1,6 +1,6 @@
import Provider from "../../src/provider/Provider"
import Aquarius from "../../src/aquarius/Aquarius"
export default class ProviderMock extends Provider {
export default class AquariusMock extends Aquarius {
public static async getAccessUrl(accessToken: any, payload: any): Promise<string> {
return "http://test/test"

View File

@ -1,13 +1,13 @@
import {assert} from "chai"
import AquariusProvider from "../../src/aquarius/AquariusProvider"
import ConfigProvider from "../../src/ConfigProvider"
import ContractHandler from "../../src/keeper/ContractHandler"
import Account from "../../src/ocean/Account"
import Asset from "../../src/ocean/Asset"
import Ocean from "../../src/ocean/Ocean"
import Order from "../../src/ocean/Order"
import ProviderProvider from "../../src/provider/ProviderProvider"
import config from "../config"
import ProviderMock from "../mocks/Provider.Mock"
import AquariusMock from "../mocks/Aquarius.mock"
const testName = "Test Asset 2"
const testDescription = "This asset is pure owange"
@ -21,7 +21,7 @@ let testPublisher: Account
before(async () => {
ConfigProvider.configure(config)
ProviderProvider.setProvider(ProviderMock)
AquariusProvider.setAquarius(AquariusMock)
await ContractHandler.deployContracts()
ocean = await Ocean.getInstance(config)