Sha256: 7f99ecb7fe7ad5f55772cebfda390a4e41a2c10d1a06bfc8bffb3c6c07b794dc

Contents?: true

Size: 1.92 KB

Versions: 2

Compression:

Stored size: 1.92 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 "bio DESCRIPTION", "Edits your Bio information on your Twitter profile."
    def bio(description)
      client.update_profile(:description => description, :include_entities => false)
      say "@#{@rcfile.default_profile[0]}'s bio has been updated."
    end

    desc "default SCREEN_NAME [CONSUMER_KEY]", "Set your default account."
    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

    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.default_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.default_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.default_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.default_profile[0]}'s URL has been updated."
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
t-0.5.1 lib/t/set.rb
t-0.5.0 lib/t/set.rb