index.rb in the-city-admin-0.2.0 vs index.rb in the-city-admin-0.2.1
- old
+ new
@@ -3,45 +3,87 @@
#
# @package TheCity::Admin
# @authors Robbie Lieb <robbie@onthecity.org>, Wes Hays <wes@onthecity.org>
# *******************************************
-# TCA_ENV = 'development'
-# THE_CITY_ADMIN_PATH = 'http://api.devthecity.org:9292'
+TCA_ENV = 'development'
+THE_CITY_ADMIN_PATH = 'http://api.devthecity.org:9292'
require 'ruby-debug'
require File.dirname(__FILE__) + '/lib/the_city_admin.rb'
# key = '66c59e2ee24553e7237259e30b4c17365681b95c'
# token = 'a9ae4af3c3e80102'
-key = '2bcee1fdccd31f1ef35a7c6708daf5a446a61ee2'
-token = 'e37ae7fb2042a17a'
+key = 'cf2903151e3213e66fd8080c7d8b65b1d6ccdd31'
+token = '5c88b32edda7653c'
TheCity::AdminApi.connect(key, token)
puts "-----------------------------"
-puts "##### FUNDS / DONATIONS / PLEDGES #######"
+puts "##### Web Hooks #######"
puts "-----------------------------"
+web_hooks = TheCity::WebHookList.new({:page => 1})
+web_hooks.each do |hook|
+ puts hook.inspect
+end
+web_hook1 = TheCity::WebHook.new({:callback_uri => 'https://www.somedomain.com/city/callbacks/fund/create',
+ :object => TheCity::WebHook::Objects[:fund],
+ :event => TheCity::WebHook::Events[:create]})
+
+web_hook2 = TheCity::WebHook.new({:callback_uri => 'https://www.somedomain.com/city/callbacks/pledge/create',
+ :object => TheCity::WebHook::Objects[:pledge],
+ :event => TheCity::WebHook::Events[:create]})
+
+web_hook3 = TheCity::WebHook.new({:callback_uri => 'https://www.somedomain.com/city/callbacks/donation/create',
+ :object => TheCity::WebHook::Objects[:donation],
+ :event => TheCity::WebHook::Events[:create]})
+
+puts web_hook1.save ? 'Web Hook saved' : 'Web Hook failed'
+puts web_hook2.save ? 'Web Hook saved' : 'Web Hook failed'
+puts web_hook3.save ? 'Web Hook saved' : 'Web Hook failed'
+
+# web_hooks = TheCity::WebHookList.new({:page => 1})
+# web_hooks.each do |hook|
+# puts hook.inspect
+# puts hook.delete
+# end
+
+
+# puts "-----------------------------"
+# puts "##### Invitations #######"
+# puts "-----------------------------"
+
+# invitation_list = TheCity::InvitationList.new({:page => 1})
+
+# invitation_list.each do |invitation|
+# puts invitation.inspect
+# end
+
+# puts "-----------------------------"
+# puts "##### FUNDS / DONATIONS / PLEDGES #######"
+# puts "-----------------------------"
+
+
# donation_list = TheCity::DonationList.new({:page => 1, :include_details => 1, :start_date => '2012-09-01', :end_date => '2012-09-30'})
# donation_list.each do |donation|
# puts [donation.user_name, donation.amount].join(' :: ')
# end
-fund_list = TheCity::FundList.new({:page => 1})
+# fund_list = TheCity::FundList.new({:page => 1})
-fund_list.each do |fund|
- puts [fund.id, fund.name].join(' :: ')
-end
+# fund_list.each do |fund|
+# puts [fund.id, fund.name].join(' :: ')
+# end
-sfund = TheCity::Fund.load_fund_by_id(fund_list.first.id)
+# sfund = TheCity::Fund.load_fund_by_id(fund_list.first.id)
-puts [sfund.id, sfund.name].join(' :-: ')
+# puts [sfund.id, sfund.name].join(' :-: ')
# done = false
# page = 1
# count = 0