Created
June 18, 2013 12:44
-
-
Save dnpp73/5805035 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'Twitter' | |
require 'yaml' | |
class Ofuton | |
def self.load_yaml(yaml_path) | |
base_directory = File.dirname(File.expand_path(__FILE__)) | |
YAML.load_file(base_directory + '/' + yaml_path) | |
end | |
def self.client_info # return hash | |
self.load_yaml("yaml/Ofuton-Client.yaml") | |
end | |
def self.twitter_client(oauth_token) | |
client_info = self.client_info | |
Twitter::Client.new( | |
:consumer_key => client_info['consumer_key'], | |
:consumer_secret => client_info['consumer_secret'], | |
:oauth_token => oauth_token['oauth_token'], | |
:oauth_token_secret => oauth_token['oauth_token_secret'] | |
) | |
end | |
def self.DNPP_token | |
self.load_yaml("yaml/Ofuton-DNPP.yaml") | |
end | |
def self.DNPP # return Twitter::Client | |
self.twitter_client(self.DNPP_token) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment