osxwarranty 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.
- data/README.md +2 -0
- data/lib/config/asdcheck.yml +84 -0
- data/lib/osxwarranty/base.rb +4 -6
- data/lib/osxwarranty/version.rb +1 -1
- data/spec/osxwarranty_spec.rb +2 -1
- metadata +9 -8
    
        data/README.md
    CHANGED
    
    | @@ -24,11 +24,13 @@ If you want warranty info as well as asd info: | |
| 24 24 | 
             
            	osx.info("SERIAL_NUMBER")
         | 
| 25 25 |  | 
| 26 26 | 
             
            if you want warranty info without the asd info:
         | 
| 27 | 
            +
             | 
| 27 28 | 
             
            	osx = OSXwarranty::Base.new
         | 
| 28 29 |  | 
| 29 30 | 
             
            	osx.get_warranty_info("SERIAL_NUMBER")
         | 
| 30 31 |  | 
| 31 32 | 
             
            If you want just the model info:
         | 
| 33 | 
            +
             | 
| 32 34 | 
             
            	osx = OSXwarranty::Base.new
         | 
| 33 35 |  | 
| 34 36 | 
             
            	osx.get_model_info("SERIAL_NUMBER")	
         | 
| @@ -0,0 +1,84 @@ | |
| 1 | 
            +
            Xserve_Late_2006: "3X102"
         | 
| 2 | 
            +
            Xserve_Early_2008: "3X106"
         | 
| 3 | 
            +
            Xserve_Early_2009: "3X106"
         | 
| 4 | 
            +
            iMac_17_inch_Late_2006: "3S108"
         | 
| 5 | 
            +
            iMac_20_inch_Late_2006: "3S108"
         | 
| 6 | 
            +
            iMac_17_inch_Late_2006_CD: "3S108"
         | 
| 7 | 
            +
            iMac_24_inch: "3S108"
         | 
| 8 | 
            +
            Mac_Pro: "3S108"
         | 
| 9 | 
            +
            iMac_Mid_2006_17_inch: "3S108"
         | 
| 10 | 
            +
            MacBook_13_inch: "3S108"
         | 
| 11 | 
            +
            MacBook_Pro_17_inch: "3S108"
         | 
| 12 | 
            +
            Mac_mini_Early_2006: "3S108"
         | 
| 13 | 
            +
            Mac_mini_Late_2006: "3S108"
         | 
| 14 | 
            +
            MacBook_Pro: "3S108"
         | 
| 15 | 
            +
            MacBook_Pro_15_inch_Glossy: "3S108"
         | 
| 16 | 
            +
            iMac_Early_2006_17_inch: "3S108"
         | 
| 17 | 
            +
            iMac_Early_2006_20_inch: "3S108"
         | 
| 18 | 
            +
            iMac_20_inch_Mid_2007: "3S116"
         | 
| 19 | 
            +
            iMac_24_inch_Mid_2007: "3S116"
         | 
| 20 | 
            +
            Mac_mini_Mid_2007: "3S116"
         | 
| 21 | 
            +
            MacBook_13_inch_Mid_2007: "3S116"
         | 
| 22 | 
            +
            Mac_Pro_8x: "3S116"
         | 
| 23 | 
            +
            MacBook_Pro_15_inch_Core_2_Duo: "3S116"
         | 
| 24 | 
            +
            MacBook_Pro_17_inch_Core_2_Duo: "3S116"
         | 
| 25 | 
            +
            MacBook_Late_2006: "3S116"
         | 
| 26 | 
            +
            MacBook_13_inch_Late_2006: "3S116"
         | 
| 27 | 
            +
            MacBook_Pro_15_inch_2.4/2.2GHz: "3S116"
         | 
| 28 | 
            +
            MacBook_Pro_17_inch_2.4GHz: "3S116"
         | 
| 29 | 
            +
            iMac_20_inch_Early_2008: "3S123"
         | 
| 30 | 
            +
            iMac_24_inch_Early_2008: "3S123"
         | 
| 31 | 
            +
            MacBook_13_inch_Early_2008: "3S123"
         | 
| 32 | 
            +
            MacBook_Pro_15_inch_Early_2008: "3S123"
         | 
| 33 | 
            +
            MacBook_Pro_17_inch_Early_2008: "3S123"
         | 
| 34 | 
            +
            MacBook_Air: "3S123"
         | 
| 35 | 
            +
            Mac_Pro_Early_2008: "3S123"
         | 
| 36 | 
            +
            MacBook_13_inch_Late_2007: "3S123"
         | 
| 37 | 
            +
            MacBook_13_inch__Aluminum__Late_2008: "3S132"
         | 
| 38 | 
            +
            MacBook_Pro_17_inch__Late_2008: "3S132"
         | 
| 39 | 
            +
            MacBook_Pro_15_inch__Late_2008: "3S132"
         | 
| 40 | 
            +
            MacBook_Air_Late_2008: "3S132"
         | 
| 41 | 
            +
            MacBook_13_inch__Early_2009: "3S132"
         | 
