mousecop 0.0.2 → 0.0.3
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/README.md +2 -0
 - data/lib/mousecop.rb +1 -0
 - data/lib/mousecop/player.rb +11 -20
 - data/lib/mousecop/player_source.rb +14 -0
 - data/lib/mousecop/version.rb +1 -1
 - metadata +2 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: f027f124ec1fc9e291bd07cdcbeb286f24114ea1
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: e62d7cb2e66491ba9c7fc3733e3de7205c241997
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 008d2705ca8d2e885191b70ccd00e1c4f5ca22f055797c6149cf9d789b2b1db5e5b154e847d4d5412cbf5099007da93c87a731fca56d4c07566ea8e095787714
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: a80e624047ffb0e055f6c817d557c9e07e1c76dc15ae4c62c1ef6db766aad5cbfc2e137ef75c691df82c0566b6cae7d352f04578cd8fea94b91d830cf47d10e9
         
     | 
    
        data/README.md
    CHANGED
    
    
    
        data/lib/mousecop.rb
    CHANGED
    
    
    
        data/lib/mousecop/player.rb
    CHANGED
    
    | 
         @@ -1,34 +1,20 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require 'json'
         
     | 
| 
       2 
     | 
    
         
            -
            require 'faraday'
         
     | 
| 
       3 
1 
     | 
    
         | 
| 
       4 
2 
     | 
    
         
             
            module Mousecop
         
     | 
| 
       5 
3 
     | 
    
         
             
              class Player
         
     | 
| 
       6 
4 
     | 
    
         
             
                attr_accessor :name, :id, :image, :conference
         
     | 
| 
       7 
5 
     | 
    
         | 
| 
       8 
6 
     | 
    
         
             
                def self.all
         
     | 
| 
       9 
     | 
    
         
            -
                   
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
                  JSON.parse(@roster).collect do |player|
         
     | 
| 
      
 7 
     | 
    
         
            +
                  data = PlayerSource.new.fetch_data('/players')
         
     | 
| 
      
 8 
     | 
    
         
            +
                  data.collect do |player|
         
     | 
| 
       12 
9 
     | 
    
         
             
            	self.create(name: player["name"],
         
     | 
| 
       13 
10 
     | 
    
         
             
            		    id: player["id"],
         
     | 
| 
       14 
11 
     | 
    
         
             
            		    image: player["image"])
         
     | 
| 
       15 
12 
     | 
    
         
             
                  end
         
     | 
| 
       16 
13 
     | 
    
         
             
                end
         
     | 
| 
       17 
14 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
                def self.create(attributes= {})
         
     | 
| 
       19 
     | 
    
         
            -
                  self.new.tap do |player|
         
     | 
| 
       20 
     | 
    
         
            -
            	player.name = attributes[:name]
         
     | 
| 
       21 
     | 
    
         
            -
            	player.id = attributes[:id]
         
     | 
| 
       22 
     | 
    
         
            -
            	player.image = attributes[:image]
         
     | 
| 
       23 
     | 
    
         
            -
                  end
         
     | 
| 
       24 
     | 
    
         
            -
                end
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
15 
     | 
    
         
             
                def self.sample
         
     | 
| 
       27 
     | 
    
         
            -
                   
     | 
| 
       28 
     | 
    
         
            -
                  player  
     | 
| 
       29 
     | 
    
         
            -
                  Mousecop::Player.create(name: player["name"],
         
     | 
| 
       30 
     | 
    
         
            -
            			      id: player["id"],
         
     | 
| 
       31 
     | 
    
         
            -
            			      image: player["image"])
         
     | 
| 
      
 16 
     | 
    
         
            +
                  player = PlayerSource.new.fetch_data('/player').first
         
     | 
| 
      
 17 
     | 
    
         
            +
                  self.create(name: player["name"], id: player["id"], image: player["image"])
         
     | 
| 
       32 
18 
     | 
    
         
             
                end
         
     | 
| 
       33 
19 
     | 
    
         | 
| 
       34 
20 
     | 
    
         
             
                def self.first
         
     | 
| 
         @@ -36,8 +22,13 @@ module Mousecop 
     | 
|
| 
       36 
22 
     | 
    
         
             
                  @all.first
         
     | 
| 
       37 
23 
     | 
    
         
             
                end
         
     | 
| 
       38 
24 
     | 
    
         | 
| 
       39 
     | 
    
         
            -
                def self. 
     | 
| 
       40 
     | 
    
         
            -
                   
     | 
| 
      
 25 
     | 
    
         
            +
                def self.create(attributes= {})
         
     | 
| 
      
 26 
     | 
    
         
            +
                  self.new.tap do |player|
         
     | 
| 
      
 27 
     | 
    
         
            +
            	player.name = attributes[:name]
         
     | 
| 
      
 28 
     | 
    
         
            +
            	player.id = attributes[:id]
         
     | 
| 
      
 29 
     | 
    
         
            +
            	player.image = attributes[:image]
         
     | 
| 
      
 30 
     | 
    
         
            +
                  end
         
     | 
| 
       41 
31 
     | 
    
         
             
                end
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
       42 
33 
     | 
    
         
             
              end
         
     | 
| 
       43 
34 
     | 
    
         
             
            end
         
     | 
    
        data/lib/mousecop/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: mousecop
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.3
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Rolen Le
         
     | 
| 
         @@ -109,6 +109,7 @@ files: 
     | 
|
| 
       109 
109 
     | 
    
         
             
            - Rakefile
         
     | 
| 
       110 
110 
     | 
    
         
             
            - lib/mousecop.rb
         
     | 
| 
       111 
111 
     | 
    
         
             
            - lib/mousecop/player.rb
         
     | 
| 
      
 112 
     | 
    
         
            +
            - lib/mousecop/player_source.rb
         
     | 
| 
       112 
113 
     | 
    
         
             
            - lib/mousecop/version.rb
         
     | 
| 
       113 
114 
     | 
    
         
             
            - mousecop.gemspec
         
     | 
| 
       114 
115 
     | 
    
         
             
            - test/mousecop/player_test.rb
         
     |