Class: T::Set

Inherits:
Thor
  • Object
show all
Includes:
Requestable
Defined in:
lib/t/set.rb

Constant Summary

Constants included from RequestableAPI

RequestableAPI::BASE_URL, RequestableAPI::BASE_URL_UPLOAD, RequestableAPI::BASE_URL_V1, RequestableAPI::DEFAULT_NUM_RESULTS, RequestableAPI::FORM_HEADERS, RequestableAPI::JSON_HEADERS, RequestableAPI::MAX_PAGE, RequestableAPI::MAX_SEARCH_RESULTS, RequestableAPI::V2_LIST_FIELDS, RequestableAPI::V2_PLACE_FIELDS, RequestableAPI::V2_TWEET_EXPANSIONS, RequestableAPI::V2_TWEET_FIELDS, RequestableAPI::V2_USER_EXPANSIONS, RequestableAPI::V2_USER_FIELDS

Instance Method Summary collapse

Methods included from RequestableAPI

#setup_requestable_api!

Methods included from RequestableAPI::AccountEndpoints

#x_before_request, #x_filter, #x_sample, #x_settings, #x_trend_locations, #x_trends, #x_update_profile, #x_update_profile_background_image, #x_update_profile_image

Methods included from RequestableAPI::ListEndpoints

#x_add_list_members, #x_create_list, #x_destroy_list, #x_list, #x_list_member?, #x_list_members, #x_list_timeline, #x_lists, #x_remove_list_members

Methods included from RequestableAPI::DMEndpoints

#x_create_direct_message_event, #x_destroy_direct_message, #x_direct_message, #x_direct_messages_received, #x_direct_messages_sent

Methods included from RequestableAPI::Mutations

#x_block, #x_destroy_status, #x_favorite, #x_follow, #x_mute, #x_muted_ids, #x_report_spam, #x_retweet, #x_unblock, #x_unfavorite, #x_unfollow, #x_unmute

Methods included from RequestableAPI::TweetEndpoints

#x_favorites, #x_home_timeline, #x_mentions, #x_retweeted_by_me, #x_retweeted_by_user, #x_retweeters_ids, #x_retweets_of_me, #x_search, #x_status, #x_update, #x_update_with_media, #x_user_timeline

Methods included from RequestableAPI::UserEndpoints

#x_follower_ids, #x_friend_ids, #x_friendship?, #x_user, #x_user_search, #x_users, #x_verify_credentials

Constructor Details

#initializeSet

Returns a new instance of Set.



11
12
13
14
# File 'lib/t/set.rb', line 11

def initialize(*)
  @rcfile = T::RCFile.instance
  super
end

Instance Method Details

#active(screen_name, consumer_key = nil) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/t/set.rb', line 17

def active(screen_name, consumer_key = nil)
  screen_name = screen_name.tr("@", "")
  @rcfile.path = options["profile"] if options["profile"]
  consumer_key = @rcfile[screen_name].keys.last if consumer_key.nil?
  @rcfile.active_profile = {"username" => @rcfile[screen_name][consumer_key]["username"], "consumer_key" => consumer_key}
  say "Active account has been updated to #{@rcfile.active_profile[0]}."
end

#bio(description) ⇒ Object



27
28
29
30
# File 'lib/t/set.rb', line 27

def bio(description)
  x_update_profile(description:)
  say "@#{@rcfile.active_profile[0]}'s bio has been updated."
end

#language(language_name) ⇒ Object



33
34
35
36
# File 'lib/t/set.rb', line 33

def language(language_name)
  x_settings(lang: language_name)
  say "@#{@rcfile.active_profile[0]}'s language has been updated."
end

#location(place_name) ⇒ Object



39
40
41
42
# File 'lib/t/set.rb', line 39

def location(place_name)
  x_update_profile(location: place_name)
  say "@#{@rcfile.active_profile[0]}'s location has been updated."
end

#name(name) ⇒ Object



45
46
47
48
# File 'lib/t/set.rb', line 45

def name(name)
  x_update_profile(name:)
  say "@#{@rcfile.active_profile[0]}'s name has been updated."
end

#profile_background_image(file) ⇒ Object



52
53
54
55
# File 'lib/t/set.rb', line 52

def profile_background_image(file)
  x_update_profile_background_image(File.new(File.expand_path(file)), tile: options["tile"], skip_status: true)
  say "@#{@rcfile.active_profile[0]}'s background image has been updated."
end

#profile_image(file) ⇒ Object



59
60
61
62
# File 'lib/t/set.rb', line 59

def profile_image(file)
  x_update_profile_image(File.new(File.expand_path(file)))
  say "@#{@rcfile.active_profile[0]}'s image has been updated."
end

#website(uri) ⇒ Object



66
67
68
69
# File 'lib/t/set.rb', line 66

def website(uri)
  x_update_profile(url: uri)
  say "@#{@rcfile.active_profile[0]}'s website has been updated."
end