Module: Twitter

Defined in:
lib/twittermotion/user.rb,
lib/twittermotion/twitter.rb,
lib/twittermotion/version.rb,
lib/twittermotion/composer.rb

Defined Under Namespace

Classes: Composer, ComposerError, User

Constant Summary collapse

VERSION =
"0.0.2"

Class Method Summary collapse

Class Method Details

.account_storeObject



3
4
5
# File 'lib/twittermotion/twitter.rb', line 3

def 
  @account_store ||= ACAccountStore.new
end

.account_typeObject



7
8
9
# File 'lib/twittermotion/twitter.rb', line 7

def 
  @account_type ||= self..accountTypeWithAccountTypeIdentifier(ACAccountTypeIdentifierTwitter)
end

.accountsObject



11
12
13
14
15
# File 'lib/twittermotion/twitter.rb', line 11

def accounts
  @accounts ||= self..accountsWithAccountType().collect do ||
    Twitter::User.new()
  end
end

.sign_in(&block) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/twittermotion/twitter.rb', line 17

def (&block)
  @sign_in_callback = block
  self..requestAccessToAccountsWithType(self.,
      withCompletionHandler:lambda { |granted, error|
    # Reset accounts
    @accounts = nil
    Dispatch::Queue.main.sync {
      @sign_in_callback.call(granted, error)
    }
  })
end