# Epom-ng2-resource-service
Service that implements loading resources and saves them into object storage. Uses storage-service. After next call -- get data from storage.

## Getting Started

We need to install storage service & api service.

| Name | Description |
| ---- | ----------- |
| `epom-ng2-storage-service` | We need to save received data to object storage |
| `epom-ng2-api-service` | We need to get data from server |

Install `epom-ng2-storage-service` via npm:

```sh
$ npm install --save epom-ng2-storage-service
```
Install `epom-ng2-api-service` via npm:
```sh
$ npm install --save epom-ng2-api-service
```

### Installing

Provide `ResourcesService` into your App.module:
```typescript
    import {ResourcesService} from 'epom-ng2-storage-service';
    ...
    providers: [
        ResourcesService,
        ...
    ];
```

## Parts
    .
    |-- epom-ng2-storage-service
    |   |-- index

## Service public methods
| Method Declaration                                                      | Description |
| ----------------------------------------------------------------------- | ----------- |
| .**loadAsResource**(requestURI: string, requestName: string, options: RequestOptions): Observable<any> | Return Observable of resource data. If resources wasn't loaded before -- receiving data from server, if already loaded get data from storage|
|.**getGeoFromIp2Data**()| deprecated method, using only on dsp |


Examples:
```javascript
    const resource$ = this.resourcesService.loadAsResource('http://someLink', 'name');
```

## Contributors

Gennady Strelets <g.strelets@itmgmedia.net>
