adsk_auth_service 1.0.5 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3798a9499f9e8b9e9b490f0dbc5c39592e875597
4
- data.tar.gz: 1ad642f3f9ab20ca02fa0b1213f3d55719c24499
3
+ metadata.gz: 6a0b1443ef86962b6f4c3aa002ca0e8ab35a104d
4
+ data.tar.gz: a839d68a677b9276ed0aff707ab94ea5b7c7172c
5
5
  SHA512:
6
- metadata.gz: af138d66b7194d5dfccdf0dda8a348acf03a3934852997441b08c25b12357cb0ea92d240e0b4af74a038999fd266fc3699ed1118a20b686c0cbc9d334f91f5fd
7
- data.tar.gz: aa6346981a7f5c507cf16e978712aaf9cdc2a6238178975f805249f78f144f184d40dfa89b19b61f4decb7d7d7b86d537438aab5a39125cf34e68d8c2f1df20b
6
+ metadata.gz: d728f3cbe5bae3506fc5c7f8f64da0080fb4740468004b757037865e89543f02a8e45e8fc46b44a4ced271a1c00b8556263b62be9f90b0561541865b23348289
7
+ data.tar.gz: 53b2aa27db058f53417c3d4cc37c3c56cd381d9f833b7b7ce3b561eebe3d5b486f074892e798ab827e9fd1e1502040e1398f8576802b9828e6db8dace3c22088
data/Gemfile CHANGED
@@ -1,6 +1,4 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gem 'rspec'
4
- gem 'logging'
5
- gem 'activesupport'
6
- gem 'dalli'
4
+ gem 'cache_service'
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'adsk_auth_service'
3
- s.version = '1.0.5'
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/config_service.rb', 'lib/services/cache_service.rb',
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 'logging', '~> 0'
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
@@ -1,13 +1,17 @@
1
1
  require 'yaml'
2
- require_relative 'services/config_service'
2
+ require 'cache_service'
3
3
 
4
- ['caches', 'services', 'utils'].each do |sub_path|
5
- rb_files = Dir.glob("#{File.expand_path('.')}/lib/#{sub_path}/*.rb")
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
- if rb_files.empty?
8
- spec = Gem::Specification.find_by_name('adsk_auth_service')
9
- rb_files = Dir.glob("#{spec.gem_dir}/lib/#{sub_path}/*.rb")
10
- end
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
@@ -1,6 +1,5 @@
1
1
  require 'net/https'
2
2
  require 'active_support'
3
- require_relative '../services/sdk_logger'
4
3
 
5
4
  class NetUtil
6
5
  READ_TIMEOUT = 600 # 10 minutes
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.5
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-16 00:00:00.000000000 Z
11
+ date: 2014-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: logging
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
@@ -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
@@ -1,12 +0,0 @@
1
- class SdkLogger
2
- @@logger = Logger.new(STDOUT)
3
- class << self
4
- def logger
5
- @@logger
6
- end
7
-
8
- def logger=(other_logger)
9
- @@logger = other_logger
10
- end
11
- end
12
- end