Class: Twpipe
- Inherits:
-
Object
- Object
- Twpipe
- 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
-
.config_path ⇒ Object
- config_path
-
the file path to configuration file.
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
- client
-
twitter client that authenticated by oAuth (Twitter::Base).
Instance Method Summary collapse
-
#initialize ⇒ Twpipe
constructor
A new instance of Twpipe.
-
#tweet(message) ⇒ Object
tweet your message.
Constructor Details
#initialize ⇒ Twpipe
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_path ⇒ Object
- 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
#client ⇒ Object (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() @client.update() .split(//).first(MAX_TWEET_LENGTH).join end |