master
 1class TwitterSpike
 2  def run
 3    @account_repository = ACAccountStore.alloc.init
 4    @twitter_account_type = @account_repository.accountTypeWithAccountTypeIdentifier ACAccountTypeIdentifierTwitter
 5    @account_repository.requestAccessToAccountsWithType @twitter_account_type, options:nil, completion: lambda { |granted, error|
 6      if granted
 7        @accounts = @account_repository.accountsWithAccountType @twitter_account_type
 8        p "ID: #{@accounts.first.accountProperties['user_id']} #{@accounts.first.username}"
 9
10        puts "GRANTED ACCESS"
11      else
12        puts "NOT GRANTED"
13      end
14    }
15  end
16end