omniauth-figma 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 2b6d30e44d219cfd458ad70be16eb3973da5e79d5ef6e79d6ee6ca1a36a4d725
4
+ data.tar.gz: e4b5064cdb93f6f24259c196567f723c93c2a0285068cc962c6dbb1db914e933
5
+ SHA512:
6
+ metadata.gz: cd05172745a87ef9a71f4c38cbc91815d70301d82aba6867997bae49b2dcb50c94d3cf5998fb7fb1eeb40a9eb940ba656182b6c3300fafa646de2ce79ae7ef3d
7
+ data.tar.gz: 5e7ce5b8840656f420cf3df04a67346248f7d1338e4c6de4171db29a855a800038ff6387350b1520c3467bdf4264082a92f4d48fd6b3d36fb6524a09c9747d58
@@ -0,0 +1,8 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
data/Gemfile ADDED
@@ -0,0 +1,15 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ group :test do
6
+ gem "json", :platforms => %i[jruby ruby_18 ruby_19]
7
+ gem "mime-types", "~> 1.25", :platforms => %i[jruby ruby_18]
8
+ gem "rack-test"
9
+ gem "rest-client", "~> 1.8.0", :platforms => %i[jruby ruby_18]
10
+ gem "rspec", "~> 3.2"
11
+ gem "rubocop", ">= 0.51", :platforms => %i[ruby_19 ruby_20 ruby_21 ruby_22 ruby_23 ruby_24]
12
+ end
13
+
14
+ # Specify your gem's dependencies in omniauth-figma.gemspec
15
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 Jamie Carr
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,42 @@
1
+ # OmniAuth Figma OAuth2 Strategy
2
+
3
+ A Figma OAuth2 strategy for OmniAuth.
4
+
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ gem 'omniauth-figma'
11
+
12
+ And then execute:
13
+
14
+ $ bundle
15
+
16
+ Or install it yourself as:
17
+
18
+ $ gem install omniauth-figma
19
+
20
+
21
+ ## Usage
22
+
23
+ Register your application with Figma to receive your Client ID and Secret key: https://www.figma.com/developers/apps
24
+
25
+ This is an example that you might put into a Rails initializer at `config/initializers/omniauth.rb`:
26
+
27
+ ```ruby
28
+ Rails.application.config.middleware.use OmniAuth::Builder do
29
+ provider :figma, ENV['CLIENT_ID'], ENV['CLIENT_SECRET']
30
+ end
31
+ ```
32
+
33
+ You can now access the OmniAuth Figma OAuth2 URL: `/auth/figma`.
34
+
35
+
36
+ ## Contributing
37
+
38
+ 1. Fork it
39
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
40
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
41
+ 4. Push to the branch (`git push origin my-new-feature`)
42
+ 5. Create new Pull Request
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "omniauth/figma"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,2 @@
1
+ require "omniauth-figma/version"
2
+ require "omniauth/strategies/figma"
@@ -0,0 +1,3 @@
1
+ module OmniAuthFigma
2
+ VERSION = '0.0.1'
3
+ end
@@ -0,0 +1,49 @@
1
+ require "oauth2"
2
+ require "omniauth"
3
+
4
+ module OmniAuth
5
+ module Strategies
6
+ class Figma < OmniAuth::Strategies::OAuth2
7
+
8
+ option :name, "figma"
9
+ option :scope, 'file_read'
10
+
11
+ option :client_options, {
12
+ site: 'https://www.figma.com',
13
+ authorize_url: '/oauth',
14
+ token_url: '/api/oauth/token'
15
+ }
16
+
17
+ option :token_options, [:client_id, :client_secret]
18
+ option :token_params, { parse: :json }
19
+
20
+ uid { raw_info['id'].to_s }
21
+
22
+ info do
23
+ {
24
+ :name => raw_info['handle'],
25
+ :email => raw_info['email'],
26
+ :image => raw_info['img_url']
27
+ }
28
+ end
29
+
30
+ credentials do
31
+ {
32
+ :access_token => access_token.token,
33
+ :expires_at => access_token.expires_at,
34
+ :expires => access_token.expires?,
35
+ :refresh_token => access_token.refresh_token
36
+ }
37
+ end
38
+
39
+ def raw_info
40
+ @raw_info = access_token.get('https://api.figma.com/v1/me').parsed
41
+ end
42
+
43
+ def callback_url
44
+ full_host + script_name + callback_path
45
+ end
46
+
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,48 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "omniauth-figma/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "omniauth-figma"
8
+ spec.version = OmniAuthFigma::VERSION
9
+ spec.authors = ["Jamie Carr"]
10
+ spec.email = ["jamie.carr.07@gmail.com"]
11
+
12
+ spec.summary = 'Figma OAuth strategy for OmniAuth'
13
+ spec.description = 'Figma OAuth strategy for OmniAuth'
14
+ spec.homepage = "https://github.com/jamieecarr/omniauth-figma"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+ if spec.respond_to?(:metadata)
20
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
21
+
22
+ spec.metadata["homepage_uri"] = spec.homepage
23
+ spec.metadata["source_code_uri"] = "https://github.com/jamieecarr/omniauth-figma"
24
+ spec.metadata["changelog_uri"] = "https://github.com/jamieecarr/omniauth-figma"
25
+ else
26
+ raise "RubyGems 2.0 or newer is required to protect against " \
27
+ "public gem pushes."
28
+ end
29
+
30
+ # Specify which files should be added to the gem when it is released.
31
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
32
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
33
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
34
+ end
35
+ spec.bindir = "exe"
36
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
37
+ spec.require_paths = ["lib"]
38
+
39
+ spec.add_dependency "oauth2", "~> 1.4"
40
+ spec.add_dependency "omniauth", "~> 1.9"
41
+
42
+ spec.add_development_dependency "bundler", "~> 1.17"
43
+ spec.add_development_dependency "rake", "~> 10.0"
44
+
45
+ spec.add_development_dependency 'simplecov'
46
+ spec.add_development_dependency "rspec", "~> 3.0"
47
+
48
+ end
metadata ADDED
@@ -0,0 +1,142 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-figma
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Jamie Carr
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-07-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: oauth2
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.4'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.4'
27
+ - !ruby/object:Gem::Dependency
28
+ name: omniauth
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.9'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.9'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.17'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.17'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: simplecov
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '3.0'
97
+ description: Figma OAuth strategy for OmniAuth
98
+ email:
99
+ - jamie.carr.07@gmail.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".gitignore"
105
+ - Gemfile
106
+ - LICENSE.txt
107
+ - README.md
108
+ - Rakefile
109
+ - bin/console
110
+ - bin/setup
111
+ - lib/omniauth-figma.rb
112
+ - lib/omniauth-figma/version.rb
113
+ - lib/omniauth/strategies/figma.rb
114
+ - omniauth-figma.gemspec
115
+ homepage: https://github.com/jamieecarr/omniauth-figma
116
+ licenses:
117
+ - MIT
118
+ metadata:
119
+ allowed_push_host: https://rubygems.org
120
+ homepage_uri: https://github.com/jamieecarr/omniauth-figma
121
+ source_code_uri: https://github.com/jamieecarr/omniauth-figma
122
+ changelog_uri: https://github.com/jamieecarr/omniauth-figma
123
+ post_install_message:
124
+ rdoc_options: []
125
+ require_paths:
126
+ - lib
127
+ required_ruby_version: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ required_rubygems_version: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ requirements: []
138
+ rubygems_version: 3.0.3
139
+ signing_key:
140
+ specification_version: 4
141
+ summary: Figma OAuth strategy for OmniAuth
142
+ test_files: []