learn-web 1.3.0 → 1.4.0
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/lib/learn_web/client/environment.rb +14 -0
 - data/lib/learn_web/client/environment/verification.rb +33 -0
 - data/lib/learn_web/version.rb +1 -1
 - metadata +3 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 3f434cbce43702f53cca0399a9a736312d28f18e
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 52f28102090218ab69b67ed6a3c5e07a56d1defc
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: c529e6b60bec89382b2567ba09244cd10dfd0f3e8d2c8fd0b5a12064357a54ceec93b6e08f577c96f231d06e23e2aed7c8e6eb22d01a6844d12592e83c66899c
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: ab438694b8dae8497a161f7672b385af5cbeb04ff01ae6d5686229cc6b361a9b048333c6f57a5d99c85e2cd607fd2e4a52f51ed9fc92d2f6db44537890e0f1c8
         
     | 
| 
         @@ -1,4 +1,5 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'learn_web/client/environment/setup_list'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'learn_web/client/environment/verification'
         
     | 
| 
       2 
3 
     | 
    
         | 
| 
       3 
4 
     | 
    
         
             
            module LearnWeb
         
     | 
| 
       4 
5 
     | 
    
         
             
              class Client
         
     | 
| 
         @@ -7,11 +8,24 @@ module LearnWeb 
     | 
|
| 
       7 
8 
     | 
    
         
             
                    "#{API_ROOT}/environmentalizer/steps"
         
     | 
| 
       8 
9 
     | 
    
         
             
                  end
         
     | 
| 
       9 
10 
     | 
    
         | 
| 
      
 11 
     | 
    
         
            +
                  def verification_endpoint
         
     | 
| 
      
 12 
     | 
    
         
            +
                    "#{API_ROOT}/gem_verifications"
         
     | 
| 
      
 13 
     | 
    
         
            +
                  end
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
       10 
15 
     | 
    
         
             
                  def environment_setup_list
         
     | 
| 
       11 
16 
     | 
    
         
             
                    response = get(environment_setup_list_endpoint)
         
     | 
| 
       12 
17 
     | 
    
         | 
| 
       13 
18 
     | 
    
         
             
                    LearnWeb::Client::Environment::SetupList.new(response)
         
     | 
| 
       14 
19 
     | 
    
         
             
                  end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                  def verify_environment
         
     | 
| 
      
 22 
     | 
    
         
            +
                    response = post(
         
     | 
| 
      
 23 
     | 
    
         
            +
                      verification_endpoint,
         
     | 
| 
      
 24 
     | 
    
         
            +
                      headers: { 'Authorization' => "Bearer #{token}" }
         
     | 
| 
      
 25 
     | 
    
         
            +
                    )
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                    LearnWeb::Client::Environment::Verification.new(reponse)
         
     | 
| 
      
 28 
     | 
    
         
            +
                  end
         
     | 
| 
       15 
29 
     | 
    
         
             
                end
         
     | 
| 
       16 
30 
     | 
    
         
             
              end
         
     | 
| 
       17 
31 
     | 
    
         
             
            end
         
     | 
| 
         @@ -0,0 +1,33 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module LearnWeb
         
     | 
| 
      
 2 
     | 
    
         
            +
              class Client
         
     | 
| 
      
 3 
     | 
    
         
            +
                module Environment
         
     | 
| 
      
 4 
     | 
    
         
            +
                  class Verification
         
     | 
| 
      
 5 
     | 
    
         
            +
                    attr_reader   :response
         
     | 
| 
      
 6 
     | 
    
         
            +
                    attr_accessor :message, :status
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
                    def initialize(response)
         
     | 
| 
      
 9 
     | 
    
         
            +
                      @response = response
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                      parse!
         
     | 
| 
      
 12 
     | 
    
         
            +
                    end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                    def success?
         
     | 
| 
      
 15 
     | 
    
         
            +
                      status == 200
         
     | 
| 
      
 16 
     | 
    
         
            +
                    end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                    private
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                    def parse!
         
     | 
| 
      
 21 
     | 
    
         
            +
                      self.status = response.status
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                      begin
         
     | 
| 
      
 24 
     | 
    
         
            +
                        body = Oj.load(response.body, symbol_keys: true)
         
     | 
| 
      
 25 
     | 
    
         
            +
                        self.message = body[:message]
         
     | 
| 
      
 26 
     | 
    
         
            +
                      rescue
         
     | 
| 
      
 27 
     | 
    
         
            +
                        self.message = 'Sorry, something went wrong. Please try again.'
         
     | 
| 
      
 28 
     | 
    
         
            +
                      end
         
     | 
| 
      
 29 
     | 
    
         
            +
                    end
         
     | 
| 
      
 30 
     | 
    
         
            +
                  end
         
     | 
| 
      
 31 
     | 
    
         
            +
                end
         
     | 
| 
      
 32 
     | 
    
         
            +
              end
         
     | 
| 
      
 33 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/learn_web/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: learn-web
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.4.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Flatiron School
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2015- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2015-09-09 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: bundler
         
     | 
| 
         @@ -85,6 +85,7 @@ files: 
     | 
|
| 
       85 
85 
     | 
    
         
             
            - lib/learn_web/client/connection.rb
         
     | 
| 
       86 
86 
     | 
    
         
             
            - lib/learn_web/client/environment.rb
         
     | 
| 
       87 
87 
     | 
    
         
             
            - lib/learn_web/client/environment/setup_list.rb
         
     | 
| 
      
 88 
     | 
    
         
            +
            - lib/learn_web/client/environment/verification.rb
         
     | 
| 
       88 
89 
     | 
    
         
             
            - lib/learn_web/client/fork.rb
         
     | 
| 
       89 
90 
     | 
    
         
             
            - lib/learn_web/client/fork/request.rb
         
     | 
| 
       90 
91 
     | 
    
         
             
            - lib/learn_web/client/lesson.rb
         
     |