diff --git a/.env.test b/.env.test index eb2271e..9b75d7d 100644 --- a/.env.test +++ b/.env.test @@ -1,4 +1,4 @@ -PASSAPORTE_WEB_URL=https://sandbox.v2.passaporteweb.com.br +NEXAAS_ID_URL=https://sandbox.id.nexaas.com APPLICATION_TOKEN=QMKAZVAZ6NBR3IO2MCEHOGKVCY APPLICATION_SECRET=HXKQYGAQ4JHR5HR73SKOQ5NI6E USER_NAME=luiz.buiatte+pw.api.test@nexaas.com diff --git a/Gemfile b/Gemfile index 6e71ce2..0737b7b 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,4 @@ source 'https://rubygems.org' -# Specify your gem's dependencies in passaporteweb-client.gemspec +# Specify your gem's dependencies in nexaas-id-client.gemspec gemspec diff --git a/Gemfile.lock b/Gemfile.lock index 93a479a..4577831 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - passaporteweb-client (0.5.0) + nexaas-id-client (0.5.0) multi_json (~> 1.11) oauth2 (~> 1.4.0) virtus (~> 1.0) @@ -64,7 +64,7 @@ GEM pry-byebug (3.4.2) byebug (~> 9.0) pry (~> 0.10) - public_suffix (3.0.1) + public_suffix (3.0.3) rack (2.0.5) rake (12.0.0) rdoc (6.0.4) @@ -102,7 +102,7 @@ GEM coercible (~> 1.0) descendants_tracker (~> 0.0, >= 0.0.3) equalizer (~> 0.0, >= 0.0.9) - webmock (3.1.1) + webmock (3.4.2) addressable (>= 2.3.6) crack (>= 0.3.2) hashdiff @@ -117,14 +117,14 @@ DEPENDENCIES dotenv (~> 2.5.0) faraday-cookie_jar (~> 0.0.6) json (~> 2.1) - passaporteweb-client! + nexaas-id-client! pry-byebug (~> 3.4) rake (~> 12.0) rdoc (~> 6.0) rspec (~> 3.6) simplecov (~> 0.14) vcr (~> 2.4) - webmock (~> 3.1.0, >= 3.1.1) + webmock (~> 3.4) BUNDLED WITH 1.16.3 diff --git a/README.md b/README.md index b7228a0..35634b0 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,26 @@ -# passaporteweb-client-ruby +# nexaas-id-client-ruby -This is the official Ruby client for the [PassaporteWeb 2](https://v2.passaporteweb.com.br) API. +This is the official Ruby client for the [Nexaas ID](https://id.nexaas.com) API. -[![Gem Version](https://badge.fury.io/rb/passaporteweb-client.png)](https://rubygems.org/gems/passaporteweb-client) -[![Build Status](https://travis-ci.org/myfreecomm/passaporteweb-client-ruby.png?branch=master)](https://travis-ci.org/myfreecomm/passaporteweb-client-ruby) -[![Test Coverage](https://coveralls.io/repos/myfreecomm/passaporteweb-client-ruby/badge.png?branch=master)](https://coveralls.io/r/myfreecomm/passaporteweb-client-ruby) -[![Code Climate Grade](https://codeclimate.com/github/myfreecomm/passaporteweb-client-ruby.png)](https://codeclimate.com/github/myfreecomm/passaporteweb-client-ruby) -[![Inline docs](http://inch-ci.org/github/myfreecomm/passaporteweb-client-ruby.svg)](http://inch-ci.org/github/myfreecomm/passaporteweb-client-ruby) +[![Gem Version](https://badge.fury.io/rb/nexaas-id-client.png)](https://rubygems.org/gems/nexaas-id-client) +[![Build Status](https://travis-ci.org/myfreecomm/nexaas-id-client-ruby.png?branch=master)](https://travis-ci.org/myfreecomm/nexaas-id-client-ruby) +[![Test Coverage](https://coveralls.io/repos/myfreecomm/nexaas-id-client-ruby/badge.png?branch=master)](https://coveralls.io/r/myfreecomm/nexaas-id-client-ruby) +[![Code Climate Grade](https://codeclimate.com/github/myfreecomm/nexaas-id-client-ruby.png)](https://codeclimate.com/github/myfreecomm/nexaas-id-client-ruby) +[![Inline docs](http://inch-ci.org/github/myfreecomm/nexaas-id-client-ruby.svg)](http://inch-ci.org/github/myfreecomm/nexaas-id-client-ruby) -PassaporteWeb API docs: https://app.passaporteweb.com.br/static/docs/ +Nexaas ID API docs: https://id.nexaas.com/static/docs/ -passaporteweb-client-ruby RDoc documentation: http://rubydoc.info/github/myfreecomm/passaporteweb-client-ruby/frames/ +nexaas-id-client-ruby RDoc documentation: http://rubydoc.info/github/myfreecomm/nexaas-id-client-ruby/frames/ -The {RDoc}[http://rubydoc.info/github/myfreecomm/passaporteweb-client-ruby/frames/] 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. +The [RDoc](http://rubydoc.info/github/myfreecomm/nexaas-id-client-ruby/frames/) 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 authenticate users via OAuth2 in Ruby, see the {omni_auth_passaporte_web gem}[https://rubygems.org/gems/omni_auth_passaporte_web] ({code}[https://github.com/myfreecomm/omniauth-passaporte_web] and {example of use}[https://github.com/myfreecomm/passaporte-web-2-demo-apps]). +This client only uses the API of Nexaas ID. To authenticate users via OAuth2 in Ruby, see the [omni_auth_nexaas_id gem](https://rubygems.org/gems/omni_auth_nexaas_id) ([code](https://github.com/myfreecomm/omniauth-nexaas_id) and [example of use](https://github.com/myfreecomm/nexaas-id-demo-apps)). ## Installation Add this line to your application's Gemfile: - gem 'passaporteweb-client', require: 'passaporte_web' + gem 'nexaas-id-client', require: 'nexaas_id' And then execute: @@ -28,7 +28,7 @@ And then execute: Or install it yourself as: - $ gem install passaporteweb-client + $ gem install nexaas-id-client ## Support @@ -38,15 +38,15 @@ This gem supports Ruby 2.1 or superior. ### Create a new application -Go to https://v2.passaporteweb.com.br/applications and create a new application in your PassaporteWeb account. +Go to https://id.nexaas.com/applications and create a new application in your Nexaas ID account. -### Use PassaporteWeb.configure to setup your environment +### Use NexaasID.configure to setup your environment ```ruby -require 'passaporte_web' +require 'nexaas_id' -PassaporteWeb.configure do |c| - c.url = 'http://v2.sandbox.passaporteweb.com.br' # defaults to 'https://v2.passaporteweb.com.br' if omitted +NexaasID.configure do |c| + c.url = 'https://sandbox.id.nexaas.com' # defaults to 'https://id.nexaas.com' if omitted c.user_agent = 'My App v1.0' # optional, but you should pass a custom user-agent identifying your app c.application_token = 'your-application-token' c.application_secret = 'your-application-secret' @@ -56,15 +56,15 @@ end ## Usage The API can be used to access resources owned by an `Identity`, which requires previous authorization from the -corresponding user (see the {omni_auth_passaporte_web gem}[https://rubygems.org/gems/omni_auth_passaporte_web]), +corresponding user (see the {omni_auth_nexaas_id gem}[https://rubygems.org/gems/omni_auth_nexaas_id]), or resources owned by an `Application`, which only requires the application's credentials. ### Resources owned by an Identity -#### Create an instance of PassaporteWeb::Client::Identity, as below: +#### Create an instance of NexaasID::Client::Identity, as below: ```ruby -client = PassaporteWeb::Client::Identity.new(user_credentials) +client = NexaasID::Client::Identity.new(user_credentials) ``` Here, `user_crendentials` is an object that must have the following attributes available for reading/writing: @@ -76,9 +76,9 @@ Here, `user_crendentials` is an object that must have the following attributes a As long as these attributes are available, your object can be of any class (an `Active Record` object or a simple `OpenStruct`, for instance); the client won't make any assumptions about its nature. Your application is responsible for obtaining the initial values for these attributes (through the OAuth2 Authorization Flow, using the -{omni_auth_passaporte_web gem}[https://rubygems.org/gems/omni_auth_passaporte_web]) and storing them as appropriate +{omni_auth_nexaas_id gem}[https://rubygems.org/gems/omni_auth_nexaas_id]) and storing them as appropriate (you might store them using a Users table for instance, or even in your user's session). The client WILL updated these -attributes if the token has to be refreshed (PassaporteWeb uses a TTL of 2 hours for access tokens) and your application +attributes if the token has to be refreshed (Nexaas ID uses a TTL of 2 hours for access tokens) and your application needs to update its storage when that happens. #### Now you have access to the following endpoints: @@ -90,7 +90,7 @@ needs to update its storage when that happens. #### Examples ```ruby -client = PassaporteWeb::Client::Identity.new(user_credentials) +client = NexaasID::Client::Identity.new(user_credentials) profile_resource = client.profile @@ -105,7 +105,7 @@ contacts.phone_numbers # ['+55 21 12345678'] sign_up_resource = client.sign_up -# Invites another user to PassaporteWeb on behalf of the current user +# Invites another user to Nexaas ID on behalf of the current user sign_up = sign_up_resource.create('another.john@example.com') sign_up.id # '1061a775-b86c-4082-b801-767f651fa4c7' sign_up.email # 'another.john@example.com' @@ -119,10 +119,10 @@ navbar_url = widget_resource.navbar_url ### Resources not owned by an Identity -#### Create an instance of PassaporteWeb::Client::Application, as below: +#### Create an instance of NexaasID::Client::Application, as below: ```ruby -client = PassaporteWeb::Client::Application.new +client = NexaasID::Client::Application.new ``` #### Now you have access to the following endpoints: @@ -132,11 +132,11 @@ client = PassaporteWeb::Client::Application.new #### Examples ```ruby -client = PassaporteWeb::Client::Application.new +client = NexaasID::Client::Application.new sign_up_resource = client.sign_up -# Invites another user to PassaporteWeb on behalf of the application +# Invites another user to Nexaas ID on behalf of the application sign_up = sign_up_resource.create('another.john@example.com') sign_up.id # '1061a775-b86c-4082-b801-767f651fa4c7' sign_up.email # 'another.john@example.com' @@ -145,7 +145,7 @@ sign_up.requester # nil ### Error handling -In case of a transport or OAuth error, an instance of PassaporteWeb::Client::Exception will be raised by the client. +In case of a transport or OAuth error, an instance of NexaasID::Client::Exception will be raised by the client. This exception can be inspected using the methods `status`, `headers` and `body`. ## Contributing diff --git a/Rakefile b/Rakefile index 49ef93d..6614553 100644 --- a/Rakefile +++ b/Rakefile @@ -2,7 +2,7 @@ require "bundler/gem_tasks" require 'rdoc/task' Rake::RDocTask.new do |rdoc| - rdoc.title = 'passaporteweb-client-ruby' + rdoc.title = 'nexaas-id-client-ruby' rdoc.main = "README.rdoc" rdoc.rdoc_dir = 'doc' rdoc.rdoc_files.include("README.rdoc","lib/**/*.rb") diff --git a/lib/nexaas_id.rb b/lib/nexaas_id.rb new file mode 100644 index 0000000..cd0ed3e --- /dev/null +++ b/lib/nexaas_id.rb @@ -0,0 +1,40 @@ +# encoding: utf-8 + +require 'oauth2' +require 'multi_json' + +require "nexaas_id/version" +require "nexaas_id/configuration" + +require "nexaas_id/client" +require "nexaas_id/client/application" +require "nexaas_id/client/exception" +require "nexaas_id/client/exception_wrapper" +require "nexaas_id/client/identity" +require "nexaas_id/client/oauth" + +require "nexaas_id/entities" +require "nexaas_id/entities/base" + +require "nexaas_id/entities/profile" +require "nexaas_id/entities/profile/professional_info" +require "nexaas_id/entities/profile/contacts" +require "nexaas_id/entities/profile/emails" + +require "nexaas_id/entities/sign_up" + +require "nexaas_id/resources" +require "nexaas_id/resources/base" +require "nexaas_id/resources/profile" +require "nexaas_id/resources/sign_up" +require "nexaas_id/resources/widget" + +module NexaasID + def self.configuration + @configuration ||= Configuration.new + end + + def self.configure + yield(configuration) if block_given? + end +end diff --git a/lib/nexaas_id/client.rb b/lib/nexaas_id/client.rb new file mode 100644 index 0000000..f2e37b7 --- /dev/null +++ b/lib/nexaas_id/client.rb @@ -0,0 +1,2 @@ +module NexaasID::Client +end diff --git a/lib/nexaas_id/client/application.rb b/lib/nexaas_id/client/application.rb new file mode 100644 index 0000000..b3f7a67 --- /dev/null +++ b/lib/nexaas_id/client/application.rb @@ -0,0 +1,35 @@ +# NexaasID Client for resources not owned by an Identity +# +# [API] +# Documentation: +# +# @example Inviting a new user: +# client = NexaasID::Client::Application.new +# client.sign_up.create(invited: 'john.doe@example.com') +# +class NexaasID::Client::Application + + def initialize + @tokens = {} + end + + # Provides a SignUp resource. + # @return [NexaasID::Resources::SignUp] the signup resource. + def sign_up + NexaasID::Resources::SignUp.new(token(:invite)) + end + + private + + attr_reader :tokens, :credentials + + def client + @client ||= NexaasID::Client::OAuth.build + end + + def token(scope = nil) + token = tokens[scope] + return token unless token.nil? || token.expired? + tokens[scope] = NexaasID::Client::ExceptionWrapper.new(client.client_credentials.get_token(scope: scope)) + end +end diff --git a/lib/passaporte_web/client/exception.rb b/lib/nexaas_id/client/exception.rb similarity index 92% rename from lib/passaporte_web/client/exception.rb rename to lib/nexaas_id/client/exception.rb index ea2aadd..d59492f 100644 --- a/lib/passaporte_web/client/exception.rb +++ b/lib/nexaas_id/client/exception.rb @@ -3,7 +3,7 @@ # [API] # Documentation: # -class PassaporteWeb::Client::Exception < StandardError +class NexaasID::Client::Exception < StandardError # Creates an instance of this exception. # # @param [String] message The exception message. diff --git a/lib/passaporte_web/client/exception_wrapper.rb b/lib/nexaas_id/client/exception_wrapper.rb similarity index 61% rename from lib/passaporte_web/client/exception_wrapper.rb rename to lib/nexaas_id/client/exception_wrapper.rb index 59e4670..afc7484 100644 --- a/lib/passaporte_web/client/exception_wrapper.rb +++ b/lib/nexaas_id/client/exception_wrapper.rb @@ -1,10 +1,10 @@ # Delegator class which intercepts exceptions raised by OAuth::AccessToken methods -# and wraps them in [PassaporteWeb::Client::Exception] exceptions. +# and wraps them in [NexaasID::Client::Exception] exceptions. # # [API] # Documentation: # -class PassaporteWeb::Client::ExceptionWrapper < SimpleDelegator +class NexaasID::Client::ExceptionWrapper < SimpleDelegator def refresh(*args) call_with_rescue { super } end @@ -18,6 +18,6 @@ def request(*args, &block) def call_with_rescue yield rescue Faraday::ClientError, OAuth2::Error => exception - raise PassaporteWeb::Client::Exception.new(exception.message, exception.response) + raise NexaasID::Client::Exception.new(exception.message, exception.response) end end diff --git a/lib/passaporte_web/client/identity.rb b/lib/nexaas_id/client/identity.rb similarity index 60% rename from lib/passaporte_web/client/identity.rb rename to lib/nexaas_id/client/identity.rb index b9f7054..23f2fe4 100644 --- a/lib/passaporte_web/client/identity.rb +++ b/lib/nexaas_id/client/identity.rb @@ -1,13 +1,13 @@ -# PassaporteWeb Client for resources owned by an Identity +# NexaasID Client for resources owned by an Identity # # [API] # Documentation: # # @example Obtaining a user's profile: -# client = PassaporteWeb::Client::Identity.new(user_credentials) +# client = NexaasID::Client::Identity.new(user_credentials) # client.profile.get # -class PassaporteWeb::Client::Identity +class NexaasID::Client::Identity # Creates an instance of this client. # # @param [ @@ -17,25 +17,25 @@ class PassaporteWeb::Client::Identity # #expires_in, #expires_in=] The user credentials, obtained through the OAuth2 authorization flow. def initialize(credentials) @credentials = credentials - @token = PassaporteWeb::Client::ExceptionWrapper.new(OAuth2::AccessToken.from_hash(client, hash)) + @token = NexaasID::Client::ExceptionWrapper.new(OAuth2::AccessToken.from_hash(client, hash)) end # Provides a Profile resource. - # @return [PassaporteWeb::Resources::Profile] the profile resource. + # @return [NexaasID::Resources::Profile] the profile resource. def profile - PassaporteWeb::Resources::Profile.new(api) + NexaasID::Resources::Profile.new(api) end # Provides a SignUp resource. - # @return [PassaporteWeb::Resources::SignUp] the signup resource. + # @return [NexaasID::Resources::SignUp] the signup resource. def sign_up - PassaporteWeb::Resources::SignUp.new(api) + NexaasID::Resources::SignUp.new(api) end # Provides a Widget resource. - # @return [PassaporteWeb::Resources::Widget] the widget resource. + # @return [NexaasID::Resources::Widget] the widget resource. def widget - PassaporteWeb::Resources::Widget.new(api) + NexaasID::Resources::Widget.new(api) end private @@ -50,7 +50,7 @@ def api end def client - @client ||= PassaporteWeb::Client::OAuth.build + @client ||= NexaasID::Client::OAuth.build end def hash @@ -59,7 +59,7 @@ def hash def refresh_token token.refresh!.tap do |token| - self.token = PassaporteWeb::Client::ExceptionWrapper.new(token) + self.token = NexaasID::Client::ExceptionWrapper.new(token) credentials.access_token = token.token (ATTRIBUTES - [:access_token]).each { |attr| credentials.send("#{attr}=", token.send(attr)) } end diff --git a/lib/passaporte_web/client/oauth.rb b/lib/nexaas_id/client/oauth.rb similarity index 70% rename from lib/passaporte_web/client/oauth.rb rename to lib/nexaas_id/client/oauth.rb index 699ac78..f801240 100644 --- a/lib/passaporte_web/client/oauth.rb +++ b/lib/nexaas_id/client/oauth.rb @@ -1,11 +1,11 @@ require 'oauth2' -# OAuth2 client used by PassaporteWeb::Client::Application and PassaporteWeb::Client::Identity. +# OAuth2 client used by NexaasID::Client::Application and NexaasID::Client::Identity. # Provides direct access to the underlying OAuth2 API. -class PassaporteWeb::Client::OAuth +class NexaasID::Client::OAuth def self.build - config = PassaporteWeb.configuration + config = NexaasID.configuration OAuth2::Client.new(config.application_token, config.application_secret, site: config.url, diff --git a/lib/passaporte_web/configuration.rb b/lib/nexaas_id/configuration.rb similarity index 51% rename from lib/passaporte_web/configuration.rb rename to lib/nexaas_id/configuration.rb index c43b03e..6c894da 100644 --- a/lib/passaporte_web/configuration.rb +++ b/lib/nexaas_id/configuration.rb @@ -1,10 +1,10 @@ -class PassaporteWeb::Configuration +class NexaasID::Configuration attr_accessor :url, :user_agent, :application_token, :application_secret def initialize - @url = 'https://v2.passaporteweb.com.br' - @user_agent = "PassaporteWeb Ruby Client v#{PassaporteWeb::VERSION}" + @url = 'https://id.nexaas.com' + @user_agent = "Nexaas ID Ruby Client v#{NexaasID::VERSION}" end def url_for(path) diff --git a/lib/nexaas_id/entities.rb b/lib/nexaas_id/entities.rb new file mode 100644 index 0000000..97ba1c5 --- /dev/null +++ b/lib/nexaas_id/entities.rb @@ -0,0 +1,2 @@ +module NexaasID::Entities +end diff --git a/lib/passaporte_web/entities/base.rb b/lib/nexaas_id/entities/base.rb similarity index 55% rename from lib/passaporte_web/entities/base.rb rename to lib/nexaas_id/entities/base.rb index 61bff26..c4b92d5 100644 --- a/lib/passaporte_web/entities/base.rb +++ b/lib/nexaas_id/entities/base.rb @@ -1,5 +1,5 @@ require "virtus" -class PassaporteWeb::Entities::Base +class NexaasID::Entities::Base include Virtus.model end diff --git a/lib/passaporte_web/entities/collection.rb b/lib/nexaas_id/entities/collection.rb similarity index 95% rename from lib/passaporte_web/entities/collection.rb rename to lib/nexaas_id/entities/collection.rb index 1e2d18c..af99b9a 100644 --- a/lib/passaporte_web/entities/collection.rb +++ b/lib/nexaas_id/entities/collection.rb @@ -1,4 +1,4 @@ -class PassaporteWeb::Entities::Collection < Base +class NexaasID::Entities::Collection < Base extend Forwardable PAGE_REGEX = /page=(\d+)/ diff --git a/lib/passaporte_web/entities/profile.rb b/lib/nexaas_id/entities/profile.rb similarity index 84% rename from lib/passaporte_web/entities/profile.rb rename to lib/nexaas_id/entities/profile.rb index c15d072..1bc6697 100644 --- a/lib/passaporte_web/entities/profile.rb +++ b/lib/nexaas_id/entities/profile.rb @@ -1,4 +1,4 @@ -class PassaporteWeb::Entities::Profile < PassaporteWeb::Entities::Base +class NexaasID::Entities::Profile < NexaasID::Entities::Base attribute :id, Integer attribute :name, String attribute :nickname, String diff --git a/lib/passaporte_web/entities/profile/contacts.rb b/lib/nexaas_id/entities/profile/contacts.rb similarity index 50% rename from lib/passaporte_web/entities/profile/contacts.rb rename to lib/nexaas_id/entities/profile/contacts.rb index 6f2e1a8..8c578d4 100644 --- a/lib/passaporte_web/entities/profile/contacts.rb +++ b/lib/nexaas_id/entities/profile/contacts.rb @@ -1,4 +1,4 @@ -class PassaporteWeb::Entities::Profile::Contacts < PassaporteWeb::Entities::Base +class NexaasID::Entities::Profile::Contacts < NexaasID::Entities::Base attribute :id, Integer attribute :phone_numbers, Array[String] end diff --git a/lib/nexaas_id/entities/profile/emails.rb b/lib/nexaas_id/entities/profile/emails.rb new file mode 100644 index 0000000..bec0135 --- /dev/null +++ b/lib/nexaas_id/entities/profile/emails.rb @@ -0,0 +1,4 @@ +class NexaasID::Entities::Profile::Emails < NexaasID::Entities::Base + attribute :id, Integer + attribute :emails, Array[String] +end diff --git a/lib/passaporte_web/entities/profile/professional_info.rb b/lib/nexaas_id/entities/profile/professional_info.rb similarity index 60% rename from lib/passaporte_web/entities/profile/professional_info.rb rename to lib/nexaas_id/entities/profile/professional_info.rb index 700dabb..7c6eefc 100644 --- a/lib/passaporte_web/entities/profile/professional_info.rb +++ b/lib/nexaas_id/entities/profile/professional_info.rb @@ -1,4 +1,4 @@ -class PassaporteWeb::Entities::Profile::ProfessionalInfo < PassaporteWeb::Entities::Base +class NexaasID::Entities::Profile::ProfessionalInfo < NexaasID::Entities::Base attribute :id, Integer attribute :profession, String attribute :company, String diff --git a/lib/passaporte_web/entities/sign_up.rb b/lib/nexaas_id/entities/sign_up.rb similarity index 58% rename from lib/passaporte_web/entities/sign_up.rb rename to lib/nexaas_id/entities/sign_up.rb index 622aaa4..86dd600 100644 --- a/lib/passaporte_web/entities/sign_up.rb +++ b/lib/nexaas_id/entities/sign_up.rb @@ -1,4 +1,4 @@ -class PassaporteWeb::Entities::SignUp < PassaporteWeb::Entities::Base +class NexaasID::Entities::SignUp < NexaasID::Entities::Base attribute :id, String attribute :email, String attribute :requester, String diff --git a/lib/nexaas_id/resources.rb b/lib/nexaas_id/resources.rb new file mode 100644 index 0000000..7525948 --- /dev/null +++ b/lib/nexaas_id/resources.rb @@ -0,0 +1,2 @@ +module NexaasID::Resources +end diff --git a/lib/passaporte_web/resources/base.rb b/lib/nexaas_id/resources/base.rb similarity index 65% rename from lib/passaporte_web/resources/base.rb rename to lib/nexaas_id/resources/base.rb index 63805bc..d3033fa 100644 --- a/lib/passaporte_web/resources/base.rb +++ b/lib/nexaas_id/resources/base.rb @@ -1,5 +1,5 @@ # Default root for all resource classes. -class PassaporteWeb::Resources::Base +class NexaasID::Resources::Base # Creates an instance of this class. # # @param [api] api An instance of OAuth2::AccessToken @@ -14,11 +14,11 @@ def initialize(api) # Builds an entity from the OAuth2 response. # # @param [OAuth2::Response] response The response from any OAuth2::AccessToken method - # @param [PassaporteWeb::Entities::Base] naked_klass The class which the response will be - # deserialized into (must be a subtype of PassaporteWeb::Entities::Base). + # @param [NexaasID::Entities::Base] naked_klass The class which the response will be + # deserialized into (must be a subtype of NexaasID::Entities::Base). # Optional if the entity name is the same as the resource name. # - # @return [PassaporteWeb::Entities::Base] an instance of naked_class + # @return [NexaasID::Entities::Base] an instance of naked_class def respond_with_entity(response, naked_klass = entity_klass) # response.parsed is a Hash naked_klass.new(response.parsed) @@ -29,6 +29,6 @@ def base_klass end def entity_klass - @entity_klass ||= PassaporteWeb::Entities.const_get(base_klass.to_sym) + @entity_klass ||= NexaasID::Entities.const_get(base_klass.to_sym) end end diff --git a/lib/passaporte_web/resources/profile.rb b/lib/nexaas_id/resources/profile.rb similarity index 56% rename from lib/passaporte_web/resources/profile.rb rename to lib/nexaas_id/resources/profile.rb index c98de67..9ac9432 100644 --- a/lib/passaporte_web/resources/profile.rb +++ b/lib/nexaas_id/resources/profile.rb @@ -1,18 +1,18 @@ -# A wrapper to PassaporteWeb's profile API +# A wrapper to Nexaas ID's profile API # # [API] # Documentation: # # @example Getting the user's profile: -# client = PassaporteWeb::Client::Identity.new(credentials) +# client = NexaasID::Client::Identity.new(credentials) # client.profile.get # # @example Getting the user's list of emails: -# client = PassaporteWeb::Client::Identity.new(credentials) +# client = NexaasID::Client::Identity.new(credentials) # client.profile.emails # -# @see PassaporteWeb::Client::Identity#initialize -class PassaporteWeb::Resources::Profile < PassaporteWeb::Resources::Base +# @see NexaasID::Client::Identity#initialize +class NexaasID::Resources::Profile < NexaasID::Resources::Base # Retrieves the user's profile # @@ -21,7 +21,7 @@ class PassaporteWeb::Resources::Profile < PassaporteWeb::Resources::Base # # Documentation: # - # @return [PassaporteWeb::Entities::Profile] user's profile + # @return [NexaasID::Entities::Profile] user's profile def get respond_with_entity(api.get('/api/v1/profile')) end @@ -33,10 +33,10 @@ def get # # Documentation: # - # @return [PassaporteWeb::Entities::Profile::ProfessionalInfo] user's professional info + # @return [NexaasID::Entities::Profile::ProfessionalInfo] user's professional info def professional_info respond_with_entity(api.get('/api/v1/profile/professional_info'), - PassaporteWeb::Entities::Profile::ProfessionalInfo) + NexaasID::Entities::Profile::ProfessionalInfo) end # Retrieves the user's contacts @@ -46,10 +46,10 @@ def professional_info # # Documentation: # - # @return [PassaporteWeb::Entities::Profile::Contacts] user's contacts + # @return [NexaasID::Entities::Profile::Contacts] user's contacts def contacts respond_with_entity(api.get('/api/v1/profile/contacts'), - PassaporteWeb::Entities::Profile::Contacts) + NexaasID::Entities::Profile::Contacts) end # Retrieves the user's emails @@ -59,9 +59,9 @@ def contacts # # Documentation: # - # @return [PassaporteWeb::Entities::Profile::Emails] user's emails + # @return [NexaasID::Entities::Profile::Emails] user's emails def emails respond_with_entity(api.get('/api/v1/profile/emails'), - PassaporteWeb::Entities::Profile::Emails) + NexaasID::Entities::Profile::Emails) end end diff --git a/lib/nexaas_id/resources/sign_up.rb b/lib/nexaas_id/resources/sign_up.rb new file mode 100644 index 0000000..2a99d90 --- /dev/null +++ b/lib/nexaas_id/resources/sign_up.rb @@ -0,0 +1,30 @@ +# A wrapper to Nexaas ID's sign up API +# +# [API] +# Documentation: +# +# @example Inviting a new user to Nexaas ID (on behalf of an existing user): +# client = NexaasID::Client::Identity.new(credentials) +# client.sign_up.create('john.doe@gmail.com') +# +# @example Inviting a new user to Nexaas ID (on behalf of an application): +# client = NexaasID::Client::Application.new +# client.sign_up.create('john.doe@gmail.com') +# +# @see NexaasID::Client::Identity#initialize +# @see NexaasID::Client::Application#initialize +class NexaasID::Resources::SignUp < NexaasID::Resources::Base + + # Invites an user to Nexaas ID, by creating a new sign up. + # + # [API] + # Method: POST /api/v1/sign_up + # + # Documentation: + # @param [String] email The new user's email. + # + # @return [NexaasID::Entities::SignUp] the new sign up; it contains the invited user's id. + def create(email) + respond_with_entity(api.post('/api/v1/sign_up', body: MultiJson.dump({ invited: email }))) + end +end diff --git a/lib/nexaas_id/resources/widget.rb b/lib/nexaas_id/resources/widget.rb new file mode 100644 index 0000000..b95d5ad --- /dev/null +++ b/lib/nexaas_id/resources/widget.rb @@ -0,0 +1,28 @@ +# A wrapper to Nexaas ID's widget API +# +# [API] +# Documentation: +# +# @example Obtaining the user's navbar URL: +# client = NexaasID::Client::Identity.new(credentials) +# client.widget.navbar_url +# +# @example Inviting a new user to Nexaas ID (on behalf of an application): +# client = NexaasID::Client::Application.new +# client.sign_up.create('john.doe@gmail.com') +# +# @see NexaasID::Client::Identity#initialize +class NexaasID::Resources::Widget < NexaasID::Resources::Base + + # Retrieves the user's navbar URL + # + # [API] + # Method: GET /api/v1/widgets/navbar + # + # Documentation: + # + # @return [String] user's navbar URL + def navbar_url + %(#{NexaasID.configuration.url}/api/v1/widgets/navbar?access_token=#{api.token}) + end +end diff --git a/lib/passaporte_web/version.rb b/lib/nexaas_id/version.rb similarity index 70% rename from lib/passaporte_web/version.rb rename to lib/nexaas_id/version.rb index 9f603f5..adb0bf2 100644 --- a/lib/passaporte_web/version.rb +++ b/lib/nexaas_id/version.rb @@ -1,4 +1,4 @@ # encoding: utf-8 -module PassaporteWeb +module NexaasID VERSION = "0.5.0".freeze end diff --git a/lib/passaporte_web.rb b/lib/passaporte_web.rb deleted file mode 100644 index 620ad92..0000000 --- a/lib/passaporte_web.rb +++ /dev/null @@ -1,40 +0,0 @@ -# encoding: utf-8 - -require 'oauth2' -require 'multi_json' - -require "passaporte_web/version" -require "passaporte_web/configuration" - -require "passaporte_web/client" -require "passaporte_web/client/application" -require "passaporte_web/client/exception" -require "passaporte_web/client/exception_wrapper" -require "passaporte_web/client/identity" -require "passaporte_web/client/oauth" - -require "passaporte_web/entities" -require "passaporte_web/entities/base" - -require "passaporte_web/entities/profile" -require "passaporte_web/entities/profile/professional_info" -require "passaporte_web/entities/profile/contacts" -require "passaporte_web/entities/profile/emails" - -require "passaporte_web/entities/sign_up" - -require "passaporte_web/resources" -require "passaporte_web/resources/base" -require "passaporte_web/resources/profile" -require "passaporte_web/resources/sign_up" -require "passaporte_web/resources/widget" - -module PassaporteWeb - def self.configuration - @configuration ||= Configuration.new - end - - def self.configure - yield(configuration) if block_given? - end -end diff --git a/lib/passaporte_web/client.rb b/lib/passaporte_web/client.rb deleted file mode 100644 index 35833b9..0000000 --- a/lib/passaporte_web/client.rb +++ /dev/null @@ -1,2 +0,0 @@ -module PassaporteWeb::Client -end diff --git a/lib/passaporte_web/client/application.rb b/lib/passaporte_web/client/application.rb deleted file mode 100644 index 568f4b8..0000000 --- a/lib/passaporte_web/client/application.rb +++ /dev/null @@ -1,35 +0,0 @@ -# PassaporteWeb Client for resources not owned by an Identity -# -# [API] -# Documentation: -# -# @example Inviting a new user: -# client = PassaporteWeb::Client::Application.new -# client.sign_up.create(invited: 'john.doe@example.com') -# -class PassaporteWeb::Client::Application - - def initialize - @tokens = {} - end - - # Provides a SignUp resource. - # @return [PassaporteWeb::Resources::SignUp] the signup resource. - def sign_up - PassaporteWeb::Resources::SignUp.new(token(:invite)) - end - - private - - attr_reader :tokens, :credentials - - def client - @client ||= PassaporteWeb::Client::OAuth.build - end - - def token(scope = nil) - token = tokens[scope] - return token unless token.nil? || token.expired? - tokens[scope] = PassaporteWeb::Client::ExceptionWrapper.new(client.client_credentials.get_token(scope: scope)) - end -end diff --git a/lib/passaporte_web/entities.rb b/lib/passaporte_web/entities.rb deleted file mode 100644 index 78f305e..0000000 --- a/lib/passaporte_web/entities.rb +++ /dev/null @@ -1,2 +0,0 @@ -module PassaporteWeb::Entities -end diff --git a/lib/passaporte_web/entities/profile/emails.rb b/lib/passaporte_web/entities/profile/emails.rb deleted file mode 100644 index 53cfecc..0000000 --- a/lib/passaporte_web/entities/profile/emails.rb +++ /dev/null @@ -1,4 +0,0 @@ -class PassaporteWeb::Entities::Profile::Emails < PassaporteWeb::Entities::Base - attribute :id, Integer - attribute :emails, Array[String] -end diff --git a/lib/passaporte_web/resources.rb b/lib/passaporte_web/resources.rb deleted file mode 100644 index 8c7bd23..0000000 --- a/lib/passaporte_web/resources.rb +++ /dev/null @@ -1,2 +0,0 @@ -module PassaporteWeb::Resources -end diff --git a/lib/passaporte_web/resources/sign_up.rb b/lib/passaporte_web/resources/sign_up.rb deleted file mode 100644 index 1d48a68..0000000 --- a/lib/passaporte_web/resources/sign_up.rb +++ /dev/null @@ -1,30 +0,0 @@ -# A wrapper to PassaporteWeb's sign up API -# -# [API] -# Documentation: -# -# @example Inviting a new user to PassaporteWeb (on behalf of an existing user): -# client = PassaporteWeb::Client::Identity.new(credentials) -# client.sign_up.create('john.doe@gmail.com') -# -# @example Inviting a new user to PassaporteWeb (on behalf of an application): -# client = PassaporteWeb::Client::Application.new -# client.sign_up.create('john.doe@gmail.com') -# -# @see PassaporteWeb::Client::Identity#initialize -# @see PassaporteWeb::Client::Application#initialize -class PassaporteWeb::Resources::SignUp < PassaporteWeb::Resources::Base - - # Invites an user to PassaporteWeb, by creating a new sign up. - # - # [API] - # Method: POST /api/v1/sign_up - # - # Documentation: - # @param [String] email The new user's email. - # - # @return [PassaporteWeb::Entities::SignUp] the new sign up; it contains the invited user's id. - def create(email) - respond_with_entity(api.post('/api/v1/sign_up', body: MultiJson.dump({ invited: email }))) - end -end diff --git a/lib/passaporte_web/resources/widget.rb b/lib/passaporte_web/resources/widget.rb deleted file mode 100644 index d751eaf..0000000 --- a/lib/passaporte_web/resources/widget.rb +++ /dev/null @@ -1,28 +0,0 @@ -# A wrapper to PassaporteWeb's widget API -# -# [API] -# Documentation: -# -# @example Obtaining the user's navbar URL: -# client = PassaporteWeb::Client::Identity.new(credentials) -# client.widget.navbar_url -# -# @example Inviting a new user to PassaporteWeb (on behalf of an application): -# client = PassaporteWeb::Client::Application.new -# client.sign_up.create('john.doe@gmail.com') -# -# @see PassaporteWeb::Client::Identity#initialize -class PassaporteWeb::Resources::Widget < PassaporteWeb::Resources::Base - - # Retrieves the user's navbar URL - # - # [API] - # Method: GET /api/v1/widgets/navbar - # - # Documentation: - # - # @return [String] user's navbar URL - def navbar_url - %(#{PassaporteWeb.configuration.url}/api/v1/widgets/navbar?access_token=#{api.token}) - end -end diff --git a/passaporteweb-client.gemspec b/nexaas-id-client.gemspec similarity index 75% rename from passaporteweb-client.gemspec rename to nexaas-id-client.gemspec index 3be2481..87541bf 100644 --- a/passaporteweb-client.gemspec +++ b/nexaas-id-client.gemspec @@ -3,16 +3,16 @@ lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) # Ensure we require the local version and not one we might have installed already -require File.join([File.dirname(__FILE__),'lib','passaporte_web','version.rb']) +require File.join([File.dirname(__FILE__),'lib','nexaas_id','version.rb']) Gem::Specification.new do |spec| - spec.name = "passaporteweb-client" - spec.version = PassaporteWeb::VERSION - spec.authors = ["Rodrigo Tassinari de Oliveira", "Eduardo Hertz", "Rafael B. Tauil"] - spec.email = ["rodrigo@pittlandia.net", "rodrigo.tassinari@myfreecomm.com.br", "eduardo.hertz@myfreecomm.com.br", "rafael@tauil.com.br"] - spec.description = %q{A Ruby client for the PassaporteWeb REST API} - spec.summary = %q{A Ruby client for the PassaporteWeb REST API: https://app.passaporteweb.com.br/static/docs/} - spec.homepage = "https://github.com/myfreecomm/passaporteweb-client-ruby" + spec.name = "nexaas-id-client" + spec.version = NexaasID::VERSION + spec.authors = ["Rodrigo Tassinari de Oliveira", "Eduardo Hertz", "Rafael B. Tauil", "Luiz Carlos Buiatte"] + spec.email = ["rodrigo@pittlandia.net", "rodrigo.tassinari@myfreecomm.com.br", "eduardo.hertz@myfreecomm.com.br", "rafael@tauil.com.br", "luiz.buiatte@nexaas.com"] + spec.description = %q{A Ruby client for the Nexaas ID REST API} + spec.summary = %q{A Ruby client for the Nexaas ID REST API: https://id.nexaas.com/static/docs/} + spec.homepage = "https://github.com/myfreecomm/nexaas-id-client-ruby" spec.license = "Apache-2.0" spec.has_rdoc = true @@ -32,7 +32,7 @@ Gem::Specification.new do |spec| spec.add_development_dependency "rdoc", "~> 6.0" spec.add_development_dependency "rspec", "~> 3.6" spec.add_development_dependency "vcr", "~> 2.4" - spec.add_development_dependency 'webmock', '~> 3.1.0', '>= 3.1.1' + spec.add_development_dependency 'webmock', '~> 3.4' spec.add_development_dependency "pry-byebug", "~> 3.4" spec.add_development_dependency "awesome_print", "~> 1.8" spec.add_development_dependency "simplecov", "~> 0.14" diff --git a/spec/fixtures/vcr_cassettes/access_token.yml b/spec/fixtures/vcr_cassettes/access_token.yml index 922d7ad..67c789a 100644 --- a/spec/fixtures/vcr_cassettes/access_token.yml +++ b/spec/fixtures/vcr_cassettes/access_token.yml @@ -2,7 +2,7 @@ http_interactions: - request: method: get - uri: https://sandbox.v2.passaporteweb.com.br/sign_in + uri: https://sandbox.id.nexaas.com/sign_in body: encoding: US-ASCII string: '' @@ -21,7 +21,7 @@ http_interactions: Server: - Cowboy Date: - - Mon, 13 Aug 2018 20:30:13 GMT + - Tue, 21 Aug 2018 19:15:31 GMT Connection: - keep-alive X-Frame-Options: @@ -41,15 +41,15 @@ http_interactions: Content-Language: - pt Etag: - - W/"00cff45b8d4bfb3289ff06b9afc49dee" + - W/"7bd8f972319c67d6d438fdf1bbd42516" Cache-Control: - max-age=0, private, must-revalidate Set-Cookie: - - _pw2_session=2f5dad0fd791c3ab1b6a92e954e2d59b; path=/; secure; HttpOnly; SameSite=Strict + - _pw2_session=59edd6c6a757d0fab536417a95c26367; path=/; secure; HttpOnly; SameSite=Strict X-Request-Id: - - dd3c525f-f0fd-41ab-8c22-2e8dcf4fbc53 + - 69eac610-fb27-45b8-918e-c66c701af579 X-Runtime: - - '0.080730' + - '0.037634' Strict-Transport-Security: - max-age=31536000; includeSubDomains Transfer-Encoding: @@ -59,20 +59,20 @@ http_interactions: body: encoding: ASCII-8BIT string: !binary |- - PCFET0NUWVBFIGh0bWw+CjxodG1sPgogIDxoZWFkPgogICAgPHRpdGxlPlBhc3NhcG9ydGVXZWI8L3RpdGxlPgogICAgPG1ldGEgbmFtZT0idmlld3BvcnQiIGNvbnRlbnQ9IndpZHRoPWRldmljZS13aWR0aCwgaW5pdGlhbC1zY2FsZT0xLjAiPgogICAgPG1ldGEgbmFtZT0iY3NyZi1wYXJhbSIgY29udGVudD0iYXV0aGVudGljaXR5X3Rva2VuIiAvPgo8bWV0YSBuYW1lPSJjc3JmLXRva2VuIiBjb250ZW50PSJGa3ZNNGFFV1M3dGEwLzN1N2ZRME43ZThLRWxSQ3NJRnNGc3UyMi91UDRFNHZOYnd2OUZJNk5RV3ZWOGpXUUhZc3pBNWNqN0Mvem9ZTmM5RjdCTm16QT09IiAvPgoKICAgIDxsaW5rIHJlbD0ic3R5bGVzaGVldCIgbWVkaWE9ImFsbCIgaHJlZj0iaHR0cHM6Ly9kY3A5M2U0ZG9pYjFyLmNsb3VkZnJvbnQubmV0L2Fzc2V0cy9hcHBsaWNhdGlvbi00ZGE3NGZkYTEyYWQ0NjViNjFhMjY4MTkwNTRiZDE3ZjI5ODdlNThlYWU5M2RiNDg2ZGFlMmFlZTk1ZTA0N2FkLmNzcyIgZGF0YS10dXJib2xpbmtzLXRyYWNrPSJyZWxvYWQiIC8+CiAgICA8c2NyaXB0IHNyYz0iaHR0cHM6Ly9kY3A5M2U0ZG9pYjFyLmNsb3VkZnJvbnQubmV0L2Fzc2V0cy9hcHBsaWNhdGlv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Dp288L2E+PC9saT4KICAgICAgICAgICAgPGxpPjxhIGhyZWY9Imh0dHBzOi8vbXlmcmVlY29tbS5naXRodWIuaW8vcGFzc2Fwb3J0ZS13ZWIiPkRvY3VtZW50YcOnw6NvIGRhIEFQSTwvYT48L2xpPgogICAgICAgICAgPC91bD4KICAgICAgICA8L2Rpdj4KICAgICAgPC9kaXY+CiAgICA8L2Rpdj4KICA8L2JvZHk+CjwvaHRtbD4K http_version: - recorded_at: Mon, 13 Aug 2018 20:30:13 GMT + recorded_at: Tue, 21 Aug 2018 19:15:30 GMT - request: method: post - uri: https://sandbox.v2.passaporteweb.com.br/sign_in + uri: https://sandbox.id.nexaas.com/sign_in body: encoding: US-ASCII - string: session%5Bemail%5D=luiz.buiatte%2Bpw.api.test%40nexaas.com&session%5Bpassword%5D=6VVsa8H6YtRJ&authenticity_token=Klh3wf%2FyfcdUTc136neVOQv52it5lOSDNH3Sxe8U%2BkkjFztTLk2mH8qyx68Nd5eL367F57sLZ%2FMCNuiqI9lc3w%3D%3D + string: session%5Bemail%5D=luiz.buiatte%2Bpw.api.test%40nexaas.com&session%5Bpassword%5D=6VVsa8H6YtRJ&authenticity_token=6qwQQiv2VYqYmv8SmN8loc6IZWqeXgpi%2FPBQmDC%2BBZ3tsr7nei44Sn929Q8xiC81YQY73v4Z7RCYgy37xGOzmw%3D%3D headers: User-Agent: - Faraday v0.12.2 Cookie: - - _pw2_session=2f5dad0fd791c3ab1b6a92e954e2d59b + - _pw2_session=59edd6c6a757d0fab536417a95c26367 Accept-Encoding: - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 Accept: @@ -85,7 +85,7 @@ http_interactions: Server: - Cowboy Date: - - Mon, 13 Aug 2018 20:30:13 GMT + - Tue, 21 Aug 2018 19:15:32 GMT Connection: - keep-alive X-Frame-Options: @@ -101,7 +101,7 @@ http_interactions: Referrer-Policy: - strict-origin-when-cross-origin Location: - - https://sandbox.v2.passaporteweb.com.br/profile + - https://sandbox.id.nexaas.com/profile Content-Language: - pt Content-Type: @@ -109,11 +109,11 @@ http_interactions: Cache-Control: - no-cache Set-Cookie: - - _pw2_session=5318d90897787cf6badd3466f0f23097; path=/; secure; HttpOnly; SameSite=Strict + - _pw2_session=141e482f38eb7078de9f1c31c462baab; path=/; secure; HttpOnly; SameSite=Strict X-Request-Id: - - ac238478-194f-40d8-8fab-11f5ee56d5b4 + - 4d533a77-4320-419d-8075-b1d1a67fbf14 X-Runtime: - - '0.147508' + - '0.149169' Strict-Transport-Security: - max-age=31536000; includeSubDomains Transfer-Encoding: @@ -122,12 +122,12 @@ http_interactions: - 1.1 vegur body: encoding: UTF-8 - string: You are being redirected. + string: You are being redirected. http_version: - recorded_at: Mon, 13 Aug 2018 20:30:14 GMT + recorded_at: Tue, 21 Aug 2018 19:15:32 GMT - request: method: get - uri: https://sandbox.v2.passaporteweb.com.br/oauth/authorize?client_id=QMKAZVAZ6NBR3IO2MCEHOGKVCY&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code&scope=profile%20invite + uri: https://sandbox.id.nexaas.com/oauth/authorize?client_id=QMKAZVAZ6NBR3IO2MCEHOGKVCY&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code&scope=profile%20invite body: encoding: US-ASCII string: '' @@ -135,7 +135,7 @@ http_interactions: User-Agent: - Faraday v0.12.2 Cookie: - - _pw2_session=5318d90897787cf6badd3466f0f23097 + - _pw2_session=141e482f38eb7078de9f1c31c462baab Accept-Encoding: - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 Accept: @@ -148,7 +148,7 @@ http_interactions: Server: - Cowboy Date: - - Mon, 13 Aug 2018 20:30:15 GMT + - Tue, 21 Aug 2018 19:15:33 GMT Connection: - keep-alive X-Frame-Options: @@ -164,7 +164,7 @@ http_interactions: Referrer-Policy: - strict-origin-when-cross-origin Location: - - https://sandbox.v2.passaporteweb.com.br/oauth/authorize/native?code=8561134d57043c840a348f091a8b7f09764e79107cfb3965d965dd7a9e400a1f + - https://sandbox.id.nexaas.com/oauth/authorize/native?code=d27c8cd28642573ed1dc0bb559c327bece609a65ae9a8ffa12e7a9821715e3ea Content-Language: - pt Content-Type: @@ -172,9 +172,9 @@ http_interactions: Cache-Control: - no-cache X-Request-Id: - - 9c2bfa62-58ea-4c32-b0a1-2b09aff47b97 + - 44e97e7b-db53-47f3-9f4e-42b92796610d X-Runtime: - - '0.073436' + - '0.038608' Strict-Transport-Security: - max-age=31536000; includeSubDomains Transfer-Encoding: @@ -183,15 +183,15 @@ http_interactions: - 1.1 vegur body: encoding: UTF-8 - string: You are being redirected. + string: You are being redirected. http_version: - recorded_at: Mon, 13 Aug 2018 20:30:15 GMT + recorded_at: Tue, 21 Aug 2018 19:15:32 GMT - request: method: post - uri: https://sandbox.v2.passaporteweb.com.br/oauth/token + uri: https://sandbox.id.nexaas.com/oauth/token body: encoding: UTF-8 - string: client_id=QMKAZVAZ6NBR3IO2MCEHOGKVCY&client_secret=HXKQYGAQ4JHR5HR73SKOQ5NI6E&code=8561134d57043c840a348f091a8b7f09764e79107cfb3965d965dd7a9e400a1f&grant_type=authorization_code&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob + string: client_id=QMKAZVAZ6NBR3IO2MCEHOGKVCY&client_secret=HXKQYGAQ4JHR5HR73SKOQ5NI6E&code=d27c8cd28642573ed1dc0bb559c327bece609a65ae9a8ffa12e7a9821715e3ea&grant_type=authorization_code&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob headers: Accept: - application/json @@ -209,7 +209,7 @@ http_interactions: Server: - Cowboy Date: - - Mon, 13 Aug 2018 20:30:16 GMT + - Tue, 21 Aug 2018 19:15:34 GMT Connection: - keep-alive Cache-Control: @@ -219,11 +219,11 @@ http_interactions: Content-Type: - application/json; charset=utf-8 Etag: - - W/"2bb4657d5e700b5df072c45715e43ecb" + - W/"7c3c3bb2dd1953c314a076db513bbbc8" X-Request-Id: - - ea39abe5-c0d6-4094-adf6-a62471011b92 + - 89828172-bec7-475c-a9d8-7a25521de9ba X-Runtime: - - '0.032125' + - '0.024475' Strict-Transport-Security: - max-age=31536000; includeSubDomains Transfer-Encoding: @@ -232,8 +232,8 @@ http_interactions: - 1.1 vegur body: encoding: UTF-8 - string: '{"access_token":"af086644fd91bf2f2365110f74ff02187fe3fd79686312f702af7f45d988154b","token_type":"bearer","expires_in":7200,"refresh_token":"27b384e5771535933475ec3c8751366ad22731da09bd93de31f8befcb8bdd226","scope":"profile - invite","created_at":1534192216}' + string: '{"access_token":"6cf4f0b92293cdef5291b1d3f6509996e0caf5b4c0ad01a88c7cec48a2c6daba","token_type":"bearer","expires_in":7200,"refresh_token":"193501fb0c37f1550fea30014b3e28c86ca4a5262fc934c1d76b36a912cbcb9a","scope":"profile + invite","created_at":1534878934}' http_version: - recorded_at: Mon, 13 Aug 2018 20:30:16 GMT + recorded_at: Tue, 21 Aug 2018 19:15:33 GMT recorded_with: VCR 2.9.3 diff --git a/spec/fixtures/vcr_cassettes/application/sign_up/client_credentials.yml b/spec/fixtures/vcr_cassettes/application/sign_up/client_credentials.yml index 772fe2a..1c50fcb 100644 --- a/spec/fixtures/vcr_cassettes/application/sign_up/client_credentials.yml +++ b/spec/fixtures/vcr_cassettes/application/sign_up/client_credentials.yml @@ -2,7 +2,7 @@ http_interactions: - request: method: post - uri: https://sandbox.v2.passaporteweb.com.br/oauth/token + uri: https://sandbox.id.nexaas.com/oauth/token body: encoding: UTF-8 string: client_id=QMKAZVAZ6NBR3IO2MCEHOGKVCY&client_secret=HXKQYGAQ4JHR5HR73SKOQ5NI6E&grant_type=client_credentials&scope=invite @@ -23,7 +23,7 @@ http_interactions: Server: - Cowboy Date: - - Mon, 13 Aug 2018 20:30:12 GMT + - Tue, 21 Aug 2018 19:15:31 GMT Connection: - keep-alive Cache-Control: @@ -33,11 +33,11 @@ http_interactions: Content-Type: - application/json; charset=utf-8 Etag: - - W/"c40b9e5a388c41b2833c1e731d64187e" + - W/"e48f64374d0f974fabb5efba340b2a0b" X-Request-Id: - - 5c534f8e-4303-4ed2-990a-ead1c36865c6 + - 8646940d-f6d9-4a7e-afac-be55825a17ed X-Runtime: - - '0.067284' + - '0.058416' Strict-Transport-Security: - max-age=31536000; includeSubDomains Transfer-Encoding: @@ -46,7 +46,7 @@ http_interactions: - 1.1 vegur body: encoding: UTF-8 - string: '{"access_token":"4187b50a75ca0c76c326301b1c95837c329d9820ee1e3ce09a2453edd644285b","token_type":"bearer","expires_in":7200,"scope":"invite","created_at":1534192212}' + string: '{"access_token":"22f48e6fb28546f8cc637b060eb66c83d7579b01d86da3cc74958dcba1df84d3","token_type":"bearer","expires_in":7200,"scope":"invite","created_at":1534878931}' http_version: - recorded_at: Mon, 13 Aug 2018 20:30:12 GMT + recorded_at: Tue, 21 Aug 2018 19:15:30 GMT recorded_with: VCR 2.9.3 diff --git a/spec/fixtures/vcr_cassettes/application/sign_up/create/success.yml b/spec/fixtures/vcr_cassettes/application/sign_up/create/success.yml index da1ec96..3ac04bb 100644 --- a/spec/fixtures/vcr_cassettes/application/sign_up/create/success.yml +++ b/spec/fixtures/vcr_cassettes/application/sign_up/create/success.yml @@ -2,7 +2,7 @@ http_interactions: - request: method: post - uri: https://sandbox.v2.passaporteweb.com.br/oauth/token + uri: https://sandbox.id.nexaas.com/oauth/token body: encoding: UTF-8 string: client_id=QMKAZVAZ6NBR3IO2MCEHOGKVCY&client_secret=HXKQYGAQ4JHR5HR73SKOQ5NI6E&grant_type=client_credentials&scope=invite @@ -23,7 +23,7 @@ http_interactions: Server: - Cowboy Date: - - Mon, 13 Aug 2018 20:30:20 GMT + - Tue, 21 Aug 2018 19:15:38 GMT Connection: - keep-alive Cache-Control: @@ -33,11 +33,11 @@ http_interactions: Content-Type: - application/json; charset=utf-8 Etag: - - W/"3b7bf2d73eea97721e49f0491bd69ff5" + - W/"cca2790160d81e73bbb5a7a991e52794" X-Request-Id: - - 45822c63-da2a-482d-a1df-faf5ab48bb6e + - 37b7e919-0369-42e2-ae5a-99aef5a54bdf X-Runtime: - - '0.015522' + - '0.018634' Strict-Transport-Security: - max-age=31536000; includeSubDomains Transfer-Encoding: @@ -46,12 +46,12 @@ http_interactions: - 1.1 vegur body: encoding: UTF-8 - string: '{"access_token":"a959f6f2caf5d078cfaaf60dd32a3bd358bb81f32121f38d1ae8b85504673a9d","token_type":"bearer","expires_in":7200,"scope":"invite","created_at":1534192220}' + string: '{"access_token":"78e6cc73f6b9a2011b1ea019d3bb8335ecca4880c66a3b06d54e3e9461e63113","token_type":"bearer","expires_in":7200,"scope":"invite","created_at":1534878939}' http_version: - recorded_at: Mon, 13 Aug 2018 20:30:20 GMT + recorded_at: Tue, 21 Aug 2018 19:15:37 GMT - request: method: post - uri: https://sandbox.v2.passaporteweb.com.br/api/v1/sign_up + uri: https://sandbox.id.nexaas.com/api/v1/sign_up body: encoding: UTF-8 string: '{"invited":"demurtas@mailinator.com"}' @@ -63,7 +63,7 @@ http_interactions: User-Agent: - Faraday v0.12.2 Authorization: - - Bearer a959f6f2caf5d078cfaaf60dd32a3bd358bb81f32121f38d1ae8b85504673a9d + - Bearer 78e6cc73f6b9a2011b1ea019d3bb8335ecca4880c66a3b06d54e3e9461e63113 Accept-Encoding: - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 response: @@ -74,19 +74,19 @@ http_interactions: Server: - Cowboy Date: - - Mon, 13 Aug 2018 20:30:20 GMT + - Tue, 21 Aug 2018 19:15:39 GMT Connection: - keep-alive Content-Type: - application/json; charset=utf-8 Etag: - - W/"ed5147c554a8139f288875111fa84458" + - W/"e1d3f63a5bcfb570e6c33e6b59b299de" Cache-Control: - max-age=0, private, must-revalidate X-Request-Id: - - 6a582912-8b2a-447a-b51d-0f67d5c941a1 + - bda14004-ca39-4d09-94f9-64331d3facd2 X-Runtime: - - '0.040819' + - '0.042995' Strict-Transport-Security: - max-age=31536000; includeSubDomains Transfer-Encoding: @@ -95,7 +95,7 @@ http_interactions: - 1.1 vegur body: encoding: UTF-8 - string: '{"id":"d54d41c0-4d0f-4270-97fa-140b076f5c34","email":"demurtas@mailinator.com","requester":null}' + string: '{"id":"7435b7ac-0171-4306-b01b-593eb6aef500","email":"demurtas@mailinator.com","requester":null}' http_version: - recorded_at: Mon, 13 Aug 2018 20:30:21 GMT + recorded_at: Tue, 21 Aug 2018 19:15:38 GMT recorded_with: VCR 2.9.3 diff --git a/spec/fixtures/vcr_cassettes/identity/profile/contacts/success.yml b/spec/fixtures/vcr_cassettes/identity/profile/contacts/success.yml index 01ddeb7..c5c6a39 100644 --- a/spec/fixtures/vcr_cassettes/identity/profile/contacts/success.yml +++ b/spec/fixtures/vcr_cassettes/identity/profile/contacts/success.yml @@ -2,7 +2,7 @@ http_interactions: - request: method: get - uri: https://sandbox.v2.passaporteweb.com.br/api/v1/profile/contacts + uri: https://sandbox.id.nexaas.com/api/v1/profile/contacts body: encoding: US-ASCII string: '' @@ -14,7 +14,7 @@ http_interactions: User-Agent: - Faraday v0.12.2 Authorization: - - Bearer af086644fd91bf2f2365110f74ff02187fe3fd79686312f702af7f45d988154b + - Bearer 6cf4f0b92293cdef5291b1d3f6509996e0caf5b4c0ad01a88c7cec48a2c6daba Accept-Encoding: - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 response: @@ -25,7 +25,7 @@ http_interactions: Server: - Cowboy Date: - - Mon, 13 Aug 2018 20:30:17 GMT + - Tue, 21 Aug 2018 19:15:36 GMT Connection: - keep-alive Content-Type: @@ -35,9 +35,9 @@ http_interactions: Cache-Control: - max-age=0, private, must-revalidate X-Request-Id: - - 04cc1d99-5c7e-4f10-8449-648b5c0c6840 + - 52c5f5e8-da38-4372-815f-e1c780cd40e8 X-Runtime: - - '0.016916' + - '0.018464' Strict-Transport-Security: - max-age=31536000; includeSubDomains Transfer-Encoding: @@ -48,5 +48,5 @@ http_interactions: encoding: UTF-8 string: '{"id":"57bb5938-d0c5-439a-9986-e5c565124beb","phone_numbers":["+55-211111111111111"]}' http_version: - recorded_at: Mon, 13 Aug 2018 20:30:18 GMT + recorded_at: Tue, 21 Aug 2018 19:15:36 GMT recorded_with: VCR 2.9.3 diff --git a/spec/fixtures/vcr_cassettes/identity/profile/emails/success.yml b/spec/fixtures/vcr_cassettes/identity/profile/emails/success.yml index 0423c52..77098ab 100644 --- a/spec/fixtures/vcr_cassettes/identity/profile/emails/success.yml +++ b/spec/fixtures/vcr_cassettes/identity/profile/emails/success.yml @@ -2,7 +2,7 @@ http_interactions: - request: method: get - uri: https://sandbox.v2.passaporteweb.com.br/api/v1/profile/emails + uri: https://sandbox.id.nexaas.com/api/v1/profile/emails body: encoding: US-ASCII string: '' @@ -14,7 +14,7 @@ http_interactions: User-Agent: - Faraday v0.12.2 Authorization: - - Bearer af086644fd91bf2f2365110f74ff02187fe3fd79686312f702af7f45d988154b + - Bearer 6cf4f0b92293cdef5291b1d3f6509996e0caf5b4c0ad01a88c7cec48a2c6daba Accept-Encoding: - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 response: @@ -25,7 +25,7 @@ http_interactions: Server: - Cowboy Date: - - Mon, 13 Aug 2018 20:30:19 GMT + - Tue, 21 Aug 2018 19:15:37 GMT Connection: - keep-alive Content-Type: @@ -35,9 +35,9 @@ http_interactions: Cache-Control: - max-age=0, private, must-revalidate X-Request-Id: - - 26251e68-98c0-4bbe-87ac-3d3477e9d7e7 + - 5044c31b-0e68-4f40-8a2b-0477fd9fd3d6 X-Runtime: - - '0.013379' + - '0.016047' Strict-Transport-Security: - max-age=31536000; includeSubDomains Transfer-Encoding: @@ -48,5 +48,5 @@ http_interactions: encoding: UTF-8 string: '{"id":"57bb5938-d0c5-439a-9986-e5c565124beb","emails":["luiz.buiatte+pw.api.test@nexaas.com"]}' http_version: - recorded_at: Mon, 13 Aug 2018 20:30:19 GMT + recorded_at: Tue, 21 Aug 2018 19:15:37 GMT recorded_with: VCR 2.9.3 diff --git a/spec/fixtures/vcr_cassettes/identity/profile/professional_info/success.yml b/spec/fixtures/vcr_cassettes/identity/profile/professional_info/success.yml index 2ae4b84..56b35e4 100644 --- a/spec/fixtures/vcr_cassettes/identity/profile/professional_info/success.yml +++ b/spec/fixtures/vcr_cassettes/identity/profile/professional_info/success.yml @@ -2,7 +2,7 @@ http_interactions: - request: method: get - uri: https://sandbox.v2.passaporteweb.com.br/api/v1/profile/professional_info + uri: https://sandbox.id.nexaas.com/api/v1/profile/professional_info body: encoding: US-ASCII string: '' @@ -14,7 +14,7 @@ http_interactions: User-Agent: - Faraday v0.12.2 Authorization: - - Bearer af086644fd91bf2f2365110f74ff02187fe3fd79686312f702af7f45d988154b + - Bearer 6cf4f0b92293cdef5291b1d3f6509996e0caf5b4c0ad01a88c7cec48a2c6daba Accept-Encoding: - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 response: @@ -25,7 +25,7 @@ http_interactions: Server: - Cowboy Date: - - Mon, 13 Aug 2018 20:30:17 GMT + - Tue, 21 Aug 2018 19:15:35 GMT Connection: - keep-alive Content-Type: @@ -35,9 +35,9 @@ http_interactions: Cache-Control: - max-age=0, private, must-revalidate X-Request-Id: - - c79f8c8d-eb45-4edb-b594-00296210bbe6 + - 4872c198-14b3-4ac8-bcd4-ae3e5e0bf08d X-Runtime: - - '0.012453' + - '0.011262' Strict-Transport-Security: - max-age=31536000; includeSubDomains Transfer-Encoding: @@ -49,5 +49,5 @@ http_interactions: string: '{"id":"57bb5938-d0c5-439a-9986-e5c565124beb","profession":"Systems Integrator","company":"Nexaas","position":"API"}' http_version: - recorded_at: Mon, 13 Aug 2018 20:30:18 GMT + recorded_at: Tue, 21 Aug 2018 19:15:35 GMT recorded_with: VCR 2.9.3 diff --git a/spec/fixtures/vcr_cassettes/identity/profile/profile/success.yml b/spec/fixtures/vcr_cassettes/identity/profile/profile/success.yml index 198a54c..55900ef 100644 --- a/spec/fixtures/vcr_cassettes/identity/profile/profile/success.yml +++ b/spec/fixtures/vcr_cassettes/identity/profile/profile/success.yml @@ -2,7 +2,7 @@ http_interactions: - request: method: get - uri: https://sandbox.v2.passaporteweb.com.br/api/v1/profile + uri: https://sandbox.id.nexaas.com/api/v1/profile body: encoding: US-ASCII string: '' @@ -14,7 +14,7 @@ http_interactions: User-Agent: - Faraday v0.12.2 Authorization: - - Bearer af086644fd91bf2f2365110f74ff02187fe3fd79686312f702af7f45d988154b + - Bearer 6cf4f0b92293cdef5291b1d3f6509996e0caf5b4c0ad01a88c7cec48a2c6daba Accept-Encoding: - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 response: @@ -25,19 +25,19 @@ http_interactions: Server: - Cowboy Date: - - Mon, 13 Aug 2018 20:30:16 GMT + - Tue, 21 Aug 2018 19:15:35 GMT Connection: - keep-alive Content-Type: - application/json; charset=utf-8 Etag: - - W/"538d551b7cecf525d6d2900743b41248" + - W/"3fbb371964cbcbfe051883a056378256" Cache-Control: - max-age=0, private, must-revalidate X-Request-Id: - - c88c331a-da20-43e6-9a99-f9075993c90a + - c3099481-27d9-43c7-b713-d1de62b70c42 X-Runtime: - - '0.015249' + - '0.013089' Strict-Transport-Security: - max-age=31536000; includeSubDomains Transfer-Encoding: @@ -47,7 +47,7 @@ http_interactions: body: encoding: UTF-8 string: '{"id":"57bb5938-d0c5-439a-9986-e5c565124beb","name":"PassaporteWeb - API Test","nickname":"pw.api.test","email":"luiz.buiatte+pw.api.test@nexaas.com","birth":"2018-08-09","gender":"other","language":"en","picture":"https://sandbox.v2.passaporteweb.com.br/images/avatar/57bb5938-d0c5-439a-9986-e5c565124beb?size=140","timezone":"America/Sao_Paulo","country":"BR","city":"","bio":""}' + API Test","nickname":"pw.api.test","email":"luiz.buiatte+pw.api.test@nexaas.com","birth":"2018-08-09","gender":"other","language":"en","picture":"https://sandbox.id.nexaas.com/images/avatar/57bb5938-d0c5-439a-9986-e5c565124beb?size=140","timezone":"America/Sao_Paulo","country":"BR","city":"","bio":""}' http_version: - recorded_at: Mon, 13 Aug 2018 20:30:17 GMT + recorded_at: Tue, 21 Aug 2018 19:15:34 GMT recorded_with: VCR 2.9.3 diff --git a/spec/fixtures/vcr_cassettes/identity/sign_up/create/success.yml b/spec/fixtures/vcr_cassettes/identity/sign_up/create/success.yml index caec1a8..3ed04db 100644 --- a/spec/fixtures/vcr_cassettes/identity/sign_up/create/success.yml +++ b/spec/fixtures/vcr_cassettes/identity/sign_up/create/success.yml @@ -2,7 +2,7 @@ http_interactions: - request: method: post - uri: https://sandbox.v2.passaporteweb.com.br/api/v1/sign_up + uri: https://sandbox.id.nexaas.com/api/v1/sign_up body: encoding: UTF-8 string: '{"invited":"demurtas@mailinator.com"}' @@ -14,7 +14,7 @@ http_interactions: User-Agent: - Faraday v0.12.2 Authorization: - - Bearer af086644fd91bf2f2365110f74ff02187fe3fd79686312f702af7f45d988154b + - Bearer 6cf4f0b92293cdef5291b1d3f6509996e0caf5b4c0ad01a88c7cec48a2c6daba Accept-Encoding: - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 response: @@ -25,19 +25,19 @@ http_interactions: Server: - Cowboy Date: - - Mon, 13 Aug 2018 20:30:22 GMT + - Tue, 21 Aug 2018 19:15:40 GMT Connection: - keep-alive Content-Type: - application/json; charset=utf-8 Etag: - - W/"eefb3bb5c520cd24c45477ff1b878f57" + - W/"3d045b7d066b6212cf03bcb8dee1e258" Cache-Control: - max-age=0, private, must-revalidate X-Request-Id: - - a5ce01c9-ec2a-4bbf-878e-2f81cce89467 + - d8649bf3-f1b8-4fd2-8df2-b2234053e558 X-Runtime: - - '0.039395' + - '0.033277' Strict-Transport-Security: - max-age=31536000; includeSubDomains Transfer-Encoding: @@ -46,7 +46,7 @@ http_interactions: - 1.1 vegur body: encoding: UTF-8 - string: '{"id":"d54d41c0-4d0f-4270-97fa-140b076f5c34","email":"demurtas@mailinator.com","requester":"57bb5938-d0c5-439a-9986-e5c565124beb"}' + string: '{"id":"7435b7ac-0171-4306-b01b-593eb6aef500","email":"demurtas@mailinator.com","requester":"57bb5938-d0c5-439a-9986-e5c565124beb"}' http_version: - recorded_at: Mon, 13 Aug 2018 20:30:22 GMT + recorded_at: Tue, 21 Aug 2018 19:15:40 GMT recorded_with: VCR 2.9.3 diff --git a/spec/fixtures/vcr_cassettes/identity/widget/navbar_url/success.yml b/spec/fixtures/vcr_cassettes/identity/widget/navbar_url/success.yml index 524d929..7152c3f 100644 --- a/spec/fixtures/vcr_cassettes/identity/widget/navbar_url/success.yml +++ b/spec/fixtures/vcr_cassettes/identity/widget/navbar_url/success.yml @@ -2,7 +2,7 @@ http_interactions: - request: method: get - uri: https://sandbox.v2.passaporteweb.com.br/api/v1/widgets/navbar?access_token=80f401056b3493cf9dee19f74d1d6fdcf614cb4761563118d1b39b7108baad87 + uri: https://sandbox.id.nexaas.com/api/v1/widgets/navbar?access_token=6cf4f0b92293cdef5291b1d3f6509996e0caf5b4c0ad01a88c7cec48a2c6daba body: encoding: US-ASCII string: '' @@ -21,19 +21,19 @@ http_interactions: Server: - Cowboy Date: - - Mon, 13 Aug 2018 18:11:04 GMT + - Tue, 21 Aug 2018 19:15:41 GMT Connection: - keep-alive Content-Type: - text/javascript; charset=utf-8 Etag: - - W/"099bebe7db7f0a8a23bc89dfeed905a3" + - W/"64a5fa4eaadfe44f6449c6d793993d69" Cache-Control: - max-age=0, private, must-revalidate X-Request-Id: - - 0b149898-c835-4870-b4c4-bb98571f5c61 + - 952a9834-692a-460f-9fd0-40fa8c15e591 X-Runtime: - - '0.105660' + - '0.024244' Strict-Transport-Security: - max-age=31536000; includeSubDomains Transfer-Encoding: @@ -44,7 +44,7 @@ http_interactions: encoding: UTF-8 string: | function createNavbar() { - var html = ''; + var html = ''; var htmlObject = document.createElement('div'); htmlObject.innerHTML = html; @@ -68,74 +68,5 @@ http_interactions: document.addEventListener("DOMContentLoaded", createNavbar); http_version: - recorded_at: Mon, 13 Aug 2018 18:11:05 GMT -- request: - method: get - uri: https://sandbox.v2.passaporteweb.com.br/api/v1/widgets/navbar?access_token=af086644fd91bf2f2365110f74ff02187fe3fd79686312f702af7f45d988154b - body: - encoding: US-ASCII - string: '' - headers: - User-Agent: - - Faraday v0.12.2 - Accept-Encoding: - - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 - Accept: - - "*/*" - response: - status: - code: 200 - message: OK - headers: - Server: - - Cowboy - Date: - - Mon, 13 Aug 2018 20:30:23 GMT - Connection: - - keep-alive - Content-Type: - - text/javascript; charset=utf-8 - Etag: - - W/"ea127366657bde268b695e4d8cf4935b" - Cache-Control: - - max-age=0, private, must-revalidate - X-Request-Id: - - ade82962-d10b-4940-a6f0-db29527e3ba5 - X-Runtime: - - '0.019629' - Strict-Transport-Security: - - max-age=31536000; includeSubDomains - Transfer-Encoding: - - chunked - Via: - - 1.1 vegur - body: - encoding: UTF-8 - string: | - function createNavbar() { - var html = ''; - - var htmlObject = document.createElement('div'); - htmlObject.innerHTML = html; - - document.body.insertBefore(htmlObject, document.body.firstChild); - - document.addEventListener('click', function(event) { - var button = document.getElementById('pw2-dropdown-button'); - var dropdownMenu = button.nextElementSibling; - - if ( event.target === button || event.target.parentElement === button ) { - var newStatus = dropdownMenu.style.display == "none" ? "block" : "none"; - dropdownMenu.style.display = newStatus; - } else if ( event.target.offsetParent === dropdownMenu) { - return; - } else { - dropdownMenu.style.display = 'none'; - } - }); - } - - document.addEventListener("DOMContentLoaded", createNavbar); - http_version: - recorded_at: Mon, 13 Aug 2018 20:30:23 GMT + recorded_at: Tue, 21 Aug 2018 19:15:40 GMT recorded_with: VCR 2.9.3 diff --git a/spec/passaporte_web/client/application_spec.rb b/spec/nexaas_id/client/application_spec.rb similarity index 64% rename from spec/passaporte_web/client/application_spec.rb rename to spec/nexaas_id/client/application_spec.rb index 4cb839b..1190bb2 100644 --- a/spec/passaporte_web/client/application_spec.rb +++ b/spec/nexaas_id/client/application_spec.rb @@ -1,12 +1,12 @@ require 'spec_helper' -describe PassaporteWeb::Client::Application do +describe NexaasID::Client::Application do subject { described_class.new } describe '#sign_up' do it 'provides the signup resource' do VCR.use_cassette('application/sign_up/client_credentials') do - expect(subject.sign_up).to be_a(PassaporteWeb::Resources::SignUp) + expect(subject.sign_up).to be_a(NexaasID::Resources::SignUp) end end end diff --git a/spec/passaporte_web/client/exception_spec.rb b/spec/nexaas_id/client/exception_spec.rb similarity index 90% rename from spec/passaporte_web/client/exception_spec.rb rename to spec/nexaas_id/client/exception_spec.rb index c8155f9..00736ee 100644 --- a/spec/passaporte_web/client/exception_spec.rb +++ b/spec/nexaas_id/client/exception_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe PassaporteWeb::Client::Exception do +describe NexaasID::Client::Exception do subject { described_class.new('foobar', response) } let(:headers) { { 'Content-Type' => 'application/json' } } diff --git a/spec/passaporte_web/client/exception_wrapper_spec.rb b/spec/nexaas_id/client/exception_wrapper_spec.rb similarity index 83% rename from spec/passaporte_web/client/exception_wrapper_spec.rb rename to spec/nexaas_id/client/exception_wrapper_spec.rb index 6275124..4744ce3 100644 --- a/spec/passaporte_web/client/exception_wrapper_spec.rb +++ b/spec/nexaas_id/client/exception_wrapper_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe PassaporteWeb::Client::ExceptionWrapper do +describe NexaasID::Client::ExceptionWrapper do let(:token) { instance_double('OAuth::AccessToken') } subject { described_class.new(token) } @@ -20,12 +20,12 @@ it 'should raise an exception for Faraday::ClientError' do expect(token).to receive(:request).with(:get, '/api/v1/profile').and_raise(faraday_error) - expect { subject.request(:get, '/api/v1/profile') }.to raise_error(PassaporteWeb::Client::Exception) + expect { subject.request(:get, '/api/v1/profile') }.to raise_error(NexaasID::Client::Exception) end it 'should raise an exception for Faraday::ClientError' do expect(token).to receive(:request).with(:get, '/api/v1/profile').and_raise(oauth2_error) - expect { subject.request(:get, '/api/v1/profile') }.to raise_error(PassaporteWeb::Client::Exception) + expect { subject.request(:get, '/api/v1/profile') }.to raise_error(NexaasID::Client::Exception) end end @@ -37,12 +37,12 @@ it 'should raise an exception for Faraday::ClientError' do expect(token).to receive(:refresh).with(a: :b).and_raise(faraday_error) - expect { subject.refresh(a: :b) }.to raise_error(PassaporteWeb::Client::Exception) + expect { subject.refresh(a: :b) }.to raise_error(NexaasID::Client::Exception) end it 'should raise an exception for Faraday::ClientError' do expect(token).to receive(:refresh).with(a: :b).and_raise(oauth2_error) - expect { subject.refresh(a: :b) }.to raise_error(PassaporteWeb::Client::Exception) + expect { subject.refresh(a: :b) }.to raise_error(NexaasID::Client::Exception) end end end diff --git a/spec/passaporte_web/client/identity_spec.rb b/spec/nexaas_id/client/identity_spec.rb similarity index 65% rename from spec/passaporte_web/client/identity_spec.rb rename to spec/nexaas_id/client/identity_spec.rb index 684b19f..207ce0c 100644 --- a/spec/passaporte_web/client/identity_spec.rb +++ b/spec/nexaas_id/client/identity_spec.rb @@ -1,12 +1,12 @@ require 'spec_helper' -describe PassaporteWeb::Client::Identity do +describe NexaasID::Client::Identity do subject { described_class.new(user_credentials) } describe '#profile' do it 'provides the profile resource' do VCR.use_cassette('identity/refresh_token') do - expect(subject.profile).to be_a(PassaporteWeb::Resources::Profile) + expect(subject.profile).to be_a(NexaasID::Resources::Profile) end end end @@ -14,7 +14,7 @@ describe '#sign_up' do it 'provides the signup resource' do VCR.use_cassette('identity/refresh_token') do - expect(subject.sign_up).to be_a(PassaporteWeb::Resources::SignUp) + expect(subject.sign_up).to be_a(NexaasID::Resources::SignUp) end end end @@ -22,7 +22,7 @@ describe '#sign_up' do it 'provides the widget resource' do VCR.use_cassette('identity/refresh_token') do - expect(subject.widget).to be_a(PassaporteWeb::Resources::Widget) + expect(subject.widget).to be_a(NexaasID::Resources::Widget) end end end diff --git a/spec/passaporte_web/configuration_spec.rb b/spec/nexaas_id/configuration_spec.rb similarity index 51% rename from spec/passaporte_web/configuration_spec.rb rename to spec/nexaas_id/configuration_spec.rb index 89ff671..6d76d1e 100644 --- a/spec/passaporte_web/configuration_spec.rb +++ b/spec/nexaas_id/configuration_spec.rb @@ -1,24 +1,24 @@ # encoding: utf-8 require 'spec_helper' -describe PassaporteWeb::Configuration do +describe NexaasID::Configuration do - it "should use the production PassaporteWeb URL by default" do - expect(PassaporteWeb::Configuration.new.url).to eq('https://v2.passaporteweb.com.br') + it "should use the production NexaasID URL by default" do + expect(NexaasID::Configuration.new.url).to eq('https://id.nexaas.com') end it "should use a default user agent" do - expect(PassaporteWeb::Configuration.new.user_agent).to eq("PassaporteWeb Ruby Client v#{PassaporteWeb::VERSION}") + expect(NexaasID::Configuration.new.user_agent).to eq("NexaasID Ruby Client v#{NexaasID::VERSION}") end it 'should allow setting the configuration parameters' do - config = PassaporteWeb::Configuration.new + config = NexaasID::Configuration.new - config.url = 'http://sandbox.v2.passaporteweb.com.br' + config.url = 'https://sandbox.id.nexaas.com' config.application_token = '58ca7acc-9479-4671-8b7c-745c5a65ce08' config.application_secret = '8da0d1a5-961d-461f-8ae6-1922db172340' - expect(config.url).to eq('http://sandbox.v2.passaporteweb.com.br') + expect(config.url).to eq('https://sandbox.id.nexaas.com') expect(config.application_token).to eq('58ca7acc-9479-4671-8b7c-745c5a65ce08') expect(config.application_secret).to eq('8da0d1a5-961d-461f-8ae6-1922db172340') end @@ -27,11 +27,11 @@ let(:configuration) { described_class.new } it 'generates an URL to a resource' do - expect(configuration.url_for('/api/v1/profile')).to eq('https://v2.passaporteweb.com.br/api/v1/profile') + expect(configuration.url_for('/api/v1/profile')).to eq('https://id.nexaas.com/api/v1/profile') - configuration.url = 'https://sandbox.v2.passaporteweb.com.br/' + configuration.url = 'https://sandbox.id.nexaas.com/' expect(configuration.url_for('/api/v1/profile')) - .to eq('https://sandbox.v2.passaporteweb.com.br/api/v1/profile') + .to eq('https://sandbox.id.nexaas.com/api/v1/profile') end end diff --git a/spec/passaporte_web/resources/profile_spec.rb b/spec/nexaas_id/resources/profile_spec.rb similarity index 76% rename from spec/passaporte_web/resources/profile_spec.rb rename to spec/nexaas_id/resources/profile_spec.rb index c691ca5..69cb116 100644 --- a/spec/passaporte_web/resources/profile_spec.rb +++ b/spec/nexaas_id/resources/profile_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' -describe PassaporteWeb::Resources::Profile do - let(:client) { PassaporteWeb::Client::Identity.new(user_credentials) } +describe NexaasID::Resources::Profile do + let(:client) { NexaasID::Client::Identity.new(user_credentials) } let(:resource) { client.profile } describe "#get" do @@ -9,7 +9,7 @@ it 'returns the profile for the user' do VCR.use_cassette('identity/profile/profile/success') do - expect(subject).to be_a(PassaporteWeb::Entities::Profile) + expect(subject).to be_a(NexaasID::Entities::Profile) expect(subject.id).to eq('57bb5938-d0c5-439a-9986-e5c565124beb') expect(subject.email).to eq('luiz.buiatte+pw.api.test@nexaas.com') end @@ -21,7 +21,7 @@ it 'returns the professional info for the user' do VCR.use_cassette('identity/profile/professional_info/success') do - expect(subject).to be_a(PassaporteWeb::Entities::Profile::ProfessionalInfo) + expect(subject).to be_a(NexaasID::Entities::Profile::ProfessionalInfo) expect(subject.id).to eq('57bb5938-d0c5-439a-9986-e5c565124beb') expect(subject.company).to eq('Nexaas') end @@ -33,7 +33,7 @@ it 'returns the contacts for the user' do VCR.use_cassette('identity/profile/contacts/success') do - expect(subject).to be_a(PassaporteWeb::Entities::Profile::Contacts) + expect(subject).to be_a(NexaasID::Entities::Profile::Contacts) expect(subject.id).to eq('57bb5938-d0c5-439a-9986-e5c565124beb') expect(subject.phone_numbers).not_to be_empty end @@ -45,7 +45,7 @@ it 'returns the contacts for the user' do VCR.use_cassette('identity/profile/emails/success') do - expect(subject).to be_a(PassaporteWeb::Entities::Profile::Emails) + expect(subject).to be_a(NexaasID::Entities::Profile::Emails) expect(subject.id).to eq('57bb5938-d0c5-439a-9986-e5c565124beb') expect(subject.emails).not_to be_empty end diff --git a/spec/passaporte_web/resources/sign_up_spec.rb b/spec/nexaas_id/resources/sign_up_spec.rb similarity index 82% rename from spec/passaporte_web/resources/sign_up_spec.rb rename to spec/nexaas_id/resources/sign_up_spec.rb index ac4da88..aaa8c5c 100644 --- a/spec/passaporte_web/resources/sign_up_spec.rb +++ b/spec/nexaas_id/resources/sign_up_spec.rb @@ -1,11 +1,11 @@ require 'spec_helper' -describe PassaporteWeb::Resources::SignUp do +describe NexaasID::Resources::SignUp do let(:resource) { client.sign_up } describe "#create" do describe 'with application client' do - let(:client) { PassaporteWeb::Client::Application.new } + let(:client) { NexaasID::Client::Application.new } subject { resource.create('demurtas@mailinator.com') } it 'invites an user' do @@ -18,7 +18,7 @@ end describe 'with identity client' do - let(:client) { PassaporteWeb::Client::Identity.new(user_credentials) } + let(:client) { NexaasID::Client::Identity.new(user_credentials) } subject { resource.create('demurtas@mailinator.com') } it 'invites an user' do diff --git a/spec/passaporte_web/resources/widget_spec.rb b/spec/nexaas_id/resources/widget_spec.rb similarity index 60% rename from spec/passaporte_web/resources/widget_spec.rb rename to spec/nexaas_id/resources/widget_spec.rb index 2002aa7..d58414d 100644 --- a/spec/passaporte_web/resources/widget_spec.rb +++ b/spec/nexaas_id/resources/widget_spec.rb @@ -1,12 +1,12 @@ require 'spec_helper' -describe PassaporteWeb::Resources::Widget do - let(:client) { PassaporteWeb::Client::Identity.new(user_credentials) } +describe NexaasID::Resources::Widget do + let(:client) { NexaasID::Client::Identity.new(user_credentials) } let(:resource) { client.widget } describe "#navbar_url" do subject { resource.navbar_url } - let(:regexp) { %r(#{Regexp.quote(PassaporteWeb.configuration.url)}/api/v1/widgets/navbar\?access_token=(.+?)$) } + let(:regexp) { %r(#{Regexp.quote(NexaasID.configuration.url)}/api/v1/widgets/navbar\?access_token=(.+?)$) } it 'returns the navbar url for this user' do VCR.use_cassette('identity/widget/navbar_url/success') do diff --git a/spec/nexaas_id_spec.rb b/spec/nexaas_id_spec.rb new file mode 100644 index 0000000..869b3fa --- /dev/null +++ b/spec/nexaas_id_spec.rb @@ -0,0 +1,30 @@ +# encoding: utf-8 +require 'spec_helper' + +describe NexaasID do + + it 'should have a version number' do + expect(NexaasID::VERSION).not_to be_nil + end + + describe 'configuration' do + it 'should be done via block initialization' do + NexaasID.configure do |c| + c.url = 'http://some/where' + c.user_agent = 'My App v1.0' + c.application_token = 'some-app-token' + c.application_secret = 'some-app-secret' + end + expect(NexaasID.configuration.url).to eq('http://some/where') + expect(NexaasID.configuration.user_agent).to eq('My App v1.0') + expect(NexaasID.configuration.application_token).to eq('some-app-token') + expect(NexaasID.configuration.application_secret).to eq('some-app-secret') + end + it 'should use a singleton object for the configuration values' do + config1 = NexaasID.configuration + config2 = NexaasID.configuration + expect(config1).to be === config2 + end + end + +end diff --git a/spec/passaporte_web_spec.rb b/spec/passaporte_web_spec.rb deleted file mode 100644 index 7f93277..0000000 --- a/spec/passaporte_web_spec.rb +++ /dev/null @@ -1,30 +0,0 @@ -# encoding: utf-8 -require 'spec_helper' - -describe PassaporteWeb do - - it 'should have a version number' do - expect(PassaporteWeb::VERSION).not_to be_nil - end - - describe 'configuration' do - it 'should be done via block initialization' do - PassaporteWeb.configure do |c| - c.url = 'http://some/where' - c.user_agent = 'My App v1.0' - c.application_token = 'some-app-token' - c.application_secret = 'some-app-secret' - end - expect(PassaporteWeb.configuration.url).to eq('http://some/where') - expect(PassaporteWeb.configuration.user_agent).to eq('My App v1.0') - expect(PassaporteWeb.configuration.application_token).to eq('some-app-token') - expect(PassaporteWeb.configuration.application_secret).to eq('some-app-secret') - end - it 'should use a singleton object for the configuration values' do - config1 = PassaporteWeb.configuration - config2 = PassaporteWeb.configuration - expect(config1).to be === config2 - end - end - -end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index f4d4b6a..d56bf72 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -11,7 +11,7 @@ SimpleCov.start $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) -require 'passaporte_web' +require 'nexaas_id' require 'vcr' require 'pry' @@ -22,7 +22,7 @@ c.cassette_library_dir = 'spec/fixtures/vcr_cassettes' c.hook_into :webmock c.ignore_localhost = true - c.default_cassette_options = { record: :new_episodes, re_record_interval: 2 * 3600 } + c.default_cassette_options = { record: :new_episodes } c.configure_rspec_metadata! end @@ -32,10 +32,10 @@ c.include Authorization c.before do - PassaporteWeb.configure do |config| - # https://sandbox.v2.passaporteweb.com.br/applications/89e9d504-e2a8-476e-ac94-c33e68399c7e + NexaasID.configure do |config| + # https://sandbox.id.nexaas.com/applications/89e9d504-e2a8-476e-ac94-c33e68399c7e # Test application - luiz.buiatte+pw.api.test@nexaas.com - config.url = ENV['PASSAPORTE_WEB_URL'] + config.url = ENV['NEXAAS_ID_URL'] config.application_token = ENV['APPLICATION_TOKEN'] config.application_secret = ENV['APPLICATION_SECRET'] end diff --git a/spec/support/authorization.rb b/spec/support/authorization.rb index eba183d..33235e5 100644 --- a/spec/support/authorization.rb +++ b/spec/support/authorization.rb @@ -3,7 +3,7 @@ module Authorization def authorization_code - connection = Faraday.new(url: PassaporteWeb.configuration.url) do |builder| + connection = Faraday.new(url: NexaasID.configuration.url) do |builder| builder.use :cookie_jar builder.adapter Faraday.default_adapter end @@ -18,14 +18,14 @@ def authorization_code connection.post('/sign_in', URI.encode_www_form(data)) response = connection.get('oauth/authorize', - client_id: PassaporteWeb.configuration.application_token, + client_id: NexaasID.configuration.application_token, redirect_uri: 'urn:ietf:wg:oauth:2.0:oob', response_type: 'code', scope: 'profile invite') if(response.headers['location'].nil? || response.headers['location'] == '') data = { - client_id: PassaporteWeb.configuration.application_token, + client_id: NexaasID.configuration.application_token, commit: 'Authorize', redirect_uri: 'urn:ietf:wg:oauth:2.0:oob', response_type: 'code', @@ -45,7 +45,7 @@ def authenticity_token(response) def access_token VCR.use_cassette('access_token') do - client = PassaporteWeb::Client::OAuth.build + client = NexaasID::Client::OAuth.build client.auth_code.get_token(authorization_code, redirect_uri: 'urn:ietf:wg:oauth:2.0:oob') end end