Class: Twitter::User
- Inherits:
-
Object
- Object
- Twitter::User
- Defined in:
- lib/twittermotion/user.rb
Instance Attribute Summary collapse
-
#ac_account ⇒ Object
Returns the value of attribute ac_account.
Instance Method Summary collapse
-
#compose(options = {}, &block) ⇒ Object
user.compose(tweet: ‘initial tweet’, images: [ui_image, ui_image], urls: [“http://”, ns_url, …]) do |composer|.
-
#get_timeline(options = {}, &block) ⇒ Object
user.get_timeline(include_entities: 1) do |hash, ns_error| end.
-
#initialize(ac_account) ⇒ User
constructor
A new instance of User.
- #username ⇒ Object
Constructor Details
#initialize(ac_account) ⇒ User
Returns a new instance of User.
5 6 7 |
# File 'lib/twittermotion/user.rb', line 5 def initialize(ac_account) self.ac_account = ac_account end |
Instance Attribute Details
#ac_account ⇒ Object
Returns the value of attribute ac_account.
3 4 5 |
# File 'lib/twittermotion/user.rb', line 3 def ac_account @ac_account end |
Instance Method Details
#compose(options = {}, &block) ⇒ Object
user.compose(tweet: ‘initial tweet’, images: [ui_image, ui_image],
urls: ["http://", ns_url, ...]) do |composer|
end
17 18 19 20 21 22 |
# File 'lib/twittermotion/user.rb', line 17 def compose( = {}, &block) @composer = Twitter::Composer.new @composer.compose() do |composer| block.call(composer) end end |
#get_timeline(options = {}, &block) ⇒ Object
user.get_timeline(include_entities: 1) do |hash, ns_error| end
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/twittermotion/user.rb', line 26 def get_timeline( = {}, &block) url = NSURL.URLWithString("http://api.twitter.com/1/statuses/home_timeline.json") request = TWRequest.alloc.initWithURL(url, parameters:, requestMethod:TWRequestMethodGET) request.account = self.ac_account request.performRequestWithHandler(lambda {|response_data, url_response, error| if !response_data block.call(nil, error) else block.call(BubbleWrap::JSON.parse(response_data), nil) end }) end |
#username ⇒ Object
9 10 11 |
# File 'lib/twittermotion/user.rb', line 9 def username self.ac_account.username end |