adsk_auth_service 1.0.20 → 1.0.21
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/adsk_auth_service.gemspec +1 -1
 - data/lib/services/auth_service.rb +17 -5
 - data/lib/utils/net_util.rb +2 -2
 - metadata +19 -19
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 94f074930b2420a7da61b3da108c105c605bcc2b
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 29cab558c781d0901d0ee5cd698b3fecba8d7eb6
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 54d232e68d451df60e11f3a1f9754b7789f6f9b7dbc1a8fc6a743f29f795dbcdc173b957f4e6f0b813a1722c23ce787c1458ca34082fa65f7d09570287699c79
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: f9f3aa0fd0e1aead2a9c98963f322db462b3a44246b1dd24db10b098c5240424ee434aa7deb91e322eb12e1a4ea15067db30410a977eed215d6b687a554782d2
         
     | 
    
        data/adsk_auth_service.gemspec
    CHANGED
    
    
| 
         @@ -5,14 +5,26 @@ require_relative '../utils/net_util' 
     | 
|
| 
       5 
5 
     | 
    
         
             
            class AuthService
         
     | 
| 
       6 
6 
     | 
    
         
             
              class << self
         
     | 
| 
       7 
7 
     | 
    
         
             
                def load_config
         
     | 
| 
       8 
     | 
    
         
            -
                  @@config ||= ConfigService.load_config('auth_keys.yml')[ConfigService.environment]
         
     | 
| 
      
 8 
     | 
    
         
            +
                  @@config ||= ConfigService.load_config('auth_keys.yml')[ConfigService.environment] rescue {}
         
     | 
| 
       9 
9 
     | 
    
         
             
                end
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
       11 
     | 
    
         
            -
                def  
     | 
| 
      
 11 
     | 
    
         
            +
                def set_config(options = {})
         
     | 
| 
      
 12 
     | 
    
         
            +
                  @@config['url']             = options['url']
         
     | 
| 
      
 13 
     | 
    
         
            +
                  @@config['consumer_key']    = options['consumer_key']
         
     | 
| 
      
 14 
     | 
    
         
            +
                  @@config['consumer_secret'] = options['consumer_secret']
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                  @@config
         
     | 
| 
      
 17 
     | 
    
         
            +
                end
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                def oauth_token(options = {})
         
     | 
| 
      
 20 
     | 
    
         
            +
                  url     = options['url']              || @@config['url']
         
     | 
| 
      
 21 
     | 
    
         
            +
                  key     = options['consumer_key']     || @@config['consumer_key']
         
     | 
| 
      
 22 
     | 
    
         
            +
                  secret  = options['consumer_secret']  || @@config['consumer_secret']
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
       12 