| 42 | 
            +
            MacMini_Early_2009: "3S132"
         | 
| 43 | 
            +
            iMac_20_inch__Early_2009: "3S132"
         | 
| 44 | 
            +
            iMac_24_inch__Early_2009: "3S132"
         | 
| 45 | 
            +
            iMac_Mid_2009: "3S132"
         | 
| 46 | 
            +
            MacBook_Pro_17_inch__Early_2009: "3S132"
         | 
| 47 | 
            +
            Mac_Pro_Early_2009: "3S132"
         | 
| 48 | 
            +
            MacBook_13_inch__Mid_2009: "3S132"
         | 
| 49 | 
            +
            MacBook_Air_Mid_2009: "3S132"
         | 
| 50 | 
            +
            MacBook_Pro_17_inch__Mid_2009: "3S132"
         | 
| 51 | 
            +
            MacBook_Pro_15_inch__Mid_2009: "3S132"
         | 
| 52 | 
            +
            MacBook_Pro_15_inch__2.53GHz__Mid_2009: "3S132"
         | 
| 53 | 
            +
            MacBook_Pro_13_inch__Mid_2009: "3S132"
         | 
| 54 | 
            +
            Mac_mini_Late_2009: "3S138"
         | 
| 55 | 
            +
            MacBook_13_inch__Late_2009: "3S138"
         | 
| 56 | 
            +
            iMac_21.5_inch__Late_2009: "3S138"
         | 
| 57 | 
            +
            iMac_27_inch__Late_2009: "3S138"
         | 
| 58 | 
            +
            MacBook_Pro_13_inch__Mid_2010: "3S138"
         | 
| 59 | 
            +
            MacBook_Pro_15_inch__Mid_2010: "3S138"
         | 
| 60 | 
            +
            MacBook_Pro_17_inch__Mid_2010: "3S138"
         | 
| 61 | 
            +
            MacBook_13_inch__Mid_2010: "3S138"
         | 
| 62 | 
            +
            Mac_mini_Mid_2010: "3S139"
         | 
| 63 | 
            +
            iMac_21_5_inch__Mid_2010: "3S140"
         | 
| 64 | 
            +
            iMac_27_inch__Mid_2010: "3S140"
         | 
| 65 | 
            +
            MacBook_Air_11_inch__Late_2010: "3S142"
         | 
| 66 | 
            +
            MacBook_Air_13_inch__Late_2010: "3S142"
         | 
| 67 | 
            +
            Mac_Pro_Mid_2010: "3S149"
         | 
| 68 | 
            +
            MacBook_Pro_17_inch__Early_2011: "3S144"
         | 
| 69 | 
            +
            MacBook_Pro_15_inch__Early_2011: "3S144"
         | 
| 70 | 
            +
            MacBook_Pro_13_inch__Early_2011: "3S144"
         | 
| 71 | 
            +
            iMac_21.5_inch__Mid_2011: "3S145"
         | 
| 72 | 
            +
            iMac_27_inch__Mid_2011: "3S145"
         | 
| 73 | 
            +
            MacBook_Air_13_inch__Mid_2011: "3S146"
         | 
| 74 | 
            +
            MacBook_Air_11_inch__Mid_2011: "3S146"
         | 
| 75 | 
            +
            Mac_mini_Mid_2011: "3S146"
         | 
| 76 | 
            +
            iMac_21_5_inch__Late_2011: "3S147"
         | 
| 77 | 
            +
            MacBook_Pro_13_inch__Late_2011: "3S148"
         | 
| 78 | 
            +
            MacBook_Pro_15_inch__Late_2011: "3S148"
         | 
| 79 | 
            +
            MacBook_Pro_17_inch__Late_2011: "3S148"
         | 
| 80 | 
            +
            MacBook_Pro_13_inch__Mid_2012: "3S150"
         | 
| 81 | 
            +
            MacBook_Pro_15_inch__Mid_2012: "3S150"
         | 
| 82 | 
            +
            MacBook_Pro_Retina__Mid_2012: "3S150"
         | 
| 83 | 
            +
            MacBook_Air_11_inch__Mid_2012: "3S150"
         | 
| 84 | 
            +
            MacBook_Air_13_inch__Mid_2012: "3S150"
         | 
    
        data/lib/osxwarranty/base.rb
    CHANGED
    
    | @@ -1,5 +1,6 @@ | |
| 1 1 | 
             
            require 'httpclient'
         | 
| 2 2 | 
             
            require 'nokogiri'
         | 
| 3 | 
            +
            require 'yaml'
         | 
| 3 4 | 
             
            module OSXwarranty
         | 
| 4 5 | 
             
            	class Base
         | 
| 5 6 | 
             
            		# glarizza's get_warranty method (https://github.com/glarizza/scripts/blob/master/ruby/warranty.rb)
         | 
| @@ -38,12 +39,9 @@ module OSXwarranty | |
| 38 39 | 
             
            		end
         | 
| 39 40 | 
             
            		# chilcote's asdcheck (https://github.com/chilcote/warranty/blob/master/asdcheck)
         | 
