Created
October 29, 2010 04:07
-
-
Save zonoise/652895 to your computer and use it in GitHub Desktop.
This file contains 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 'test/unit' | |
require 'atnd_api' | |
require 'pp' | |
class AtndApiTest < Test::Unit::TestCase | |
def test_search_default | |
events = AtndApi.events | |
events.each do |e| | |
puts e[:event_id] | |
puts e[:title] | |
end | |
end | |
def test_search_count_100 | |
events = AtndApi.events({'count'=>'100'}) | |
events.each do |e| | |
puts e[:event_id]+ e[:title] | |
end | |
end | |
def test_user_search | |
events = AtndApi.users({'event_id' => '8926,8361, 8939'}) | |
events.each do |e| | |
e[:users].each do |u| | |
puts u[:user_id] | |
end | |
end | |
end | |
def test_eventsearch_and_users_search | |
events = AtndApi.events('ym'=>'201009', 'count'=>'1' ,'start' =>'1') | |
events += AtndApi.events('ym'=>'201009', 'count'=>'1' ,'start' =>'101') | |
events += AtndApi.events('ym'=>'201009', 'count'=>'1' ,'start' =>'201') | |
events += AtndApi.events('ym'=>'201009', 'count'=>'1' ,'start' =>'301') | |
events += AtndApi.events('ym'=>'201009', 'count'=>'1' ,'start' =>'401') | |
ids = [] | |
events.each do |e| | |
ids << e[:event_id] | |
puts e[:started_at] | |
end | |
event_user = AtndApi.users('event_id'=> ids.join(',')) | |
event_user.each do |e| | |
puts e[:event_id].to_s + e[:title].to_s | |
e[:users].each{|u| | |
puts "-"+u[:user_id] | |
} | |
end | |
end | |
def test_eventsearch_and_users_search2 | |
events = AtndApi.events('ym'=>'201009', 'count'=> '10' ) | |
events += AtndApi.events('ym'=>'201009', 'count'=>'1') | |
events += AtndApi.events('ym'=>'201009', 'count'=>'1' ,'start' =>'201') | |
events += AtndApi.events('ym'=>'201009', 'count'=>'1') | |
events += AtndApi.events('ym'=>'201009', 'count'=>'1' ,'start' =>'401') | |
ids = [] | |
events.each do |e| | |
ids << e[:event_id] | |
puts " start #{e[:started_at]} end #{e[:ended_at].to_s}" | |
end | |
event_user = AtndApi.users('event_id'=> ids.join(',')) | |
event_user.each do |e| | |
puts e[:event_id].to_s + e[:title].to_s | |
e[:users].each{|u| | |
puts "-"+u[:user_id] | |
} | |
end | |
end | |
#一ヶ月分のデータをダウンロードする | |
def test_get_all_events_of_ym | |
events = AtndApi.month_events(:ym=>'201009') | |
puts "event.size: #{events.size}" | |
puts "event.pop: #{events.pop}" | |
end | |
#引数なしの場合、今月のデータをダウンロードする | |
def test_get_all_events_of_ym_default | |
events = AtndApi.month_events | |
puts "event.size: #{events.size}" | |
puts "event.pop: #{events.pop}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment