apple_models 2.0.1 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c764e843356fe84401cf99c56c99d496c5bec11c
4
- data.tar.gz: 33ba9f48bb31c9bb863b52f259d3b7b18333c910
3
+ metadata.gz: 2dcf8b60030d3f25f64b4307ad5364ad3f254ef9
4
+ data.tar.gz: af01322499d4088850d7d7323cdd7e9b5653391f
5
5
  SHA512:
6
- metadata.gz: 4dd1e4a3b6e71d6e0814c5cd3bbf2b773d9d445ef282ae634f905b5f594c1cc41c3c44ae68707f7f9ca182e2c6766ab6dc95e4d2a6869c8ac11786358acbb5f7
7
- data.tar.gz: 2cc779b7d85889bee71029b06b147a0eeb957bc97a3d11b297ea56c71da61b114ac38dd9dcf8300b1919966eaf2835afacf60b2bde643a8fcbb9b9a1dfcb7fe6
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 (Global)"
29
- device.friendly_name # "iPad Mini (Global)"
28
+ device.version # "Mini"
29
+ device.friendly_name # "iPad Mini"
30
+ device.extended # "(Global)"
30
31
  ```
31
32
 
32
33
  ## Contributing
@@ -1,8 +1,9 @@
1
1
  module AppleModels
2
2
  class Device
3
- attr_reader :identifier,
4
- :model,
5
- :version
3
+ attr_reader :identifier,
4
+ :model,
5
+ :version,
6
+ :extended
6
7
 
7
8
  def initialize params
8
9
  params.each { |k,v| instance_variable_set("@#{k}", v) }
@@ -1,3 +1,3 @@
1
1
  module AppleModels
2
- VERSION = "2.0.1"
2
+ VERSION = "2.1.1"
3
3
  end
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
- [ 'iPhone1,1', 'iPhone', '2G' ],
12
- [ 'iPhone1,2', 'iPhone', '3G' ],
13
- [ 'iPhone2,1', 'iPhone', '3GS' ],
14
- [ 'iPhone3,1', 'iPhone', '4 (GSM)' ],
15
- [ 'iPhone3,2', 'iPhone', '4 (GSM)' ],
16
- [ 'iPhone3,3', 'iPhone', '4 (CDMA)' ],
17
- [ 'iPhone4,1', 'iPhone', '4S' ],
18
- [ 'iPhone5,1', 'iPhone', '5 (GSM)' ],
19
- [ 'iPhone5,2', 'iPhone', '5 (Global)' ],
20
- [ 'iPhone5,3', 'iPhone', '5C (GSM)' ],
21
- [ 'iPhone5,4', 'iPhone', '5C (Global)' ],
22
- [ 'iPhone6,1', 'iPhone', '5S (GSM)' ],
23
- [ 'iPhone6,2', 'iPhone', '5S (Global)' ],
24
- [ 'iProd0,1', 'iPad', 'Prototype' ],
25
- [ 'iPad1,1', 'iPad', '1' ],
26
- [ 'iPad2,1', 'iPad', '2 (WiFi)' ],
27
- [ 'iPad2,2', 'iPad', '2 (GSM)' ],
28
- [ 'iPad2,3', 'iPad', '2 (CDMA)' ],
29
- [ 'iPad2,4', 'iPad', '2' ],
30
- [ 'iPad2,5', 'iPad', 'Mini (WiFi)' ],
31
- [ 'iPad2,6', 'iPad', 'Mini (GSM)' ],
32
- [ 'iPad2,7', 'iPad', 'Mini (Global)' ],
33
- [ 'iPad3,1', 'iPad', '3 (WiFi)' ],
34
- [ 'iPad3,2', 'iPad', '3 (CDMA)' ],
35
- [ 'iPad3,3', 'iPad', '3 (GSM)' ],
36
- [ 'iPad3,4', 'iPad', '4 (WiFi)' ],
37
- [ 'iPad3,5', 'iPad', '4 (GSM)' ],
38
- [ 'iPad3,6', 'iPad', '4 (Global)' ],
39
- [ 'iPad4,1', 'iPad', 'Air (WiFi)' ],
40
- [ 'iPad4,2', 'iPad', 'Air (Cellular)' ],
41
- [ 'iPad4,4', 'iPad', 'Mini Retina (WiFi)' ],
42
- [ 'iPad4,5', 'iPad', 'Mini Retina (Cellular)' ],
43
- [ 'iPod1,1', 'iPod', 'Touch 1G' ],
44
- [ 'iPod2,1', 'iPod', 'Touch 2G' ],
45
- [ 'iPod2,2', 'iPod', 'Touch 3' ],
46
- [ 'iPod3,1', 'iPod', 'Touch 3' ],
47
- [ 'iPod4,1', 'iPod', 'Touch 4' ],
48
- [ 'iPod5,1', 'iPod', 'Touch 5' ],
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
@@ -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 (Global)'
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.0.1
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-02-28 00:00:00.000000000 Z
11
+ date: 2014-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake