dta_client
DTA Client
Crystal Client for Ruby on Rails apps using devise_token_auth
Installation
-
Add the dependency to your
shard.yml
:dependencies: dta_client: github: HCLarsen/dta_client
-
Run
shards install
Usage
require "dta_client"
Start by initializing an instant of DTAClient with the base path for the Devise controller of the target server, and using it to sign in with your credentials.
Note: 'base path' refers to the common parts of the path to the Devise routes, including namespaces. For instance, if the sign in path is www.rails-app.ca/api/v1/auth/sign_in
, then the base path would be www.rails-app.ca/api/v1/auth
client = DTAClient.new("localhost:3000/api/v1/auth")
The sign in method takes care of signing in, and storing the authentication token params needed to access other routes of this app, which can be accessed through the #auth_params
method.
client.sign_in(email: "myemail@example.org", password: "FakePassword123")
client.auth_params #=> HTTP:Headers{"access-token" => "08Na79ohCtHjDl2MtHEEAQ", "client" => "9eKqFG5UY9f6yLh7TVc8rA", "expiry" => "1627764337", "uid" => "corps@example.com"}
Development
TODO: Write development instructions here
Contributing
- Fork it (https://github.com/HCLarsen/dta_client/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- Chris Larsen - creator and maintainer
dta_client
- 0
- 0
- 0
- 0
- 2
- over 3 years ago
- July 10, 2021
MIT License
Sun, 22 Dec 2024 09:08:18 GMT