Class: Twpipe

Inherits:
Object
  • Object
show all
Defined in:
lib/twpipe.rb,
lib/twpipe/version.rb

Overview

Twpipe

Defined Under Namespace

Classes: ConfigError

Constant Summary collapse

MAX_TWEET_LENGTH =
140
VERSION =
'0.0.3'

Class Attribute Summary collapse

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTwpipe

Returns a new instance of Twpipe.



24
25
26
27
# File 'lib/twpipe.rb', line 24

def initialize
  setup_config
  setup_client
end

Class Attribute Details

.config_pathObject

config_path

the file path to configuration file



14
15
16
# File 'lib/twpipe.rb', line 14

def config_path
  @config_path
end

Instance Attribute Details

#clientObject (readonly)

client

twitter client that authenticated by oAuth (Twitter::Base)



22
23
24
# File 'lib/twpipe.rb', line 22

def client
  @client
end

Instance Method Details

#tweet(message) ⇒ Object

tweet your message

message: string variable that you would tweet

return:

  • message that truncated first MAX_TWEET_LENGTH characters



36
37
38
39
# File 'lib/twpipe.rb', line 36

def tweet(message)
  @client.update(message)
  message.split(//).first(MAX_TWEET_LENGTH).join
end