Class: T::CLI::Set

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

Constant Summary

Constants included from Requestable

Requestable::DEFAULT_HOST, Requestable::DEFAULT_PROTOCOL

Instance Method Summary collapse

Methods included from Requestable

#base_url, #client, #host, included, #protocol

Constructor Details

#initializeSet

Returns a new instance of Set.



13
14
15
16
# File 'lib/t/cli/set.rb', line 13

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

Instance Method Details

#bio(description) ⇒ Object



19
20
21
22
# File 'lib/t/cli/set.rb', line 19

def bio(description)
  client.update_profile(:description => description, :include_entities => false)
  say "@#{@rcfile.default_profile[0]}'s bio has been updated."
end

#default(screen_name, consumer_key = nil) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/t/cli/set.rb', line 25

def default(screen_name, consumer_key=nil)
  screen_name = screen_name.strip_at
  @rcfile.path = parent_options['profile'] if parent_options['profile']
  consumer_key = @rcfile[screen_name].keys.last if consumer_key.nil?
  @rcfile.default_profile = {'username' => screen_name, 'consumer_key' => consumer_key}
  say "Default account has been updated."
end

#language(language_name) ⇒ Object



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

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

#location(place_name) ⇒ Object



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

def location(place_name)
  client.update_profile(:location => place_name, :include_entities => false)
  say "@#{@rcfile.default_profile[0]}'s location has been updated."
end

#name(name) ⇒ Object



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

def name(name)
  client.update_profile(:name => name, :include_entities => false)
  say "@#{@rcfile.default_profile[0]}'s name has been updated."
end

#url(url) ⇒ Object



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

def url(url)
  client.update_profile(:url => url, :include_entities => false)
  say "@#{@rcfile.default_profile[0]}'s URL has been updated."
end