Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #244 from aamerabbas/list_member_added
Adding action for list_member_added
- Loading branch information
Showing
3 changed files
with
45 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
require 'twitter/action' | ||
require 'twitter/list' | ||
require 'twitter/user' | ||
|
||
module Twitter | ||
class ListMemberAdded < Twitter::Action | ||
lazy_attr_reader :target_objects | ||
|
||
# A collection of users who added to the list | ||
# | ||
# @return [Array<Twitter::User>] | ||
def sources | ||
@sources = Array(@attrs['sources']).map do |user| | ||
Twitter::User.new(user) | ||
end | ||
end | ||
|
||
# A collection of lists that were added to | ||
# | ||
# @return [Array<Twitter::List>] | ||
def target_objects | ||
@target_objects = Array(@attrs['target_objects']).map do |list| | ||
Twitter::List.new(list) | ||
end | ||
end | ||
|
||
# A collection of users who were added to the list | ||
# | ||
# @return [Array<Twitter::User>] | ||
def targets | ||
@targets = Array(@attrs['targets']).map do |user| | ||
Twitter::User.new(user) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters