Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/prx/prx_access
Access the PRX Hypermedia HAL APIs.
https://github.com/prx/prx_access
Last synced: about 1 month ago
JSON representation
Access the PRX Hypermedia HAL APIs.
- Host: GitHub
- URL: https://github.com/prx/prx_access
- Owner: PRX
- License: mit
- Created: 2018-12-14T19:41:32.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-11-16T18:56:35.000Z (about 3 years ago)
- Last Synced: 2024-11-08T00:41:26.855Z (2 months ago)
- Language: Ruby
- Size: 19.5 KB
- Stars: 0
- Watchers: 8
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# PrxAccess
Welcome to PRX Access. This gem allows programmatic api access to the PRX HAL apis.
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'prx_access'
```And then execute:
$ bundle
Or install it yourself as:
$ gem install prx_access
## Usage
PRXAccess is meant to be used as a mixin for your classes. Here's a
short example of how to fetch podcasts from feeder in Ruby:```
Running via Spring preloader in process 35676
Loading development environment (Rails 4.2.10)
irb(main):001:0> include PRXAccess
=> Object
irb(main):002:0> feeder_api = api(root: feeder_root)
=> #
irb(main):003:0> root_api = feeder_api.get
=> #
irb(main):004:0> podcasts_api = root_api.podcasts.first
=> #, @base_href="/api/v1/podcasts{?page,per,zoom}", @name=nil, @templated=true, @params={}, @default_method="get", @headers={}, @type=nil, @profile="http://meta.prx.org/model/collection/podcasts">
irb(main):005:0> podcasts_api.get.body
=> {"count"=>10, "total"=>122, "_embedded"=>{"prx:items"=>[ ...
```It's also possible to chain the calls:
```ruby
api(root: feeder_root)
.get
.podcasts.first
.get
.body
```## Development
After checking out the repo, run `bin/setup` to install dependencies.
Then, run `rake` to run the tests. You can also run `bin/console`
for an interactive prompt that will allow you to experiment.To install this gem onto your local machine, run `bundle exec rake
install`. To release a new version, update the version number in
`version.rb`, and then run `bundle exec rake release`, which will create
a git tag for the version, push git commits and tags, and push the
`.gem` file to [rubygems.org](https://rubygems.org).## Contributing
Bug reports and pull requests are welcome on GitHub at
https://github.com/[USERNAME]/prx_access. This project is intended to be
a safe, welcoming space for collaboration, and contributors are expected
to adhere to the [Contributor Covenant](http://contributor-covenant.org)
code of conduct.## Code of Conduct
Everyone interacting in the PrxAccess project’s codebases, issue
trackers, chat rooms and mailing lists is expected to follow the [code
of
conduct](https://github.com/[USERNAME]/prx_access/blob/master/CODE_OF_CONDUCT.md).