Browse Source

initial commit

master
Richard Cagle 1 year ago
commit
7361c59122
6 changed files with 65 additions and 0 deletions
  1. 1
    0
      .rbenv-gemset
  2. 1
    0
      .ruby-version
  3. 9
    0
      Gemfile
  4. 28
    0
      Gemfile.lock
  5. 13
    0
      generate.rb
  6. 13
    0
      server.rb

+ 1
- 0
.rbenv-gemset View File

@@ -0,0 +1 @@
b3-big-picture

+ 1
- 0
.ruby-version View File

@@ -0,0 +1 @@
2.7.0

+ 9
- 0
Gemfile View File

@@ -0,0 +1,9 @@
# frozen_string_literal: true

source "https://rubygems.org"

git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }

ruby "2.7.0"

gem "oauth2", "~> 1.4"

+ 28
- 0
Gemfile.lock View File

@@ -0,0 +1,28 @@
GEM
remote: https://rubygems.org/
specs:
faraday (1.0.0)
multipart-post (>= 1.2, < 3)
jwt (2.2.1)
multi_json (1.14.1)
multi_xml (0.6.0)
multipart-post (2.1.1)
oauth2 (1.4.4)
faraday (>= 0.8, < 2.0)
jwt (>= 1.0, < 3.0)
multi_json (~> 1.3)
multi_xml (~> 0.5)
rack (>= 1.2, < 3)
rack (2.2.2)

PLATFORMS
ruby

DEPENDENCIES
oauth2 (~> 1.4)

RUBY VERSION
ruby 2.7.0p0

BUNDLED WITH
2.1.4

+ 13
- 0
generate.rb View File

@@ -0,0 +1,13 @@
require 'oauth2'
require 'erb'

client = OAuth2::Client.new(
'eb34f9ce358bbf11a575455ba4c03ecfa2798392',
'7df1c034dc19ed8d92da1592d842257b1d178d0f',
site: 'https://launchpad.37signals.com',
authorize_url: '/authorization/new',
token_url: '/authorization/token'
)

client.auth_code.authorize_url(redirect_uri: 'http://localhost:5678', type: 'web_server')
client.auth_code.get_token('7fbaafc2', type: 'web_server', redirect_uri: 'http://localhost:5789')

+ 13
- 0
server.rb View File

@@ -0,0 +1,13 @@
require 'socket'
server = TCPServer.new 5678

while session = server.accept
request = session.gets

session.print "HTTP/1.1 200\r\n" # 1
session.print "Content-Type: text/html\r\n" # 2
session.print "\r\n" # 3
session.print request.inspect

session.close
end

Loading…
Cancel
Save