bb_oauth 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: fa5ea64a3df6396d2d374e5fff681853b9b73daa0bde345e3dd042c913390c52
4
+ data.tar.gz: 5fbe500346f036209908fa4a99444eeaf0498439f91ae7933c0117d1ca92641c
5
+ SHA512:
6
+ metadata.gz: 9d187df2297d901c5f6ac70efdd466564e2683bdc412349cfff6157616f83ebedc7b29306c01694eecc8fdb3c7655b88bb35c7795da58a334b91fefd19a615ef
7
+ data.tar.gz: 47057b7ce7b7ea847a76edf914bfadf38e82f607e6e4c31dda16f6a74829bba2ca334c0e11f9a9b23ebf6f62363c0ba041f12fab70c2ff1dcd01c95122031e18
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :development, :test do
6
+ gem 'rake', '~> 13.0.1'
7
+ gem 'pry-byebug'
8
+ gem 'rubocop', '~> 0.66.0'
9
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,71 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ bb_oauth (1.0.1)
5
+ json (~> 2.1, >= 2.1.0)
6
+ typhoeus (~> 1.0, >= 1.0.1)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ ast (2.4.2)
12
+ byebug (11.1.3)
13
+ coderay (1.1.3)
14
+ diff-lcs (1.4.4)
15
+ ethon (0.16.0)
16
+ ffi (>= 1.15.0)
17
+ ffi (1.15.5)
18
+ jaro_winkler (1.5.4)
19
+ json (2.6.3)
20
+ method_source (1.0.0)
21
+ parallel (1.20.1)
22
+ parser (3.0.0.0)
23
+ ast (~> 2.4.1)
24
+ pry (0.13.1)
25
+ coderay (~> 1.1)
26
+ method_source (~> 1.0)
27
+ pry-byebug (3.9.0)
28
+ byebug (~> 11.0)
29
+ pry (~> 0.13.0)
30
+ psych (3.3.0)
31
+ rainbow (3.0.0)
32
+ rake (13.0.3)
33
+ rspec (3.10.0)
34
+ rspec-core (~> 3.10.0)
35
+ rspec-expectations (~> 3.10.0)
36
+ rspec-mocks (~> 3.10.0)
37
+ rspec-core (3.10.1)
38
+ rspec-support (~> 3.10.0)
39
+ rspec-expectations (3.10.1)
40
+ diff-lcs (>= 1.2.0, < 2.0)
41
+ rspec-support (~> 3.10.0)
42
+ rspec-mocks (3.10.2)
43
+ diff-lcs (>= 1.2.0, < 2.0)
44
+ rspec-support (~> 3.10.0)
45
+ rspec-support (3.10.2)
46
+ rubocop (0.66.0)
47
+ jaro_winkler (~> 1.5.1)
48
+ parallel (~> 1.10)
49
+ parser (>= 2.5, != 2.5.1.1)
50
+ psych (>= 3.1.0)
51
+ rainbow (>= 2.2.2, < 4.0)
52
+ ruby-progressbar (~> 1.7)
53
+ unicode-display_width (>= 1.4.0, < 1.6)
54
+ ruby-progressbar (1.11.0)
55
+ typhoeus (1.4.0)
56
+ ethon (>= 0.9.0)
57
+ unicode-display_width (1.5.0)
58
+
59
+ PLATFORMS
60
+ ruby
61
+ x86_64-linux
62
+
63
+ DEPENDENCIES
64
+ bb_oauth!
65
+ pry-byebug
66
+ rake (~> 13.0.1)
67
+ rspec (~> 3.6, >= 3.6.0)
68
+ rubocop (~> 0.66.0)
69
+
70
+ BUNDLED WITH
71
+ 2.2.0
data/README.md ADDED
@@ -0,0 +1,85 @@
1
+ # bb_oauth
2
+
3
+ Unofficial Banco do Brasil OAuth Gem
4
+
5
+ BancoBrasilClientCredentials - the Ruby gem for the Fluxo Client Credentials
6
+
7
+ - API version: 1.0.0
8
+ - Package version: 1.0.0
9
+
10
+ ## Installation
11
+
12
+ ### Build a gem
13
+
14
+ To build the Ruby code into a gem:
15
+
16
+ ```shell
17
+ gem build bb_oauth.gemspec
18
+ ```
19
+
20
+ Then either install the gem locally:
21
+
22
+ ```shell
23
+ gem install ./bb_oauth-1.0.0.gem
24
+ ```
25
+ (for development, run `gem install --dev ./bb_oauth-1.0.0.gem` to install the development dependencies)
26
+
27
+ or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
28
+
29
+ Finally add this to the Gemfile:
30
+
31
+ gem 'bb_oauth', '~> 1.0.0'
32
+
33
+ ### Install from Git
34
+
35
+ If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile:
36
+
37
+ gem 'bb_oauth', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git'
38
+
39
+ ### Include the Ruby code directly
40
+
41
+ Include the Ruby code directly using `-I` as follows:
42
+
43
+ ```shell
44
+ ruby -Ilib script.rb
45
+ ```
46
+
47
+ ## Getting Started
48
+
49
+ Please follow the [installation](#installation) procedure and then run the following code:
50
+ ```ruby
51
+ # Load the gem
52
+ require 'bb_oauth'
53
+
54
+ api_instance = BancoBrasilClientCredentials::DefaultApi.new
55
+ grant_type = 'grant_type_example' # String |
56
+ scope = 'scope_example' # String |
57
+ authorization = 'authorization_example' # String | Deverá ser informado no padrão: Basic {Base64(client_id:client_secret)}
58
+ content_type = 'content_type_example' # String | Deverá ser informado: application/x-www-form-urlencoded
59
+
60
+
61
+ begin
62
+ result = api_instance.oauth_token_post(grant_type, scope, authorization, content_type)
63
+ p result
64
+ rescue BancoBrasilClientCredentials::ApiError => e
65
+ puts "Exception when calling DefaultApi->oauth_token_post: #{e}"
66
+ end
67
+ ```
68
+
69
+ ## Documentation for API Endpoints
70
+
71
+ All URIs are relative to *https://oauth.bb.com.br/*
72
+
73
+ Class | Method | HTTP request | Description
74
+ ------------ | ------------- | ------------- | -------------
75
+ *BancoBrasilClientCredentials::DefaultApi* | [**oauth_token_post**](docs/DefaultApi.md#oauth_token_post) | **POST** /oauth/token |
76
+
77
+ ## Documentation for Models
78
+
79
+ - [BancoBrasilClientCredentials::Body](docs/Body.md)
80
+ - [BancoBrasilClientCredentials::ResponseToken](docs/ResponseToken.md)
81
+
82
+ ## Documentation for Authorization
83
+
84
+ All endpoints do not require authorization.
85
+
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ begin
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+ task default: :spec
6
+ rescue LoadError
7
+ # no rspec available
8
+ end
data/bb_oauth.gemspec ADDED
@@ -0,0 +1,26 @@
1
+ $:.push File.expand_path("../lib", __FILE__)
2
+ require "bb_oauth/version"
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "bb_oauth"
6
+ s.version = BancoBrasilClientCredentials::VERSION
7
+ s.platform = Gem::Platform::RUBY
8
+ s.homepage = "https://github.com/ruby-banco-brasil/bb-oauth"
9
+ s.metadata = { "source_code_uri" => "https://github.com/ruby-banco-brasil/bb-oauth" }
10
+ s.authors = ["Rafael R. Aschoff"]
11
+ s.email = ["roque.rafael@gmail.com"]
12
+ s.summary = "A ruby wrapper for Banco do Brasil OAuth Client Credentials"
13
+ s.description = "This gem maps to the BB Client Credentials"
14
+ s.license = "Unlicense"
15
+ s.required_ruby_version = ">= 1.9"
16
+
17
+ s.add_runtime_dependency 'typhoeus', '~> 1.0', '>= 1.0.1'
18
+ s.add_runtime_dependency 'json', '~> 2.1', '>= 2.1.0'
19
+
20
+ s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0'
21
+
22
+ s.files = `find *`.split("\n").uniq.sort.select { |f| !f.empty? }
23
+ s.test_files = `find spec/*`.split("\n")
24
+ s.executables = []
25
+ s.require_paths = ["lib"]
26
+ end
data/config.json ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ "gemName" : "bb_oauth",
3
+ "moduleName" : "BancoBrasilClientCredentials",
4
+ "gemHomepage" : "https://github.com/ruby-banco-brasil/bb-oauth",
5
+ "gemSummary" : "A ruby wrapper for Banco do Brasil OAuth Client Credentials",
6
+ "gemDescription": "This gem maps to the BB Client Credentials",
7
+ "gemAuthor" : "Rafael R. Aschoff",
8
+ "gemAuthorEmail" : "roque.rafael@gmail.com"
9
+ }
data/docs/Body.md ADDED
@@ -0,0 +1,8 @@
1
+ # BancoBrasilClientCredentials::Body
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **grant_type** | **String** | Deverá ser informado: client_credentials |
7
+ **scope** | **String** | Os escopos deverão ser informados separados por espaço. |
8
+
@@ -0,0 +1,57 @@
1
+ # BancoBrasilClientCredentials::DefaultApi
2
+
3
+ All URIs are relative to *https://oauth.bb.com.br/*
4
+
5
+ Method | HTTP request | Description
6
+ ------------- | ------------- | -------------
7
+ [**oauth_token_post**](DefaultApi.md#oauth_token_post) | **POST** /oauth/token |
8
+
9
+ # **oauth_token_post**
10
+ > ResponseToken oauth_token_post(grant_typescopeauthorizationcontent_type)
11
+
12
+
13
+
14
+ ### Example
15
+ ```ruby
16
+ # load the gem
17
+ require 'bb_oauth'
18
+
19
+ api_instance = BancoBrasilClientCredentials::DefaultApi.new
20
+ grant_type = 'grant_type_example' # String |
21
+ scope = 'scope_example' # String |
22
+ authorization = 'authorization_example' # String | Deverá ser informado no padrão: Basic {Base64(client_id:client_secret)}
23
+ content_type = 'content_type_example' # String | Deverá ser informado: application/x-www-form-urlencoded
24
+
25
+
26
+ begin
27
+ result = api_instance.oauth_token_post(grant_typescopeauthorizationcontent_type)
28
+ p result
29
+ rescue BancoBrasilClientCredentials::ApiError => e
30
+ puts "Exception when calling DefaultApi->oauth_token_post: #{e}"
31
+ end
32
+ ```
33
+
34
+ ### Parameters
35
+
36
+ Name | Type | Description | Notes
37
+ ------------- | ------------- | ------------- | -------------
38
+ **grant_type** | **String**| |
39
+ **scope** | **String**| |
40
+ **authorization** | **String**| Deverá ser informado no padrão: Basic {Base64(client_id:client_secret)} |
41
+ **content_type** | **String**| Deverá ser informado: application/x-www-form-urlencoded |
42
+
43
+ ### Return type
44
+
45
+ [**ResponseToken**](ResponseToken.md)
46
+
47
+ ### Authorization
48
+
49
+ No authorization required
50
+
51
+ ### HTTP request headers
52
+
53
+ - **Content-Type**: application/x-www-form-urlencoded
54
+ - **Accept**: application/x-www-form-urlencoded
55
+
56
+
57
+
@@ -0,0 +1,9 @@
1
+ # BancoBrasilClientCredentials::ResponseToken
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **access_token** | **Object** | Token de Acesso |
7
+ **token_type** | **Object** | Tipo de token |
8
+ **expires_in** | **Object** | Tempo de Expiração do token |
9
+
@@ -0,0 +1,85 @@
1
+ module BancoBrasilClientCredentials
2
+ class DefaultApi
3
+ attr_accessor :api_client
4
+
5
+ def initialize(api_client = ApiClient.default)
6
+ @api_client = api_client
7
+ end
8
+ # @param grant_type
9
+ # @param scope
10
+ # @param authorization Deverá ser informado no padrão: Basic {Base64(client_id:client_secret)}
11
+ # @param content_type Deverá ser informado: application/x-www-form-urlencoded
12
+ # @param [Hash] opts the optional parameters
13
+ # @return [ResponseToken]
14
+ def oauth_token_post(grant_type, scope, authorization, content_type, opts = {})
15
+ data, _status_code, _headers = oauth_token_post_with_http_info(grant_type, scope, authorization, content_type, opts)
16
+ data
17
+ end
18
+
19
+ # @param grant_type
20
+ # @param scope
21
+ # @param authorization Deverá ser informado no padrão: Basic {Base64(client_id:client_secret)}
22
+ # @param content_type Deverá ser informado: application/x-www-form-urlencoded
23
+ # @param [Hash] opts the optional parameters
24
+ # @return [Array<(ResponseToken, Integer, Hash)>] ResponseToken data, response status code and response headers
25
+ def oauth_token_post_with_http_info(grant_type, scope, authorization, content_type, opts = {})
26
+ if @api_client.config.debugging
27
+ @api_client.config.logger.debug 'Calling API: DefaultApi.oauth_token_post ...'
28
+ end
29
+ # verify the required parameter 'grant_type' is set
30
+ if @api_client.config.client_side_validation && grant_type.nil?
31
+ fail ArgumentError, "Missing the required parameter 'grant_type' when calling DefaultApi.oauth_token_post"
32
+ end
33
+ # verify the required parameter 'scope' is set
34
+ if @api_client.config.client_side_validation && scope.nil?
35
+ fail ArgumentError, "Missing the required parameter 'scope' when calling DefaultApi.oauth_token_post"
36
+ end
37
+ # verify the required parameter 'authorization' is set
38
+ if @api_client.config.client_side_validation && authorization.nil?
39
+ fail ArgumentError, "Missing the required parameter 'authorization' when calling DefaultApi.oauth_token_post"
40
+ end
41
+ # verify the required parameter 'content_type' is set
42
+ if @api_client.config.client_side_validation && content_type.nil?
43
+ fail ArgumentError, "Missing the required parameter 'content_type' when calling DefaultApi.oauth_token_post"
44
+ end
45
+ # resource path
46
+ local_var_path = '/oauth/token'
47
+
48
+ # query parameters
49
+ query_params = opts[:query_params] || {}
50
+
51
+ # header parameters
52
+ header_params = opts[:header_params] || {}
53
+ # HTTP header 'Accept' (if needed)
54
+ # header_params['Accept'] = @api_client.select_header_accept(['application/x-www-form-urlencoded'])
55
+ # HTTP header 'Content-Type'
56
+ # header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])
57
+ header_params['Authorization'] = authorization
58
+ header_params['Content-Type'] = content_type
59
+
60
+ # form parameters
61
+ form_params = opts[:form_params] || {}
62
+ form_params['grant_type'] = grant_type
63
+ form_params['scope'] = scope
64
+
65
+ # http body (model)
66
+ post_body = opts[:body]
67
+
68
+ return_type = opts[:return_type] || 'ResponseToken'
69
+
70
+ auth_names = opts[:auth_names] || []
71
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
72
+ :header_params => header_params,
73
+ :query_params => query_params,
74
+ :form_params => form_params,
75
+ :body => post_body,
76
+ :auth_names => auth_names,
77
+ :return_type => return_type)
78
+
79
+ if @api_client.config.debugging
80
+ @api_client.config.logger.debug "API called: DefaultApi#oauth_token_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
81
+ end
82
+ return data, status_code, headers
83
+ end
84
+ end
85
+ end