Sha256: 6affda9c6500952d57335512e4f6a0083e7442c4f130157dfe610bc1ce0f4ff8

Contents?: true

Size: 1.55 KB

Versions: 3

Compression:

Stored size: 1.55 KB

Contents

# location-service-client

A gem for clients of Springshot's location service

## Installation 

Add it to your gemfile.

```
gem 'location-service-client', git: 'https://8bcbcee566e5e7a5d75592940d15bc9f68b84bd9:x-oauth-basic@github.com/springshot/location-service-client.git'
```

## Configuration

Settings.location_service (c.f. the 'config' gem) will need a url for the location service
and the app token configured to access the locations end point. 

```
location_service
  url: ...
  token: ...
```

## Documentation

The location service client just adds a dead simple Location class that presently downloads a big array of nested hashes (with indifferent access and the keys snake-cased) of all locations in the location service and some helper methods.

```
> Location.all
=> [{"id"=>449, "name"=>"Hartsfield-Jackson Atlanta International Airport", "code"=>"ATL", "kind"=>"airport", "lat"=>33.640067, "lng"=>-84.44403, "parent_location_id"=>nil, "created_at"=>"2016-04-28T21:19:02.658Z", "updated_at"=>"2016-04-28T21:19:02.658Z", "beacons"=>[], "child_locations"=>[..]},...]
```

There are some top level methods for accessing that data:

```
Location.find(id) -> find the location by its location service ID.
Location.find_by_code(code) -> return the hash of the location with the code (e.g. an airport's IATA code or a gate's qr_code).
Location.parents -> return just the roots of the trees
```

And until it needs to do more that's all it does.


## Contributing

Make sure any backwards incompatible changes come with a version bump so existing projects aren't obliterated.

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
location-service-client-0.1.4 README.md
location-service-client-0.1.3 README.md
location-service-client-0.1.0 README.md