Class: T::Set

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

Instance Method Summary collapse

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
24
# File 'lib/t/set.rb', line 17

def active(screen_name, consumer_key = nil)
  require "t/core_ext/string"
  screen_name = screen_name.strip_ats
  @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



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

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

#language(language_name) ⇒ Object



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

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

#location(place_name) ⇒ Object



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

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

#name(name) ⇒ Object



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

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

#profile_background_image(file) ⇒ Object



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

def profile_background_image(file)
  client.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



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

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

#website(uri) ⇒ Object



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

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