| 40 41 | 
             
            		def asdcheck(model)
         | 
| 41 | 
            -
             | 
| 42 | 
            -
            			 | 
| 43 | 
            -
             | 
| 44 | 
            -
            				asd_hash[asd_array[0]] = asd_array[1].gsub("\n","")
         | 
| 45 | 
            -
            		    end
         | 
| 46 | 
            -
            		    return asd_hash[model]
         | 
| 42 | 
            +
            			asd_hash = YAML.load_file(File.join(File.dirname(__FILE__),"../config/asdcheck.yml"))
         | 
| 43 | 
            +
            			search_q = model.gsub(" ", "_").gsub("(","").gsub(")","").gsub("-","_").gsub(",","_").gsub(".","_")
         | 
| 44 | 
            +
            	 		return asd_hash[search_q]
         | 
| 47 45 | 
             
            		end
         | 
| 48 46 | 
             
            	end
         | 
| 49 47 | 
             
            end
         | 
    
        data/lib/osxwarranty/version.rb
    CHANGED
    
    
    
        data/spec/osxwarranty_spec.rb
    CHANGED
    
    | @@ -19,7 +19,8 @@ describe OSXwarranty do | |
| 19 19 | 
             
            	end
         | 
| 20 20 | 
             
            	describe "#asdcheck" do
         | 
| 21 21 | 
             
            		it "should not be nil" do
         | 
| 22 | 
            -
            		  @warranty.asdcheck(@model).size.should_not be_nil | 
| 22 | 
            +
            		  @warranty.asdcheck(@model).size.should_not be_nil
         | 
| 23 | 
            +
            		  @warranty.asdcheck("Xserve_Late_2006").should include("3X102")
         | 
| 23 24 | 
             
            		end
         | 
| 24 25 | 
             
            	end
         | 
| 25 26 |  | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: osxwarranty
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0. | 
| 4 | 
            +
              version: 0.0.3
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors:
         | 
| @@ -9,11 +9,11 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date: 2012-08- | 
| 12 | 
            +
            date: 2012-08-15 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: httpclient
         | 
| 16 | 
            -
              requirement: & | 
| 16 | 
            +
              requirement: &70358514591020 !ruby/object:Gem::Requirement
         | 
| 17 17 | 
             
                none: false
         | 
| 18 18 | 
             
                requirements:
         | 
| 19 19 | 
             
                - - ! '>='
         | 
| @@ -21,10 +21,10 @@ dependencies: | |
| 21 21 | 
             
                    version: '0'
         | 
| 22 22 | 
             
              type: :runtime
         | 
| 23 23 | 
             
              prerelease: false
         | 
| 24 | 
            -
              version_requirements: * | 
| 24 | 
            +
              version_requirements: *70358514591020
         | 
| 25 25 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 26 26 | 
             
              name: nokogiri
         | 
| 27 | 
            -
              requirement: & | 
| 27 | 
            +
              requirement: &70358514590600 !ruby/object:Gem::Requirement
         | 
| 28 28 | 
             
                none: false
         | 
| 29 29 | 
             
                requirements:
         | 
| 30 30 | 
             
                - - ! '>='
         | 
| @@ -32,10 +32,10 @@ dependencies: | |
| 32 32 | 
             
                    version: '0'
         | 
| 33 33 | 
             
              type: :runtime
         | 
| 34 34 | 
             
              prerelease: false
         | 
| 35 | 
            -
              version_requirements: * | 
| 35 | 
            +
              version_requirements: *70358514590600
         | 
| 36 36 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 37 37 | 
             
              name: rspec
         | 
| 38 | 
            -
              requirement: & | 
| 38 | 
            +
              requirement: &70358514590180 !ruby/object:Gem::Requirement
         | 
| 39 39 | 
             
                none: false
         | 
| 40 40 | 
             
                requirements:
         | 
| 41 41 | 
             
                - - ! '>='
         | 
| @@ -43,7 +43,7 @@ dependencies: | |
| 43 43 | 
             
                    version: '0'
         | 
| 44 44 | 
             
              type: :development
         | 
| 45 45 | 
             
              prerelease: false
         | 
| 46 | 
            -
              version_requirements: * | 
| 46 | 
            +
              version_requirements: *70358514590180
         | 
| 47 47 | 
             
            description: retrieves warranty info for macs based on serial number, uses glarizza's
         | 
| 48 48 | 
             
              warranty script and chilcote's asdcheck script
         | 
| 49 49 | 
             
            email:
         | 
| @@ -57,6 +57,7 @@ files: | |
| 57 57 | 
             
            - LICENSE
         | 
| 58 58 | 
             
            - README.md
         | 
| 59 59 | 
             
            - Rakefile
         | 
| 60 | 
            +
            - lib/config/asdcheck.yml
         | 
| 60 61 | 
             
            - lib/osxwarranty.rb
         | 
| 61 62 | 
             
            - lib/osxwarranty/base.rb
         | 
| 62 63 | 
             
            - lib/osxwarranty/version.rb
         |