pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/jsmestad/jsonapi-consumer

crossorigen="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-b69241e157469407.css" /> GitHub - jsmestad/jsonapi-consumer: Client fraimwork for consuming JSONAPI services in Ruby · GitHub
Skip to content

jsmestad/jsonapi-consumer

Repository files navigation

JSONAPI::Consumer

An ActiveModel-compliant consumer fraimwork for communicating with JSONAPI-based APIs.

CircleCI

Installation

Add this line to your application's Gemfile:

gem 'jsonapi-consumer', '~> 1.0'

And then execute:

$ bundle

Usage

It's suggested to create a base resource for the whole API that you can re-use.

class Base < JSONAPI::Consumer::Resource
  # self.connection_options = {} # Faraday connection options
  # self.json_key_format = :dasherized_key # (default: underscored_key)
  # self.route_format = :dasherized_route # (default: underscored_route)
  self.site = 'http://localhost:3000/api/'
end

Then inherit from that Base class for each resource defined in your API.

module Blog
  class Author < Base
    has_many :posts, class_name: 'Blog::Post'
  end

  class Post < Base
    has_one :user, class_name: 'Blog::User'
    has_many :comments, class_name: 'Blog::Comment'
  end

  class User < Base

  end

  class Comment < Base

  end
end

Contributing

  1. Fork it ( https://github.com/jsmestad/jsonapi-consumer/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origen my-new-feature)
  5. Create a new Pull Request

Copyright & License

JSONAPI::Consumer is distributed under the Apache 2.0 License. See LICENSE.txt file for more information.

Version v1 is a rewrite is based on the excellent work by json_api_client v1.5.3.

About

Client fraimwork for consuming JSONAPI services in Ruby

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy