adsk_auth_service 1.0.5 → 1.0.6
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.
- checksums.yaml +4 -4
- data/Gemfile +1 -3
- data/adsk_auth_service.gemspec +3 -7
- data/lib/adsk_auth_service.rb +12 -8
- data/lib/utils/net_util.rb +0 -1
- metadata +3 -35
- data/lib/caches/mc_cache.rb +0 -36
- data/lib/services/cache_service.rb +0 -34
- data/lib/services/config_service.rb +0 -30
- data/lib/services/sdk_logger.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a0b1443ef86962b6f4c3aa002ca0e8ab35a104d
|
4
|
+
data.tar.gz: a839d68a677b9276ed0aff707ab94ea5b7c7172c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d728f3cbe5bae3506fc5c7f8f64da0080fb4740468004b757037865e89543f02a8e45e8fc46b44a4ced271a1c00b8556263b62be9f90b0561541865b23348289
|
7
|
+
data.tar.gz: 53b2aa27db058f53417c3d4cc37c3c56cd381d9f833b7b7ce3b561eebe3d5b486f074892e798ab827e9fd1e1502040e1398f8576802b9828e6db8dace3c22088
|
data/Gemfile
CHANGED
data/adsk_auth_service.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'adsk_auth_service'
|
3
|
-
s.version = '1.0.
|
3
|
+
s.version = '1.0.6'
|
4
4
|
s.summary = "Autodesk second phase token retrieval"
|
5
5
|
s.description = "A gem for Autodesk 2-phase authentication service."
|
6
6
|
s.authors = ['Linh Chau']
|
@@ -8,17 +8,13 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.files = [
|
9
9
|
'./Gemfile', './adsk_auth_service.gemspec',
|
10
10
|
'lib/adsk_auth_service.rb',
|
11
|
-
'lib/services/auth_service.rb', 'lib/services/
|
12
|
-
'lib/services/sdk_logger.rb', 'lib/services/token_cache_service.rb',
|
13
|
-
'lib/caches/mc_cache.rb',
|
11
|
+
'lib/services/auth_service.rb', 'lib/services/token_cache_service.rb',
|
14
12
|
'lib/utils/net_util.rb',
|
15
13
|
|
16
14
|
]
|
17
15
|
s.homepage = 'https://git.autodesk.com/t-chaul/adsk_auth_service.git'
|
18
16
|
s.license = 'MIT'
|
19
|
-
s.add_runtime_dependency '
|
20
|
-
s.add_runtime_dependency 'activesupport'
|
21
|
-
s.add_runtime_dependency 'dalli', '~> 0'
|
17
|
+
s.add_runtime_dependency 'cache_service', '~> 0'
|
22
18
|
|
23
19
|
s.add_development_dependency 'rspec', '~> 3.1'
|
24
20
|
end
|
data/lib/adsk_auth_service.rb
CHANGED
@@ -1,13 +1,17 @@
|
|
1
1
|
require 'yaml'
|
2
|
-
|
2
|
+
require 'cache_service'
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
def load_gem_lib(sub_path)
|
5
|
+
spec = Gem::Specification.find_by_name('adsk_auth_service')
|
6
|
+
rb_files = Dir.glob("#{spec.gem_dir}/lib/#{sub_path}/*.rb")
|
7
|
+
rb_files.each { |rb_file| require rb_file }
|
8
|
+
rescue Exception => error
|
9
|
+
# Who cares?
|
10
|
+
end
|
6
11
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
+
|
13
|
+
['services', 'utils'].each do |sub_path|
|
14
|
+
load_gem_lib(sub_path)
|
15
|
+
rb_files = Dir.glob("#{File.expand_path('.')}/lib/#{sub_path}/*.rb")
|
12
16
|
rb_files.each { |rb_file| require rb_file }
|
13
17
|
end
|
data/lib/utils/net_util.rb
CHANGED
metadata
CHANGED
@@ -1,45 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: adsk_auth_service
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Linh Chau
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
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: activesupport
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: dalli
|
14
|
+
name: cache_service
|
43
15
|
requirement: !ruby/object:Gem::Requirement
|
44
16
|
requirements:
|
45
17
|
- - "~>"
|
@@ -75,11 +47,7 @@ files:
|
|
75
47
|
- "./Gemfile"
|
76
48
|
- "./adsk_auth_service.gemspec"
|
77
49
|
- lib/adsk_auth_service.rb
|
78
|
-
- lib/caches/mc_cache.rb
|
79
50
|
- lib/services/auth_service.rb
|
80
|
-
- lib/services/cache_service.rb
|
81
|
-
- lib/services/config_service.rb
|
82
|
-
- lib/services/sdk_logger.rb
|
83
51
|
- lib/services/token_cache_service.rb
|
84
52
|
- lib/utils/net_util.rb
|
85
53
|
homepage: https://git.autodesk.com/t-chaul/adsk_auth_service.git
|
data/lib/caches/mc_cache.rb
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
require 'dalli'
|
2
|
-
|
3
|
-
class McCache
|
4
|
-
class << self
|
5
|
-
def client
|
6
|
-
@@client
|
7
|
-
end
|
8
|
-
|
9
|
-
def initialize
|
10
|
-
@@env = ConfigService.environment
|
11
|
-
config = ConfigService.load_config('memcached.yml')[@@env]
|
12
|
-
host = config['host']
|
13
|
-
options = config.dup
|
14
|
-
options.delete('host')
|
15
|
-
@@client = Dalli::Client.new(host, options)
|
16
|
-
end #initialize
|
17
|
-
|
18
|
-
# Cache API, mimics ActiveSupport::Cache::Store
|
19
|
-
# http://api.rubyonrails.org/classes/ActiveSupport/Cache/Store.html
|
20
|
-
def read(key, options = {})
|
21
|
-
client.get(key, options)
|
22
|
-
end
|
23
|
-
|
24
|
-
def write(key, value, options = {})
|
25
|
-
client.set(key, value, options[:expires_in], options)
|
26
|
-
end
|
27
|
-
|
28
|
-
def delete(key, options = {})
|
29
|
-
deleted = read(key)
|
30
|
-
client.delete(key)
|
31
|
-
deleted
|
32
|
-
end
|
33
|
-
end #class methods
|
34
|
-
|
35
|
-
initialize
|
36
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
require_relative './config_service'
|
2
|
-
|
3
|
-
class CacheService
|
4
|
-
class << self
|
5
|
-
def cache
|
6
|
-
@@cache
|
7
|
-
end
|
8
|
-
|
9
|
-
def cache=(other_cache)
|
10
|
-
@@cache = other_cache
|
11
|
-
end
|
12
|
-
|
13
|
-
def initialize
|
14
|
-
config = ConfigService.load_config('cache_config.yml')[ConfigService.environment]
|
15
|
-
# Load all the existing caches in the system, outside of the gem
|
16
|
-
Dir.glob("#{File.expand_path('.')}/caches/*.rb").each { |rb_file| require rb_file }
|
17
|
-
@@cache = Object.const_get(config['cache'])
|
18
|
-
end
|
19
|
-
|
20
|
-
def read(key, options = {})
|
21
|
-
cache.read(key, options)
|
22
|
-
end
|
23
|
-
|
24
|
-
def write(key, value, options = {})
|
25
|
-
cache.write(key, value, options)
|
26
|
-
end
|
27
|
-
|
28
|
-
def delete(key, options = {})
|
29
|
-
cache.delete(key, options)
|
30
|
-
end
|
31
|
-
end #class methods
|
32
|
-
|
33
|
-
initialize
|
34
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
require 'active_support'
|
2
|
-
require 'active_support/core_ext'
|
3
|
-
|
4
|
-
class ConfigService
|
5
|
-
class << self
|
6
|
-
def load_config(config_file_name)
|
7
|
-
app_root = (defined? APP_ROOT)? APP_ROOT : File.expand_path('.')
|
8
|
-
|
9
|
-
config_file = nil
|
10
|
-
['conf', 'config'].each do |sub_path|
|
11
|
-
if File.exist?("#{app_root}/#{sub_path}/#{config_file_name}")
|
12
|
-
config_file = "#{app_root}/#{sub_path}/#{config_file_name}"
|
13
|
-
break
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
raise("You must have the file #{config_file_name} in either 'conf' or 'config' directory of your application") unless config_file
|
18
|
-
|
19
|
-
YAML.load_file(config_file)
|
20
|
-
end
|
21
|
-
|
22
|
-
def environment
|
23
|
-
return Rails.env if defined? Rails
|
24
|
-
return ENV['RACK_ENV'] if ENV['RACK_ENV'].present?
|
25
|
-
'local'
|
26
|
-
rescue => error
|
27
|
-
'local'
|
28
|
-
end
|
29
|
-
end # class methods
|
30
|
-
end
|