omniauth-shipbob 0.0.2

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: c6c4df1a2ed0e54d50053ec4c16044628289af2485eae44b10f95b3a7538f271
4
+ data.tar.gz: 3b60031b3d80f56a4101f783db6c69fa7229dd58f50934931f686520d54998c4
5
+ SHA512:
6
+ metadata.gz: d37936c44401fcd7c769a8364464fbca3e1c3148c79853afec1a9e97328940e0507cb4b55dd205fa2d57f0acb8c28c11c7659b68d9c49b232a25b59b6add98dc
7
+ data.tar.gz: 47072c6175ac5c3d7d11f29fa7262ed29fd28380794d309878e5ada2fdecf180dede98ee13d899b4d6bc620559d330d352ebc5f58857c7123473953fd4a1757d
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ omniauth-shipbob
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.4.4
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.4.4
7
+ before_install: gem install bundler -v 1.16.6
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in omniauth-fdc.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,56 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ omniauth-shipbob (0.0.1)
5
+ omniauth-oauth2
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ diff-lcs (1.3)
11
+ faraday (1.0.1)
12
+ multipart-post (>= 1.2, < 3)
13
+ hashie (4.1.0)
14
+ jwt (2.2.1)
15
+ multi_json (1.14.1)
16
+ multi_xml (0.6.0)
17
+ multipart-post (2.1.1)
18
+ oauth2 (1.4.4)
19
+ faraday (>= 0.8, < 2.0)
20
+ jwt (>= 1.0, < 3.0)
21
+ multi_json (~> 1.3)
22
+ multi_xml (~> 0.5)
23
+ rack (>= 1.2, < 3)
24
+ omniauth (1.9.1)
25
+ hashie (>= 3.4.6)
26
+ rack (>= 1.6.2, < 3)
27
+ omniauth-oauth2 (1.6.0)
28
+ oauth2 (~> 1.1)
29
+ omniauth (~> 1.9)
30
+ rack (2.2.2)
31
+ rake (10.5.0)
32
+ rspec (3.9.0)
33
+ rspec-core (~> 3.9.0)
34
+ rspec-expectations (~> 3.9.0)
35
+ rspec-mocks (~> 3.9.0)
36
+ rspec-core (3.9.0)
37
+ rspec-support (~> 3.9.0)
38
+ rspec-expectations (3.9.0)
39
+ diff-lcs (>= 1.2.0, < 2.0)
40
+ rspec-support (~> 3.9.0)
41
+ rspec-mocks (3.9.0)
42
+ diff-lcs (>= 1.2.0, < 2.0)
43
+ rspec-support (~> 3.9.0)
44
+ rspec-support (3.9.0)
45
+
46
+ PLATFORMS
47
+ ruby
48
+
49
+ DEPENDENCIES
50
+ bundler (~> 1.16)
51
+ omniauth-shipbob!
52
+ rake (~> 10.0)
53
+ rspec (~> 3.0)
54
+
55
+ BUNDLED WITH
56
+ 1.17.3
data/README.md ADDED
@@ -0,0 +1,55 @@
1
+ # Omniauth::Shipbob
2
+
3
+ This is an OmniAuth strategy for authenticating to ShipBob.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'omniauth-shipbob'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install omniauth-shipbob
20
+
21
+ ## Usage
22
+
23
+ ```ruby
24
+ Rails.application.config.middleware.use OmniAuth::Builder do
25
+ provider :shipbob,
26
+ 'client_id', 'client_secret',
27
+ :callback_url => 'http://example.test/auth/shipbob/callback',
28
+ :scope => 'scopes-list'
29
+ end
30
+ ```
31
+
32
+ ## Configuring
33
+
34
+ You can configure integration_name through the authorize_params hash:
35
+
36
+ ```ruby
37
+ Rails.application.config.middleware.use OmniAuth::Builder do
38
+ provider :shipbob,
39
+ 'client_id', 'client_secret',
40
+ :callback_url => 'http://example.test/auth/shipbob/callback',
41
+ :scope => 'scopes-list',
42
+ :authorize_params => {:integration_name => 'my-application-name' }
43
+ end
44
+ ```
45
+
46
+
47
+ ## Development
48
+
49
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
50
+
51
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
52
+
53
+ ## Contributing
54
+
55
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/omniauth-fdc.
data/Rakefile ADDED
@@ -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
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "omniauth/fdc"
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__)
data/bin/setup ADDED
@@ -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-shipbob/version"
2
+ require 'omniauth/strategies/shipbob'
@@ -0,0 +1,5 @@
1
+ module Omniauth
2
+ module Shipbob
3
+ VERSION = "0.0.2"
4
+ end
5
+ end
@@ -0,0 +1,36 @@
1
+
2
+ require 'omniauth-oauth2'
3
+ require 'json'
4
+
5
+ module OmniAuth
6
+ module Strategies
7
+ class Shipbob < OmniAuth::Strategies::OAuth2
8
+
9
+ option :client_options, {
10
+ :authorize_url => '/connect/integrate',
11
+ :token_url => '/connect/token',
12
+ :site => 'https://auth.shipbob.com'
13
+ }
14
+
15
+ option :authorize_params, { :response_mode => 'form_post' }
16
+
17
+ credentials do
18
+ hash = {"token" => access_token.token}
19
+ hash["refresh_token"] = access_token.refresh_token if access_token.expires? && access_token.refresh_token
20
+ hash["expires_at"] = access_token.expires_at if access_token.expires?
21
+ hash["expires"] = access_token.expires?
22
+ hash['channel_id'] = get_channel_id(access_token)
23
+ hash
24
+ end
25
+
26
+ def get_channel_id(token)
27
+ log :info, 'Calling API to get Channel Id.'
28
+ response = token.get('https://api.shipbob.com/1.0/channel', :headers => { 'Content-Type' => 'application/json' })
29
+ JSON.parse(response.body).dig(0, "id")
30
+ rescue => e
31
+ nil
32
+ end
33
+
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,39 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "omniauth-shipbob/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "omniauth-shipbob"
8
+ spec.version = Omniauth::Shipbob::VERSION
9
+ spec.authors = ["Venkata Kishor"]
10
+ spec.email = ["kishore.venkat@getdropstream.com"]
11
+
12
+ spec.summary = %q{OmniAuth strategy for ShipBob}
13
+ spec.description = %q{In this gem you will find an OmniAuth ShipBob strategy}
14
+ spec.homepage = "https://github.com/dropstream/omniauth-shipbob"
15
+
16
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
17
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
18
+ if spec.respond_to?(:metadata)
19
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
20
+ else
21
+ raise "RubyGems 2.0 or newer is required to protect against " \
22
+ "public gem pushes."
23
+ end
24
+
25
+ # Specify which files should be added to the gem when it is released.
26
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
27
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
28
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
29
+ end
30
+ spec.bindir = "exe"
31
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
32
+ spec.require_paths = ["lib"]
33
+
34
+ spec.add_runtime_dependency 'omniauth-oauth2'
35
+
36
+ spec.add_development_dependency "bundler", "~> 1.16"
37
+ spec.add_development_dependency "rake", "~> 10.0"
38
+ spec.add_development_dependency "rspec", "~> 3.0"
39
+ end
metadata ADDED
@@ -0,0 +1,114 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-shipbob
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Venkata Kishor
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-05-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: omniauth-oauth2
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.16'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.16'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ description: In this gem you will find an OmniAuth ShipBob strategy
70
+ email:
71
+ - kishore.venkat@getdropstream.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - ".rspec"
78
+ - ".ruby-gemset"
79
+ - ".ruby-version"
80
+ - ".travis.yml"
81
+ - Gemfile
82
+ - Gemfile.lock
83
+ - README.md
84
+ - Rakefile
85
+ - bin/console
86
+ - bin/setup
87
+ - lib/omniauth-shipbob.rb
88
+ - lib/omniauth-shipbob/version.rb
89
+ - lib/omniauth/strategies/shipbob.rb
90
+ - omniauth-shipbob.gemspec
91
+ homepage: https://github.com/dropstream/omniauth-shipbob
92
+ licenses: []
93
+ metadata:
94
+ allowed_push_host: https://rubygems.org
95
+ post_install_message:
96
+ rdoc_options: []
97
+ require_paths:
98
+ - lib
99
+ required_ruby_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ required_rubygems_version: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ requirements: []
110
+ rubygems_version: 3.0.6
111
+ signing_key:
112
+ specification_version: 4
113
+ summary: OmniAuth strategy for ShipBob
114
+ test_files: []