apple_models 2.0.1 → 2.1.1
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 +4 -3
- data/lib/apple_models/device.rb +4 -3
- data/lib/apple_models/version.rb +1 -1
- data/lib/apple_models.rb +47 -45
- data/spec/apple_models_spec.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2dcf8b60030d3f25f64b4307ad5364ad3f254ef9
|
4
|
+
data.tar.gz: af01322499d4088850d7d7323cdd7e9b5653391f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dcd3483fcee95ffc8b917cce8bd438a4e6325a9c21152d178955f901d9c7165f0a976971430053291c08cace7fef6eba270f8796c9c84be4ac3699e8679669af
|
7
|
+
data.tar.gz: 9a2177b890f7cd55306253f104f177598f85efb54d606fb757851d18a0363ee2a64d8f031adf73f6c8538e54331897623fcf828bf865abc62ab9bb21f3f393c8
|
data/README.md
CHANGED
@@ -21,12 +21,13 @@ Or install it yourself as:
|
|
21
21
|
## Usage
|
22
22
|
|
23
23
|
```ruby
|
24
|
-
device = AppleModels.find('iPad2,7')
|
24
|
+
device = AppleModels.find('iPad2,7')
|
25
25
|
|
26
26
|
device.identifier # "iPad2,7"
|
27
27
|
device.model # "iPad"
|
28
|
-
device.version # "Mini
|
29
|
-
device.friendly_name # "iPad Mini
|
28
|
+
device.version # "Mini"
|
29
|
+
device.friendly_name # "iPad Mini"
|
30
|
+
device.extended # "(Global)"
|
30
31
|
```
|
31
32
|
|
32
33
|
## Contributing
|
data/lib/apple_models/device.rb
CHANGED
data/lib/apple_models/version.rb
CHANGED
data/lib/apple_models.rb
CHANGED
@@ -3,56 +3,58 @@ require 'apple_models/device'
|
|
3
3
|
|
4
4
|
module AppleModels
|
5
5
|
@@catalog = [
|
6
|
-
# identifier model version
|
7
|
-
[ 'AppleTV1,1', 'Apple TV', '1' ],
|
8
|
-
[ 'AppleTV2,1', 'Apple TV', '2' ],
|
9
|
-
[ 'AppleTV3,1', 'Apple TV', '3' ],
|
10
|
-
[ 'AppleTV3,2', 'Apple TV', '3' ],
|
11
|
-
[ '
|
12
|
-
[ '
|
13
|
-
[ '
|
14
|
-
[ '
|
15
|
-
[ '
|
16
|
-
[ '
|
17
|
-
[ '
|
18
|
-
[ '
|
19
|
-
[ '
|
20
|
-
[ '
|
21
|
-
[ '
|
22
|
-
[ '
|
23
|
-
[ '
|
24
|
-
[ '
|
25
|
-
[ '
|
26
|
-
[ '
|
27
|
-
[ '
|
28
|
-
[ '
|
29
|
-
[ '
|
30
|
-
[ '
|
31
|
-
[ '
|
32
|
-
[ '
|
33
|
-
[ '
|
34
|
-
[ '
|
35
|
-
[ '
|
36
|
-
[ '
|
37
|
-
[ '
|
38
|
-
[ '
|
39
|
-
[ '
|
40
|
-
[ '
|
41
|
-
[ '
|
42
|
-
[ '
|
43
|
-
[ '
|
44
|
-
[ '
|
45
|
-
[ 'iPod2,
|
46
|
-
[ '
|
47
|
-
[ '
|
48
|
-
[ '
|
6
|
+
# identifier model version extended
|
7
|
+
[ 'AppleTV1,1', 'Apple TV', '1', '' ],
|
8
|
+
[ 'AppleTV2,1', 'Apple TV', '2', '' ],
|
9
|
+
[ 'AppleTV3,1', 'Apple TV', '3', '' ],
|
10
|
+
[ 'AppleTV3,2', 'Apple TV', '3', '' ],
|
11
|
+
[ 'iPad1,1', 'iPad', '1', '' ],
|
12
|
+
[ 'iPad2,1', 'iPad', '2', '(WiFi)' ],
|
13
|
+
[ 'iPad2,2', 'iPad', '2', '(GSM)' ],
|
14
|
+
[ 'iPad2,3', 'iPad', '2', '(CDMA)' ],
|
15
|
+
[ 'iPad2,4', 'iPad', '2', '' ],
|
16
|
+
[ 'iPad2,5', 'iPad', 'Mini', '(WiFi)' ],
|
17
|
+
[ 'iPad2,6', 'iPad', 'Mini', '(GSM)' ],
|
18
|
+
[ 'iPad2,7', 'iPad', 'Mini', '(Global)' ],
|
19
|
+
[ 'iPad3,1', 'iPad', '3', '(WiFi)' ],
|
20
|
+
[ 'iPad3,2', 'iPad', '3', '(CDMA)' ],
|
21
|
+
[ 'iPad3,3', 'iPad', '3', '(GSM)' ],
|
22
|
+
[ 'iPad3,4', 'iPad', '4', '(WiFi)' ],
|
23
|
+
[ 'iPad3,5', 'iPad', '4', '(GSM)' ],
|
24
|
+
[ 'iPad3,6', 'iPad', '4', '(Global)' ],
|
25
|
+
[ 'iPad4,1', 'iPad', 'Air', '(WiFi)' ],
|
26
|
+
[ 'iPad4,2', 'iPad', 'Air', '(Cellular)' ],
|
27
|
+
[ 'iPad4,4', 'iPad', 'Mini Retina', '(WiFi)' ],
|
28
|
+
[ 'iPad4,5', 'iPad', 'Mini Retina', '(Cellular)' ],
|
29
|
+
[ 'iPad4,6', 'iPad', 'Mini Retina', '' ],
|
30
|
+
[ 'iPhone1,1', 'iPhone', '2G', '' ],
|
31
|
+
[ 'iPhone1,2', 'iPhone', '3G', '' ],
|
32
|
+
[ 'iPhone2,1', 'iPhone', '3GS', '' ],
|
33
|
+
[ 'iPhone3,1', 'iPhone', '4', '(GSM)' ],
|
34
|
+
[ 'iPhone3,2', 'iPhone', '4', '(GSM)' ],
|
35
|
+
[ 'iPhone3,3', 'iPhone', '4', '(CDMA)' ],
|
36
|
+
[ 'iPhone4,1', 'iPhone', '4S', '' ],
|
37
|
+
[ 'iPhone5,1', 'iPhone', '5', '(GSM)' ],
|
38
|
+
[ 'iPhone5,2', 'iPhone', '5', '(Global)' ],
|
39
|
+
[ 'iPhone5,3', 'iPhone', '5C', '(GSM)' ],
|
40
|
+
[ 'iPhone5,4', 'iPhone', '5C', '(Global)' ],
|
41
|
+
[ 'iPhone6,1', 'iPhone', '5S', '(GSM)' ],
|
42
|
+
[ 'iPhone6,2', 'iPhone', '5S', '(Global)' ],
|
43
|
+
[ 'iProd0,1', 'iPad', 'Prototype', '' ],
|
44
|
+
[ 'iPod1,1', 'iPod', 'Touch 1G', '' ],
|
45
|
+
[ 'iPod2,1', 'iPod', 'Touch 2G', '' ],
|
46
|
+
[ 'iPod2,2', 'iPod', 'Touch 3', '' ],
|
47
|
+
[ 'iPod3,1', 'iPod', 'Touch 3', '' ],
|
48
|
+
[ 'iPod4,1', 'iPod', 'Touch 4', '' ],
|
49
|
+
[ 'iPod5,1', 'iPod', 'Touch 5', '' ],
|
49
50
|
]
|
50
|
-
|
51
|
+
|
51
52
|
def self.find(product_id)
|
52
53
|
if (match = @@catalog.select { |i| i[0] == product_id }.first)
|
53
54
|
Device.new identifier: match[0],
|
54
55
|
model: match[1],
|
55
|
-
version: match[2]
|
56
|
+
version: match[2],
|
57
|
+
extended: match[3]
|
56
58
|
end
|
57
59
|
end
|
58
60
|
end
|
data/spec/apple_models_spec.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe AppleModels do
|
3
|
+
describe AppleModels do
|
4
4
|
it 'returns the correct model name when provided a model id' do
|
5
|
-
AppleModels.find('iPad2,7').friendly_name.should == 'iPad Mini
|
5
|
+
AppleModels.find('iPad2,7').friendly_name.should == 'iPad Mini'
|
6
6
|
end
|
7
|
-
|
7
|
+
|
8
8
|
it 'returns nil when an unknown model id is provided' do
|
9
9
|
AppleModels.find('iDoNotExist').should be_nil
|
10
10
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apple_models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Taylor Boyko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-03-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|