ragoon 0.2.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b68e19f10c0d94b8449fc5343a2a6e494192a95c
4
- data.tar.gz: a1a42d79bf60a34ff1092b4d12e1bd58eee7a683
3
+ metadata.gz: b5f0f567bf1708c30ea8ebeb9762c69b5bfd5ec9
4
+ data.tar.gz: b9bc20acee3e5315530833e3db82c82f2cc41a0e
5
5
  SHA512:
6
- metadata.gz: 4b7cfb9605a801b1444d1b4d4faadee8612ba0c4d911091b6b47833a251d5deb85cb57dca93aa9c31c5519a2e1ca143e96bdce59d5e746b200d86f21021eba29
7
- data.tar.gz: f8afef1240b59df88a49a976eac2a57a0ce4811ce0e4c7ee32f6d07282012caa19cdfc8fcf2ba4e10a6c06385e9b7655d8a18b4fd965332bcf50951a1d207cf3
6
+ metadata.gz: 87ebedd491389ebe292c770c4c178a4a41be1ee76acf078e2a6d2c3fc5b2f5773b52b6968fd0d9f60abe887f7f7f13444a4732680542f59337a51de52eeda6a4
7
+ data.tar.gz: d797d4f97b1d2213994655bd75fc767dc86e03b1765cf52ea72a6794d68a27e1077c08cb5f29d1dde31a8a6a699e0501c6dc834a41ef65672afd75e7174ea346
data/README.md CHANGED
@@ -11,9 +11,9 @@ service = Ragoon::Services::Schedule.new
11
11
  events = service.schedule_get_event
12
12
 
13
13
  => [
14
- {:title=>"予定あり", :period=>"13:00〜14:00", :plan=>"作業", :facility=>""},
15
- {:title=>"セクションMTG", :period=>"15:00〜15:30", :plan=>"社内MTG", :facility=>["会議室"]},
16
- {:title=>"予定あり", :period=>"終日", :plan=>"", :facility=>""}
14
+ {:title=>"セクションMTG", :start_at=>"2015-11-29 15:00:00 +0900", :end_at=>"2015-11-29 15:30:00 +0900", :plan=>"社内MTG", :facilities=>["会議室1"], :private=>true, :allday=>false},
15
+ {:title=>"エンジニア共有会", :start_at=>"2015-11-29 16:00:00 +0900", :end_at=>"2015-11-29 16:30:00 +0900" :plan=>"社内MTG", :facilities=>["会議室1", "会議室2"], :private=>true, :allday=>false},
16
+ {:title=>"監査対応", :start_at=>nil, :end_at=>nil, :plan=>"作業", :facilities=>[], :private=>false, :allday=>true}
17
17
  ]
18
18
 
19
19
  ```
@@ -17,12 +17,15 @@ class Ragoon::Services::Schedule < Ragoon::Services
17
17
  client.request(action_name, body_node)
18
18
  events = client.result_set.xpath('//schedule_event').
19
19
  find_all { |ev| ev[:event_type] != 'banner' }.map do |event|
20
- public_event = event[:public_type] == 'public'
20
+ period = start_and_end(event)
21
21
  {
22
- title: public_event ? event[:detail] : '予定あり',
23
- period: start_and_end(event),
24
- plan: public_event ? event[:plan] : '',
25
- facility: public_event ? facility_names(event) : [],
22
+ title: event[:detail],
23
+ start_at: period[:start_at],
24
+ end_at: period[:end_at],
25
+ plan: event[:plan],
26
+ facilities: facility_names(event),
27
+ private: !(event[:public_type] == 'public'),
28
+ allday: event[:allday] == 'true',
26
29
  }
27
30
  end
28
31
  end
@@ -34,33 +37,41 @@ class Ragoon::Services::Schedule < Ragoon::Services
34
37
  end
35
38
 
36
39
  def start_and_end(event)
37
- if event[:allday] == 'true'
38
- '終日'
39
- else
40
+ start_at = nil
41
+ end_at = nil
42
+
43
+ unless event[:allday] == 'true'
40
44
  case event[:event_type]
41
45
  when 'normal'
42
46
  period = event.children.xpath('ev:datetime', ev: "http://schemas.cybozu.co.jp/schedule/2008").first
43
- return '' if period.nil?
44
- start_time = parse_event_time(period[:start])
45
- end_time = event[:start_only] == 'true' ? '' : parse_event_time(period[:end])
47
+ unless period.nil?
48
+ start_at = parse_event_time(period[:start])
49
+ unless event[:start_only] == 'true'
50
+ end_at = parse_event_time(period[:end])
51
+ end
52
+ end
46
53
  when 'repeat'
47
54
  repeat_info = event.xpath('ev:repeat_info', ev: 'http://schemas.cybozu.co.jp/schedule/2008').first
48
- return '' if repeat_info.nil?
49
- period = repeat_info.xpath('ev:condition', ev: 'http://schemas.cybozu.co.jp/schedule/2008').first
50
- return '' if period.nil?
51
- start_time = parse_event_time(period[:start_time])
52
- end_time = event[:start_only] == 'true' ? '' : parse_event_time(period[:end_time])
53
- else
54
- return ''
55
+ unless repeat_info.nil?
56
+ period = repeat_info.xpath('ev:condition', ev: 'http://schemas.cybozu.co.jp/schedule/2008').first
57
+ unless period.nil?
58
+ start_at = parse_event_time(period[:start_time])
59
+ unless event[:start_only] == 'true'
60
+ end_at = parse_event_time(period[:end_time])
61
+ end
62
+ end
63
+ end
55
64
  end
56
-
57
- "#{start_time}〜#{end_time}"
58
65
  end
59
- end
60
66
 
67
+ {
68
+ start_at: start_at,
69
+ end_at: end_at,
70
+ }
71
+ end
61
72
 
62
73
  def parse_event_time(time)
63
- Time.parse(time).localtime.strftime('%R')
74
+ Time.parse(time).localtime.to_s
64
75
  end
65
76
 
66
77
  def default_options(action_name)
@@ -1,3 +1,3 @@
1
1
  module Ragoon
2
- VERSION = '0.2.2'
2
+ VERSION = '0.3.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ragoon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - SHIOYA, Hiromu
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-11-27 00:00:00.000000000 Z
11
+ date: 2015-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client