24 
     | 
    
         
             
                  ActiveSupport::JSON.decode(
         
     | 
| 
       13 
     | 
    
         
            -
                    NetUtil.call_webservices( 
     | 
| 
       14 
     | 
    
         
            -
                      'post', 
     | 
| 
       15 
     | 
    
         
            -
                      "client_id=#{ 
     | 
| 
      
 25 
     | 
    
         
            +
                    NetUtil.call_webservices(url,
         
     | 
| 
      
 26 
     | 
    
         
            +
                      'post',
         
     | 
| 
      
 27 
     | 
    
         
            +
                      "client_id=#{key}&client_secret=#{secret}&grant_type=client_credentials", 
         
     | 
| 
       16 
28 
     | 
    
         
             
                      { headers: {'Content-Type' => 'application/x-www-form-urlencoded'} }).body
         
     | 
| 
       17 
29 
     | 
    
         
             
                  )
         
     | 
| 
       18 
30 
     | 
    
         
             
                end
         
     | 
    
        data/lib/utils/net_util.rb
    CHANGED
    
    | 
         @@ -21,13 +21,13 @@ class NetUtil 
     | 
|
| 
       21 
21 
     | 
    
         
             
                rescue StandardError => error
         
     | 
| 
       22 
22 
     | 
    
         
             
                  try_time += 1
         
     | 
| 
       23 
23 
     | 
    
         
             
                  if try_time > RETRY_TIMES
         
     | 
| 
       24 
     | 
    
         
            -
                     
     | 
| 
      
 24 
     | 
    
         
            +
                    puts ("\n#{Time.now} Unrecoverable error in NetUtil.call_webservices: "\
         
     | 
| 
       25 
25 
     | 
    
         
             
                                               "#{error}\n#{error.backtrace.join("\n")}\n")
         
     | 
| 
       26 
26 
     | 
    
         
             
                    # It is an unrecoverable error, throw the exception back, don't suppress it.
         
     | 
| 
       27 
27 
     | 
    
         
             
                    raise "Unrecoverable error calling web services.\nURL: #{url}.\nError message: #{error.message}." 
         
     | 
| 
       28 
28 
     | 
    
         
             
                  end
         
     | 
| 
       29 
29 
     | 
    
         | 
| 
       30 
     | 
    
         
            -
                   
     | 
| 
      
 30 
     | 
    
         
            +
                  puts ("NetUtil.call_webservices #{url}:\nError happens: #{error}. Try #{try_time} time(s).")
         
     | 
| 
       31 
31 
     | 
    
         
             
                  sleep(WAIT_TIME)
         
     | 
| 
       32 
32 
     | 
    
         
             
                  retry
         
     | 
| 
       33 
33 
     | 
    
         
             
                end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,41 +1,41 @@ 
     | 
|
| 
       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.21
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Linh Chau
         
     | 
| 
       8 
     | 
    
         
            -
            autorequire: 
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2015-04- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2015-04-14 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
     | 
    
         
            -
              name: config_service
         
     | 
| 
       15 
14 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       16 
15 
     | 
    
         
             
                requirements:
         
     | 
| 
       17 
     | 
    
         
            -
                - -  
     | 
| 
      
 16 
     | 
    
         
            +
                - - '>='
         
     | 
| 
       18 
17 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       19 
18 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       20 
     | 
    
         
            -
               
     | 
| 
      
 19 
     | 
    
         
            +
              name: config_service
         
     | 
| 
       21 
20 
     | 
    
         
             
              prerelease: false
         
     | 
| 
      
 21 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
       22 
22 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       23 
23 
     | 
    
         
             
                requirements:
         
     | 
| 
       24 
     | 
    
         
            -
                - -  
     | 
| 
      
 24 
     | 
    
         
            +
                - - '>='
         
     | 
| 
       25 
25 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       26 
26 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       27 
27 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       28 
     | 
    
         
            -
              name: rspec
         
     | 
| 
       29 
28 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       30 
29 
     | 
    
         
             
                requirements:
         
     | 
| 
       31 
     | 
    
         
            -
                - -  
     | 
| 
      
 30 
     | 
    
         
            +
                - - ~>
         
     | 
| 
       32 
31 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       33 
32 
     | 
    
         
             
                    version: '3.1'
         
     | 
| 
       34 
     | 
    
         
            -
               
     | 
| 
      
 33 
     | 
    
         
            +
              name: rspec
         
     | 
| 
       35 
34 
     | 
    
         
             
              prerelease: false
         
     | 
| 
      
 35 
     | 
    
         
            +
              type: :development
         
     | 
| 
       36 
36 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       37 
37 
     | 
    
         
             
                requirements:
         
     | 
| 
       38 
     | 
    
         
            -
                - -  
     | 
| 
      
 38 
     | 
    
         
            +
                - - ~>
         
     | 
| 
       39 
39 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       40 
40 
     | 
    
         
             
                    version: '3.1'
         
     | 
| 
       41 
41 
     | 
    
         
             
            description: A gem for Autodesk 2-phase authentication service.
         
     | 
| 
         @@ -44,8 +44,8 @@ executables: [] 
     | 
|
| 
       44 
44 
     | 
    
         
             
            extensions: []
         
     | 
| 
       45 
45 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
       46 
46 
     | 
    
         
             
            files:
         
     | 
| 
       47 
     | 
    
         
            -
            -  
     | 
| 
       48 
     | 
    
         
            -
            -  
     | 
| 
      
 47 
     | 
    
         
            +
            - ./Gemfile
         
     | 
| 
      
 48 
     | 
    
         
            +
            - ./adsk_auth_service.gemspec
         
     | 
| 
       49 
49 
     | 
    
         
             
            - lib/adsk_auth_service.rb
         
     | 
| 
       50 
50 
     | 
    
         
             
            - lib/services/auth_service.rb
         
     | 
| 
       51 
51 
     | 
    
         
             
            - lib/utils/net_util.rb
         
     | 
| 
         @@ -53,24 +53,24 @@ homepage: https://github.com/linhchauatl/adsk_auth_service 
     | 
|
| 
       53 
53 
     | 
    
         
             
            licenses:
         
     | 
| 
       54 
54 
     | 
    
         
             
            - MIT
         
     | 
| 
       55 
55 
     | 
    
         
             
            metadata: {}
         
     | 
| 
       56 
     | 
    
         
            -
            post_install_message: 
     | 
| 
      
 56 
     | 
    
         
            +
            post_install_message:
         
     | 
| 
       57 
57 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
       58 
58 
     | 
    
         
             
            require_paths:
         
     | 
| 
       59 
59 
     | 
    
         
             
            - lib
         
     | 
| 
       60 
60 
     | 
    
         
             
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
       61 
61 
     | 
    
         
             
              requirements:
         
     | 
| 
       62 
     | 
    
         
            -
              - -  
     | 
| 
      
 62 
     | 
    
         
            +
              - - '>='
         
     | 
| 
       63 
63 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       64 
64 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       65 
65 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       66 
66 
     | 
    
         
             
              requirements:
         
     | 
| 
       67 
     | 
    
         
            -
              - -  
     | 
| 
      
 67 
     | 
    
         
            +
              - - '>='
         
     | 
| 
       68 
68 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       69 
69 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       70 
70 
     | 
    
         
             
            requirements: []
         
     | 
| 
       71 
     | 
    
         
            -
            rubyforge_project: 
     | 
| 
       72 
     | 
    
         
            -
            rubygems_version: 2. 
     | 
| 
       73 
     | 
    
         
            -
            signing_key: 
     | 
| 
      
 71 
     | 
    
         
            +
            rubyforge_project:
         
     | 
| 
      
 72 
     | 
    
         
            +
            rubygems_version: 2.1.9
         
     | 
| 
      
 73 
     | 
    
         
            +
            signing_key:
         
     | 
| 
       74 
74 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       75 
75 
     | 
    
         
             
            summary: Autodesk second phase token retrieval
         
     | 
| 
       76 
76 
     | 
    
         
             
            test_files: []
         
     |