apple_models 1.0.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.
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ coverage
6
+ InstalledFiles
7
+ lib/bundler/man
8
+ pkg
9
+ rdoc
10
+ spec/reports
11
+ test/tmp
12
+ test/version_tmp
13
+ tmp
14
+
15
+ # YARD artifacts
16
+ .yardoc
17
+ _yardoc
18
+ doc/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
data/.travis.yml ADDED
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - jruby-18mode
5
+ - jruby-19mode
6
+ - rbx-18mode
7
+ - rbx-19mode
8
+ - 1.8.7
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in apple_models.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,26 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ apple_models (1.0.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ diff-lcs (1.1.3)
10
+ rake (10.0.3)
11
+ rspec (2.12.0)
12
+ rspec-core (~> 2.12.0)
13
+ rspec-expectations (~> 2.12.0)
14
+ rspec-mocks (~> 2.12.0)
15
+ rspec-core (2.12.2)
16
+ rspec-expectations (2.12.1)
17
+ diff-lcs (~> 1.1.3)
18
+ rspec-mocks (2.12.1)
19
+
20
+ PLATFORMS
21
+ ruby
22
+
23
+ DEPENDENCIES
24
+ apple_models!
25
+ rake
26
+ rspec (~> 2.12.0)
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 TODO: Write your name
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,33 @@
1
+ # Apple Models [![Build Status](https://travis-ci.org/tboyko/apple_models.png?branch=master)](http://travis-ci.org/tboyko/apple_models)
2
+
3
+ Retrieve the model name of an Apple product based on the model id. __Note:__ the model id is also referred to as the product code and the product id.
4
+
5
+ __Special Note:__ At this time, only iOS product lookups are available. Feel free to fork and expand the hash!
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ gem 'apple_models'
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install apple_models
20
+
21
+ ## Usage
22
+
23
+ ```ruby
24
+ AppleModels.find('iPad2,7') # returns "iPad Mini"
25
+ ```
26
+
27
+ ## Contributing
28
+
29
+ 1. Fork it
30
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
31
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
32
+ 4. Push to the branch (`git push origin my-new-feature`)
33
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+
4
+ task :default => :spec
5
+
6
+ RSpec::Core::RakeTask.new
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'apple_models/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "apple_models"
8
+ gem.version = AppleModels::VERSION
9
+ gem.authors = ["Taylor Boyko"]
10
+ gem.email = ["taylorboyko@gmail.com"]
11
+ gem.description = %q{Apple model name lookup based on model id (apple product code)}
12
+ gem.summary = %q{}
13
+ gem.homepage = "https://github.com/tboyko/apple_models"
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+
20
+ gem.add_development_dependency('rake')
21
+ gem.add_development_dependency('rspec', '~> 2.12.0')
22
+ end
@@ -0,0 +1,3 @@
1
+ module AppleModels
2
+ VERSION = "1.0.0"
3
+ end
@@ -0,0 +1,40 @@
1
+ require 'apple_models/version'
2
+
3
+ module AppleModels
4
+ @@catalog = {
5
+ 'iPhone1,1' => 'iPhone 2G',
6
+ 'iPhone1,2' => 'iPhone 3G',
7
+ 'iPhone2,1' => 'iPhone 3GS',
8
+ 'iPhone3,1' => 'iPhone 4',
9
+ 'iPhone3,2' => 'iPhone 4', # CDMA Prototype
10
+ 'iPhone3,3' => 'iPhone 4', # CDMA
11
+ 'iPhone4,1' => 'iPhone 4S',
12
+ 'iPhone5,1' => 'iPhone 5',
13
+ 'iPhone5,2' => 'iPhone 5',
14
+ 'iProd0,1' => 'iPad', # Prototype
15
+ 'iPad1,1' => 'iPad', # WiFi and WiFi + Cellular models use same product code
16
+ 'iPad2,1' => 'iPad 2', # WiFi
17
+ 'iPad2,2' => 'iPad 2', # WiFi + Cellular, GSM
18
+ 'iPad2,3' => 'iPad 2', # WiFi + Cellular, CDMA
19
+ 'iPad2,4' => 'iPad 2', # WiFi, unannounced internal chipset change of iPad2,1
20
+ 'iPad2,5' => 'iPad Mini', # WiFi
21
+ 'iPad2,6' => 'iPad Mini', # WiFi + Cellular
22
+ 'iPad2,7' => 'iPad Mini', # WiFi + Cellular, Verizon
23
+ 'iPad3,1' => 'iPad 3',
24
+ 'iPad3,2' => 'iPad 3', # WiFi + Cellular, AT&T
25
+ 'iPad3,3' => 'iPad 3', # WiFi + Cellular, Verizon
26
+ 'iPad3,4' => 'iPad 4', # WiFi
27
+ 'iPad3,5' => 'iPad 4', # WiFi + Cellular, AT&T
28
+ 'iPad3,6' => 'iPad 4', # WiFi + Cellular, Verizon & Sprint
29
+ 'iPod1,1' => 'iPod Touch 1G',
30
+ 'iPod2,1' => 'iPod Touch 2G',
31
+ 'iPod2,2' => 'iPod Touch 3G', # Prototype
32
+ 'iPod3,1' => 'iPod Touch 3G',
33
+ 'iPod4,1' => 'iPod Touch 4G',
34
+ 'iPod5,1' => 'iPod Touch 5G'
35
+ }
36
+
37
+ def self.find(product_id)
38
+ @@catalog[product_id]
39
+ end
40
+ end
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ describe AppleModels do
4
+ it 'returns the correct model name when provided a model id' do
5
+ AppleModels.find('iPad2,7').should match 'iPad Mini'
6
+ end
7
+
8
+ it 'returns nil when an unknown model id is provided' do
9
+ AppleModels.find('iDoNotExist').should be_nil
10
+ end
11
+ end
@@ -0,0 +1,20 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # Require this file using `require "spec_helper"` to ensure that it is only
4
+ # loaded once.
5
+ #
6
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7
+
8
+ require 'apple_models'
9
+
10
+ RSpec.configure do |config|
11
+ config.treat_symbols_as_metadata_keys_with_true_values = true
12
+ config.run_all_when_everything_filtered = true
13
+ config.filter_run :focus
14
+
15
+ # Run specs in random order to surface order dependencies. If you find an
16
+ # order dependency and want to debug it, you can fix the order by providing
17
+ # the seed, which is printed after each run.
18
+ # --seed 1234
19
+ config.order = 'random'
20
+ end
metadata ADDED
@@ -0,0 +1,98 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: apple_models
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Taylor Boyko
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-02-03 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rake
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rspec
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: 2.12.0
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 2.12.0
46
+ description: Apple model name lookup based on model id (apple product code)
47
+ email:
48
+ - taylorboyko@gmail.com
49
+ executables: []
50
+ extensions: []
51
+ extra_rdoc_files: []
52
+ files:
53
+ - .gitignore
54
+ - .rspec
55
+ - .travis.yml
56
+ - Gemfile
57
+ - Gemfile.lock
58
+ - LICENSE.txt
59
+ - README.md
60
+ - Rakefile
61
+ - apple_models.gemspec
62
+ - lib/apple_models.rb
63
+ - lib/apple_models/version.rb
64
+ - spec/apple_models_spec.rb
65
+ - spec/spec_helper.rb
66
+ homepage: https://github.com/tboyko/apple_models
67
+ licenses: []
68
+ post_install_message:
69
+ rdoc_options: []
70
+ require_paths:
71
+ - lib
72
+ required_ruby_version: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ segments:
79
+ - 0
80
+ hash: 2239846394275850721
81
+ required_rubygems_version: !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ! '>='
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ segments:
88
+ - 0
89
+ hash: 2239846394275850721
90
+ requirements: []
91
+ rubyforge_project:
92
+ rubygems_version: 1.8.24
93
+ signing_key:
94
+ specification_version: 3
95
+ summary: ''
96
+ test_files:
97
+ - spec/apple_models_spec.rb
98
+ - spec/spec_helper.rb