require 'lib/rme2day' module Me2DAY class Expo attr_accessor :id attr_accessor :api_key attr_accessor :person def initialize(id = nil, api_key = nil) @id = id @api_key = api_key Rme2day::API.setup(@id, @api_key, '828e442ceea1ecdbc7db09d644ae69e9') @person = Rme2day::Person.get(@id) end def get_posts # 언빌리어블! 이쯔 베리 이지! @person.recent_posts.each { |post| post.print } unless @person.nil? end def write_post puts "내용을 입력하세요" body = gets puts "태그를 입력하세요" tags = gets puts "아이콘 번호를 선택하세요" icon = gets post = Rme2day::Post.create(body,tags,icon.to_i) post.print end def get_friends @person.friends.each do |friend| puts "#{friend.to_s}:#{friend.nickname}" end end def usage 8.times { print "=" } puts "\n1. 최근글 가져오기" puts "2. 글 작성" puts "3. 친구 보기" puts "4. 그만 하기" 8.times { print "=" } print "\n>> " end def start usage while line = gets case line.to_i when 1 get_posts when 2 write_post when 3 get_friends when 4 break end usage end end end end print "me2day id: " id = gets.strip print "me2day api_key: " api_key = gets.strip console = Me2DAY::Expo.new(id,api_key) console.start