motion-addressbook 0.1.2 → 0.1.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 CHANGED
@@ -42,7 +42,7 @@ else
42
42
  end
43
43
 
44
44
  # ask the user to authorize us
45
- if AddressBook.authorize
45
+ if AddressBook.request_authorization
46
46
  # do something now that the user has said "yes"
47
47
  else
48
48
  # do something now that the user has said "no"
@@ -53,7 +53,7 @@ end
53
53
 
54
54
  ```ruby
55
55
  # ask the user to authorize us
56
- if AddressBook.authorize do |granted|
56
+ if AddressBook.request_authorization do |granted|
57
57
  # this block is invoked sometime later
58
58
  if granted
59
59
  # do something now that the user has said "yes"
@@ -1,5 +1,5 @@
1
1
  module Motion
2
2
  module Addressbook
3
- VERSION = "0.1.2"
3
+ VERSION = "0.1.3"
4
4
  end
5
5
  end
@@ -11,9 +11,9 @@ module AddressBook
11
11
 
12
12
  def ios6_create
13
13
  error = nil
14
- address_book = ABAddressBookCreateWithOptions(nil, error)
14
+ @address_book = ABAddressBookCreateWithOptions(nil, error)
15
15
  request_authorization unless authorized?
16
- address_book
16
+ @address_book
17
17
  end
18
18
 
19
19
  def ios5_create
@@ -21,14 +21,14 @@ module AddressBook
21
21
  end
22
22
 
23
23
  def request_authorization(&block)
24
- synchronous = !!block
24
+ synchronous = !block
25
25
  access_callback = lambda { |granted, error|
26
26
  # not sure what to do with error ... so we're ignoring it
27
27
  @address_book_access_granted = granted
28
28
  block.call(@address_book_access_granted) unless block.nil?
29
29
  }
30
30
 
31
- ABAddressBookRequestAccessWithCompletion address_book, access_callback
31
+ ABAddressBookRequestAccessWithCompletion @address_book, access_callback
32
32
  if synchronous
33
33
  # Wait on the asynchronous callback before returning.
34
34
  while @address_book_access_granted.nil? do
@@ -14,7 +14,10 @@ module AddressBook
14
14
  end
15
15
 
16
16
  def self.all
17
- people = ABAddressBookCopyArrayOfAllPeople(AddressBook.address_book).map do |ab_person|
17
+ ab_people = ABAddressBookCopyArrayOfAllPeople(AddressBook.address_book)
18
+ return [] if ab_people.nil?
19
+
20
+ people = ab_people.map do |ab_person|
18
21
  new({}, ab_person)
19
22
  end
20
23
  people.sort! { |a,b| "#{a.first_name} #{a.last_name}" <=> "#{b.first_name} #{b.last_name}" }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motion-addressbook
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-08 00:00:00.000000000 Z
12
+ date: 2012-12-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bubble-wrap
@@ -98,7 +98,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
98
98
  version: '0'
99
99
  segments:
100
100
  - 0
101
- hash: 4255124381672907442
101
+ hash: 3022419534463303493
102
102
  required_rubygems_version: !ruby/object:Gem::Requirement
103
103
  none: false
104
104
  requirements:
@@ -107,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
107
  version: '0'
108
108
  segments:
109
109
  - 0
110
- hash: 4255124381672907442
110
+ hash: 3022419534463303493
111
111
  requirements: []
112
112
  rubyforge_project:
113
113
  rubygems_version: 1.8.24