A Ruby client for the PassaporteWeb REST API
<img src=“https://badge.fury.io/rb/passaporteweb-client.png” alt=“Gem Version” /> <img src=“https://travis-ci.org/myfreecomm/passaporteweb-client-ruby.png?branch=master” alt=“Build Status” /> <img src=“https://coveralls.io/repos/myfreecomm/passaporteweb-client-ruby/badge.png?branch=master” alt=“Coverage Status” /> <img src=“https://codeclimate.com/github/myfreecomm/passaporteweb-client-ruby.png” alt=“Code Climate Status” />
PassaporteWeb API docs: app.passaporteweb.com.br/static/docs/
passaporteweb-client-ruby RDoc documentation: rubydoc.info/github/myfreecomm/passaporteweb-client-ruby/frames/
The RDoc is the best place to learn how to use this client. A few example uses are listed below. See the mapping of API endpoints to this client code below as well to find what you need.
This client only uses the API of PassaporteWeb. To use the Single Sign-On (SSO) feature of PassaporteWeb via OAuth in Ruby, see the omni_auth_passaporte_web gem (code and example of use).
Add this line to your application’s Gemfile:
gem 'passaporteweb-client', :require => 'passaporte_web'
And then execute:
$ bundle
Or install it yourself as:
$ gem install passaporteweb-client
-
Cadastro e informações de usuários
-
POST /accounts/api/create/ ==> PassaporteWeb::Identity#save
-
GET /accounts/api/identities/:uuid/ ==> PassaporteWeb::Identity.find
-
GET /accounts/api/identities/?email=:email ==> PassaporteWeb::Identity.find_by_email
-
PUT /accounts/api/identities/:uuid/ ==> PassaporteWeb::Identity#save
-
-
-
GET /accounts/api/auth/ ==> PassaporteWeb::Identity.authenticate or PassaporteWeb::Identity#authenticate
-
-
-
GET /notifications/api/ ==> PassaporteWeb::Notification.find_all
-
POST /notifications/api/ ==> PassaporteWeb::Notification#save
-
GET /notifications/api/count/ ==> PassaporteWeb::Notification.count
-
PUT /notifications/api/:uuid/ ==> PassaporteWeb::Notification#read!
-
DELETE /notifications/api/:uuid/ ==> PassaporteWeb::Notification#destroy
-
-
-
PUT /organizations/api/activate/ ==> (not implemented yet)
-
GET /organizations/api/accounts/ ==> PassaporteWeb::ServiceAccount.find_all
-
GET /organizations/api/accounts/:uuid/ ==> PassaporteWeb::ServiceAccount.find
-
PUT /organizations/api/accounts/:uuid/ ==> PassaporteWeb::ServiceAccount#save
-
POST /organizations/api/accounts/:uuid/members/ ==> PassaporteWeb::ServiceAccountMember#save
-
GET /organizations/api/accounts/:uuid/members/:member_uuid/ ==> PassaporteWeb::ServiceAccountMember.find
-
PUT /organizations/api/accounts/:uuid/members/:member_uuid/ ==> PassaporteWeb::ServiceAccountMember#save
-
DELETE /organizations/api/accounts/:uuid/members/:member_uuid/ ==> PassaporteWeb::ServiceAccountMember#destroy
-
GET /organizations/api/identities/:uuid/accounts/ ==> PassaporteWeb::IdentityServiceAccount.find_all
-
POST /organizations/api/identities/:uuid/accounts/ ==> PassaporteWeb::IdentityServiceAccount.save
-
-
-
GET /accounts/api/service-info/:uuid/:service_slug/ ==> PassaporteWeb::IdentityService.find
-
PUT /accounts/api/service-info/:uuid/:service_slug/ ==> PassaporteWeb::IdentityService#save
-
-
-
GET /profile/api/info/:uuid/ ==> (deprecated, not going to be implemented)
-
GET /profile/api/info/?email=:email ==> (deprecated, not going to be implemented)
-
PUT /profile/api/info/:uuid/ ==> (deprecated, not going to be implemented)
-
require 'passaporte_web' PassaporteWeb.configure do |c| c.url = 'http://sandbox.app.passaporteweb.com.br' # defaults to 'https://app.passaporteweb.com.br' if omitted c.user_agent = 'My App v1.0' # optional, but you should pass a custom user-agent identifying your app c.application_token = 'some-app-token' c.application_secret = 'some-app-secret' c.user_token = 'some-user-token' end
identity1 = PassaporteWeb::Identity.find("a5868d14-6529-477a-9c6b-a09dd42a7cd2") identity1.email # "[email protected]" identity1.first_name # "John" identity2 = PassaporteWeb::Identity.find_by_email("[email protected]") identity2.uuid # "a5868d14-6529-477a-9c6b-a09dd42a7cd2" identity1 == profile2 # true identity1.gender # nil identity1.gender = 'M' identity1.save # true identity1.gender # 'M' attributes = { "email" => "[email protected]", "first_name" => "Luis Inácio", "last_name" => "da Silva", "password" => "rW5oHxYB", "password2" => "rW5oHxYB", "must_change_password" => true, "tos" => true, "inhibit_activation_message" => false, "cpf" => "353.423.680-73", "send_partner_news" => false, "send_myfreecomm_news" => false } identity = PassaporteWeb::Identity.new(attributes) identity.save # true attributes = { "email" => "[email protected]", "first_name" => "Luis Inácio", "last_name" => "da Silva", "tos" => true } identity = PassaporteWeb::Identity.new(attributes) identity.save # false identity.errors # hash of errors
-
Fork it
-
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 new Pull Request