Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/domain7/active_resource_hashed
Gem extends active resource to consume devise_hash_token_authenticatble services
https://github.com/domain7/active_resource_hashed
Last synced: 1 day ago
JSON representation
Gem extends active resource to consume devise_hash_token_authenticatble services
- Host: GitHub
- URL: https://github.com/domain7/active_resource_hashed
- Owner: domain7
- License: mit
- Created: 2012-10-12T18:06:00.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2023-03-11T15:16:20.000Z (almost 2 years ago)
- Last Synced: 2024-12-30T12:45:30.563Z (11 days ago)
- Language: Ruby
- Size: 145 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
Active Resource Hashed
======================Gem extends active resource to consume [devise_hash_token_authenticatble](https://github.com/domain7/devise_hash_token_authenticatable) services. Devise Hash Token Authenticatable is a Token based authentication strategy for the [Devise](http://github.com/plataformatec/devise).
Working example:
---------------Suppose I have an api at https://mypim.com/api/v1/contacts that exposes restful services using devise_hash_token_autheticatable. I have a user account with and id=57 and hash key of: 3c5abf29fafe6e528f88391f034f013gggg17b38acf49b9cc43f28f09d8101f2
First I create the following model to consume my service
#app/models/contact.rb
class Contact < ActiveResourceHashed::Base
self.site = 'https://mypim.com/api/v1/'
self.hash_id = 57
self.hash_key = '3c5abf29fafe6e528f88391f034f013gggg17b38acf49b9cc43f28f09d8101f2'
self.element_name = "contact"
def self.search(q = nil)
self.find(:all, {params:{q:"#{search_phrase}"}})
end
endThen I can consume the service as I would using active resource. For example:
contact_8899 = Contact.find(8899)
contact_8899.id # 8899
contact_8899.full_name # John Smithjohns = Contact.search('John')
johns.first.full_name # John Smith
johns.last.full_name # Sally SmithPrerequisites
-------------
* service running devise_hash_token_authenticatable
* active_resourceUsage
-----
Add this line to your application's Gemfile:gem 'active_resource_hashed'
Contributing
------------1. Fork it
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 origin my-new-feature`)
5. Create new Pull RequestReferences
----------
* [devise_hash_token_authenticatble](https://github.com/domain7/devise_hash_token_authenticatable)
* [Devise](http://github.com/plataformatec/devise)
* [Warden](http://github.com/hassox/warden)
* [ActiveResource](https://github.com/rails/activeresource)Released under the MIT license
Copyright (c) 2012 [Domain7](http://www.domain7.com)