lib/ragoon/services/schedule.rb in ragoon-0.2.0 vs lib/ragoon/services/schedule.rb in ragoon-0.2.1
- old
+ new
@@ -5,22 +5,25 @@
options = default_options(action_name).merge(options)
body_node = Ragoon::XML.create_node(action_name)
parameter_node = Ragoon::XML.create_node(
'parameters',
- start: options[:start].strftime('%FT%T'),
- end: options[:end].strftime('%FT%T')
+ start: options[:start].strftime('%FT%T'),
+ end: options[:end].strftime('%FT%T'),
+ start_for_daily: options[:start].strftime('%F'),
+ end_for_daily: options[:end].strftime('%F'),
)
body_node.add_child(parameter_node)
client.request(action_name, body_node)
-
- events = client.result_set.xpath('//schedule_event').find_all { |ev| ev[:event_type] == 'normal' }.map do |event|
+ events = client.result_set.xpath('//schedule_event').
+ find_all { |ev| ev[:event_type] != 'banner' }.map do |event|
public_event = event[:public_type] == 'public'
{
title: public_event ? event[:detail] : '予定あり',
period: start_and_end(event),
+ plan: public_event ? event[:plan] : '',
facility: public_event ? facility_names(event) : [],
}
end
end
@@ -34,10 +37,10 @@
if event[:allday] == 'true'
'終日'
else
period = event.children.xpath('ev:datetime', ev: "http://schemas.cybozu.co.jp/schedule/2008").first
- return 'error' if period.nil?
+ return '' if period.nil?
start_time = Time.parse(period[:start]).localtime.strftime('%R')
end_time = event[:start_only] == 'true' ? '' : Time.parse(period[:end]).localtime.strftime('%R')
"#{start_time}〜#{end_time}"
end