Skip to content

Instantly share code, notes, and snippets.

@dnpp73
Created June 18, 2013 12:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dnpp73/5805035 to your computer and use it in GitHub Desktop.
Save dnpp73/5805035 to your computer and use it in GitHub Desktop.
#!/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