Sha256: 2b574d6bda54864ab3dbfeb2c03b7570f1f638c1383a1355cbcadd7ef0338f6b

Contents?: true

Size: 1.93 KB

Versions: 9

Compression:

Stored size: 1.93 KB

Contents

require 't/core_ext/string'
require 't/rcfile'
require 't/requestable'
require 'thor'

module T
  class Set < Thor
    include T::Requestable

    check_unknown_options!

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

    desc "active SCREEN_NAME [CONSUMER_KEY]", "Set your active account."
    def active(screen_name, consumer_key=nil)
      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' => screen_name, 'consumer_key' => consumer_key}
      say "Active account has been updated."
    end
    map %w(default) => :active

    desc "bio DESCRIPTION", "Edits your Bio information on your Twitter profile."
    def bio(description)
      client.update_profile(:description => description, :include_entities => false)
      say "@#{@rcfile.active_profile[0]}'s bio has been updated."
    end

    desc "language LANGUAGE_NAME", "Selects the language you'd like to receive notifications in."
    def language(language_name)
      client.settings(:lang => language_name)
      say "@#{@rcfile.active_profile[0]}'s language has been updated."
    end

    desc "location PLACE_NAME", "Updates the location field in your profile."
    def location(place_name)
      client.update_profile(:location => place_name, :include_entities => false)
      say "@#{@rcfile.active_profile[0]}'s location has been updated."
    end

    desc "name NAME", "Sets the name field on your Twitter profile."
    def name(name)
      client.update_profile(:name => name, :include_entities => false)
      say "@#{@rcfile.active_profile[0]}'s name has been updated."
    end

    desc "url URL", "Sets the URL field on your profile."
    def url(url)
      client.update_profile(:url => url, :include_entities => false)
      say "@#{@rcfile.active_profile[0]}'s URL has been updated."
    end

  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
t-0.9.4 lib/t/set.rb
t-0.9.3 lib/t/set.rb
t-0.9.2 lib/t/set.rb
t-0.9.1 lib/t/set.rb
t-0.9.0 lib/t/set.rb
t-0.8.3 lib/t/set.rb
t-0.8.2 lib/t/set.rb
t-0.8.1 lib/t/set.rb
t-0.8.0 lib/t/set.rb