aladtec 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: cf23e84f98683bba046f331784f14449fb0b3cc2
4
+ data.tar.gz: a40302dee0b22a2d2d0ed211334458aa41d36943
5
+ SHA512:
6
+ metadata.gz: a2c3f502b90585531bb740bb334ce87bbf25e871123db10831241faaeac0e2fdc53a7ec5fa24d86539f3dfd70ba0eab0d94dbd053f601880bfca6c0a434b1d97
7
+ data.tar.gz: 4e9596d8bd4b181c622714325775caf2e061fbdc41c987a7da07633624c3186940cc5c42afbd2487427f6fdee9c8cf5337cc1a1254579e088c1fa40b7c472c1e
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.0
4
+ - 2.0.0
5
+ - 1.9.3
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in aladtec.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Travis Dahlke
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,30 @@
1
+ # Aladtec
2
+ [![Build Status](https://travis-ci.org/travisdahlke/aladtec.svg)](https://travis-ci.org/travisdahlke/aladtec)
3
+
4
+ A Ruby client library for the Aladtec FireManager API.
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ gem 'aladtec'
11
+
12
+ And then execute:
13
+
14
+ $ bundle
15
+
16
+ Or install it yourself as:
17
+
18
+ $ gem install aladtec
19
+
20
+ ## Usage
21
+
22
+ TODO: Write usage instructions here
23
+
24
+ ## Contributing
25
+
26
+ 1. Fork it ( http://github.com/travisdahlke/aladtec/fork )
27
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
28
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
29
+ 4. Push to the branch (`git push origin my-new-feature`)
30
+ 5. Create new Pull Request
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'aladtec/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "aladtec"
8
+ spec.version = Aladtec::VERSION
9
+ spec.authors = ["Travis Dahlke"]
10
+ spec.email = ["dahlke.travis@gmail.com"]
11
+ spec.summary = %q{Client library for the Aladtec API}
12
+ spec.description = %q{Retrieve schedules and events from the Aladtec API. Works with EMS Manager, Fire Manager, Zanager.}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.5"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "rspec"
24
+ spec.add_development_dependency "webmock"
25
+ spec.add_development_dependency "pry"
26
+
27
+ spec.add_dependency "rest-client", "~> 1.6.7"
28
+ spec.add_dependency "happymapper", "~> 0.4.1"
29
+ end
@@ -0,0 +1,7 @@
1
+ require "aladtec/version"
2
+ require "aladtec/configuration"
3
+ require "aladtec/client"
4
+
5
+ module Aladtec
6
+ extend Configuration
7
+ end
@@ -0,0 +1,87 @@
1
+ require 'rest-client'
2
+ require 'aladtec/event'
3
+ require 'aladtec/member'
4
+ require 'aladtec/range'
5
+ require 'aladtec/schedule'
6
+ require 'aladtec/range_denormalizer'
7
+
8
+ module Aladtec
9
+ class Client
10
+
11
+ attr_accessor *Configuration::VALID_CONFIG_KEYS
12
+
13
+ def initialize(options={})
14
+ merged_options = Aladtec.options.merge(options)
15
+
16
+ Configuration::VALID_CONFIG_KEYS.each do |key|
17
+ public_send("#{key}=", merged_options[key])
18
+ end
19
+ end
20
+
21
+ # Public: Get a list of events for a date or range of dates
22
+ #
23
+ # options - The Hash options used to refine the selection (default: {}):
24
+ # :begin_date - The begin date to return events for (required).
25
+ # :end_date - The end date to return events for (optional).
26
+ def events(options = {})
27
+ bd = options.fetch(:begin_date) { raise "You must supply a :begin_date option!"}
28
+ ed = options.fetch(:end_date, nil)
29
+ bd = bd.is_a?(Date) ? bd.iso8601 : Date.parse(bd).iso8601
30
+ if ed
31
+ ed = ed.is_a?(Date) ? ed.iso8601 : Date.parse(ed).iso8601
32
+ end
33
+ response = request(:getEvents, bd: bd, ed: ed)
34
+ Event.parse(response.body)
35
+ end
36
+
37
+ # Public: Get a list of members
38
+ #
39
+ def members
40
+ response = request(:getMembers)
41
+ Member.parse(response.body)
42
+ end
43
+
44
+ # Public: Get a list of schedules
45
+ #
46
+ def schedules
47
+ response = request(:getSchedules, isp: 1)
48
+ Schedule.parse(response.body)
49
+ end
50
+
51
+ # Public: Get list of members scheduled now
52
+ def scheduled_now
53
+ response = request(:getScheduledTimeNow, isp: 1)
54
+ Schedule.parse(response.body)
55
+ end
56
+
57
+ # Public: Get list of members scheduled in a time range
58
+ #
59
+ # options - The Hash options used to refine the selection (default: {}):
60
+ # :begin_time - The begin time to return events for (required).
61
+ # :end_time - The end time to return events for (required).
62
+ def scheduled_range(options = {})
63
+ bt = options.fetch(:begin_time) { raise "You must supply a :begin_time!"}
64
+ et = options.fetch(:end_time) { raise "You must supply an :end_time!"}
65
+ bt = bt.is_a?(Time) ? bt.utc.iso8601 : Time.parse(bt).utc.iso8601
66
+ et = et.is_a?(Time) ? et.utc.iso8601 : Time.parse(et).utc.iso8601
67
+ response = request(:getScheduledTimeRanges, bt: bt, et: et, isp: 1)
68
+ denormalize_ranges(Range.parse(response.body))
69
+ end
70
+
71
+ def denormalize_ranges(ranges, klass = RangeDenormalizer)
72
+ klass.new(schedules: schedules, members: members).denormalize(ranges)
73
+ end
74
+
75
+ def auth_params
76
+ {accid: acc_id, acckey: acc_key, cusid: cus_id}
77
+ end
78
+ private :auth_params
79
+
80
+ def request(cmd, options = {})
81
+ post_params = options.merge(cmd: cmd)
82
+ RestClient.post(endpoint, auth_params.merge(post_params), user_agent: user_agent, accept: :xml)
83
+ end
84
+ private :request
85
+
86
+ end
87
+ end
@@ -0,0 +1,39 @@
1
+ module Aladtec
2
+ module Configuration
3
+ VALID_CONNECTION_KEYS = [:endpoint, :method, :user_agent].freeze
4
+ VALID_OPTIONS_KEYS = [:acc_id, :acc_key, :cus_id].freeze
5
+ VALID_CONFIG_KEYS = VALID_CONNECTION_KEYS + VALID_OPTIONS_KEYS
6
+
7
+ DEFAULT_ENDPOINT = 'https://secure.emsmanager.net/api/index.php'
8
+ DEFAULT_METHOD = :post
9
+ DEFAULT_USER_AGENT = "Aladtec API Ruby Gem #{Aladtec::VERSION}".freeze
10
+
11
+ DEFAULT_ACC_ID = nil
12
+ DEFAULT_ACC_KEY = nil
13
+ DEFAULT_CUS_ID = nil
14
+
15
+ attr_accessor *VALID_CONFIG_KEYS
16
+
17
+ def self.extended(base)
18
+ base.reset
19
+ end
20
+
21
+ def reset
22
+ self.endpoint = DEFAULT_ENDPOINT
23
+ self.method = DEFAULT_METHOD
24
+ self.user_agent = DEFAULT_USER_AGENT
25
+
26
+ self.acc_id = DEFAULT_ACC_ID
27
+ self.acc_key = DEFAULT_ACC_KEY
28
+ self.cus_id = DEFAULT_CUS_ID
29
+ end
30
+
31
+ def configure
32
+ yield self
33
+ end
34
+
35
+ def options
36
+ Hash[ * VALID_CONFIG_KEYS.map { |key| [key, public_send(key)] }.flatten ]
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,14 @@
1
+ require 'happymapper'
2
+
3
+ module Aladtec
4
+ class Event
5
+ include HappyMapper
6
+
7
+ tag 'event'
8
+ element :title, String
9
+ element :description, String
10
+ element :location, String
11
+ element :begin, Time
12
+ element :end, Time
13
+ end
14
+ end
@@ -0,0 +1,11 @@
1
+ require 'happymapper'
2
+
3
+ module Aladtec
4
+ class Member
5
+ include HappyMapper
6
+
7
+ tag 'member'
8
+ attribute :id, Integer
9
+ element :name, String
10
+ end
11
+ end
@@ -0,0 +1,13 @@
1
+ require 'happymapper'
2
+ require 'aladtec/member'
3
+
4
+ module Aladtec
5
+ class Position
6
+ include HappyMapper
7
+
8
+ tag 'position'
9
+ element :name, String
10
+ attribute :id, Integer
11
+ has_one :member, Member
12
+ end
13
+ end
@@ -0,0 +1,17 @@
1
+ require 'happymapper'
2
+ require 'aladtec/schedule'
3
+ require 'aladtec/position'
4
+ require 'aladtec/member'
5
+
6
+ module Aladtec
7
+ class Range
8
+ include HappyMapper
9
+
10
+ tag 'range'
11
+ has_one :schedule, Schedule
12
+ has_one :position, Position
13
+ has_one :member, Member
14
+ element :begin, Time
15
+ element :end, Time
16
+ end
17
+ end
@@ -0,0 +1,50 @@
1
+ module Aladtec
2
+ class RangeDenormalizer
3
+ attr_reader :members, :schedules
4
+
5
+ def initialize(attrs = {})
6
+ @members = attrs.fetch(:members) { raise "You must provide the members" }
7
+ @schedules = attrs.fetch(:schedules) { raise "You must provide the schedules" }
8
+ end
9
+
10
+ def denormalize(ranges)
11
+ ranges.each do |range|
12
+ find_member(range)
13
+ find_schedule(range)
14
+ find_position(range)
15
+ range.position = positions_by_id[range.position.id] || range.position
16
+ end
17
+ end
18
+
19
+ def find_member(range)
20
+ member = members_by_id[range.member.id]
21
+ range.member = member if member
22
+ end
23
+
24
+ def find_schedule(range)
25
+ schedule = schedules_by_id[range.schedule.id]
26
+ range.schedule = schedule if schedule
27
+ end
28
+
29
+ def find_position(range)
30
+ position = positions_by_id[range.position.id]
31
+ range.position = position if position
32
+ end
33
+
34
+ def members_by_id
35
+ @members_by_id ||= members.reduce({}) {|h, member| h[member.id] = member; h}
36
+ end
37
+
38
+ def schedules_by_id
39
+ @schedules_by_id ||= schedules.reduce({}) do |h, schedule|
40
+ h[schedule.id] = schedule
41
+ schedule.positions.each {|position| positions_by_id[position.id] ||= position}
42
+ h
43
+ end
44
+ end
45
+
46
+ def positions_by_id
47
+ @positions_by_id ||= {}
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,13 @@
1
+ require 'happymapper'
2
+ require 'aladtec/position'
3
+
4
+ module Aladtec
5
+ class Schedule
6
+ include HappyMapper
7
+
8
+ tag 'schedule'
9
+ has_many :positions, Position
10
+ element :name, String
11
+ attribute :id, Integer
12
+ end
13
+ end
@@ -0,0 +1,3 @@
1
+ module Aladtec
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,7 @@
1
+ require_relative File.join('..','spec_helper')
2
+
3
+ describe Aladtec do
4
+ it 'should have a version' do
5
+ expect(Aladtec::VERSION).not_to be_nil
6
+ end
7
+ end
@@ -0,0 +1,194 @@
1
+ require_relative File.join('..','spec_helper')
2
+
3
+ describe Aladtec::Client do
4
+ let(:valid_keys) do
5
+ Aladtec::Configuration::VALID_CONFIG_KEYS
6
+ end
7
+
8
+ describe "#members" do
9
+ let(:members) { subject.members }
10
+ before(:each) do
11
+ stub_request(:post, "https://secure.emsmanager.net/api/index.php").
12
+ with(body: hash_including({cmd: "getMembers"})).
13
+ to_return(body: fixture('get_members.xml'))
14
+ end
15
+ it "returns a list of members" do
16
+ expect(members.length).to eq(3)
17
+ end
18
+
19
+ let(:john) { members.first }
20
+ it "returns members with names" do
21
+ expect(john.name).to eq("John Anderson")
22
+ end
23
+ it "returns members with ids" do
24
+ expect(john.id).to eq(32)
25
+ end
26
+ end
27
+
28
+ describe "#events" do
29
+ let(:events) { subject.events(begin_date: Date.today)}
30
+ before(:each) do
31
+ stub_request(:post, "https://secure.emsmanager.net/api/index.php").
32
+ with(body: hash_including({cmd: "getEvents"})).
33
+ to_return(body: fixture('get_events.xml'))
34
+ end
35
+ it "returns a list of events" do
36
+ expect(events.length).to eq(2)
37
+ end
38
+
39
+ let(:event) { events.first }
40
+ it "returns events with title" do
41
+ expect(event.title).to eq("Game Night")
42
+ end
43
+
44
+ it "returns events with a description" do
45
+ expect(event.description).to eq("Play games until the sun comes up!")
46
+ end
47
+
48
+ it "returns events with location" do
49
+ expect(event.location).to eq("Public Library")
50
+ end
51
+
52
+ it "returns events with begin date" do
53
+ expect(event.begin).to eq(Time.parse("2012-04-20"))
54
+ end
55
+
56
+ it "returns events with end date" do
57
+ expect(event.end).to eq(Time.parse("2012-04-21 15:30:00 UTC"))
58
+ end
59
+ end
60
+
61
+ describe "#schedules" do
62
+ let(:schedules) { subject.schedules }
63
+ before(:each) do
64
+ stub_request(:post, "https://secure.emsmanager.net/api/index.php").
65
+ with(body: hash_including({cmd: "getSchedules"})).
66
+ to_return(body: fixture('get_schedules.xml'))
67
+ end
68
+ it "returns a list of schedules" do
69
+ expect(schedules.length).to eq(5)
70
+ end
71
+
72
+ let(:schedule) { schedules.first }
73
+ it "returns schedules with names" do
74
+ expect(schedule.name).to eq("Sample BLS - 24/48")
75
+ end
76
+
77
+ it "returns schedules with ids" do
78
+ expect(schedule.id).to eq(5)
79
+ end
80
+ end
81
+
82
+ describe "#scheduled_now" do
83
+ let(:schedules) { subject.scheduled_now }
84
+ before(:each) do
85
+ stub_request(:post, "https://secure.emsmanager.net/api/index.php").
86
+ with(body: hash_including({cmd: "getScheduledTimeNow"})).
87
+ to_return(body: fixture('get_scheduled_time_now.xml'))
88
+ end
89
+ it "returns a list of scheduled time now" do
90
+ expect(schedules.length).to eq(2)
91
+ end
92
+
93
+ let(:schedule) { schedules.first }
94
+ it "returns schedules with ids" do
95
+ expect(schedule.id).to eq(5)
96
+ end
97
+
98
+ it "returns schedules with positions" do
99
+ expect(schedule.positions.length).to eq(2)
100
+ end
101
+ end
102
+
103
+ describe "#scheduled_range" do
104
+ let(:ranges) { subject.scheduled_range(begin_time: Time.now, end_time: Time.now) }
105
+ before(:each) do
106
+ stub_request(:post, "https://secure.emsmanager.net/api/index.php").
107
+ with(body: hash_including({cmd: "getScheduledTimeRanges"})).
108
+ to_return(body: fixture('get_scheduled_time_ranges.xml'))
109
+ stub_request(:post, "https://secure.emsmanager.net/api/index.php").
110
+ with(body: hash_including({cmd: "getMembers"})).
111
+ to_return(body: fixture('get_members.xml'))
112
+ stub_request(:post, "https://secure.emsmanager.net/api/index.php").
113
+ with(body: hash_including({cmd: "getSchedules"})).
114
+ to_return(body: fixture('get_schedules.xml'))
115
+ end
116
+ it "returns a list of scheduled ranges" do
117
+ expect(ranges.length).to eq(3)
118
+ end
119
+
120
+ let(:range) { ranges.first }
121
+ it "returns ranges with a begin time" do
122
+ expect(range.begin).to eq(Time.parse("2010-03-20T03:30:00Z"))
123
+ end
124
+
125
+ it "returns ranges with a end time" do
126
+ expect(range.end).to eq(Time.parse("2010-03-20T11:30:00Z"))
127
+ end
128
+
129
+ it "returns ranges with a member id" do
130
+ expect(range.member.id).to eq(42)
131
+ end
132
+
133
+ it "returns ranges with a position id" do
134
+ expect(range.position.id).to eq(1)
135
+ end
136
+
137
+ it "returns ranges with a schedule id" do
138
+ expect(range.schedule.id).to eq(5)
139
+ end
140
+ end
141
+
142
+ context 'with module configuration' do
143
+ before(:each) do
144
+ Aladtec.configure do |config|
145
+ valid_keys.each do |key|
146
+ config.public_send("#{key}=", key)
147
+ end
148
+ end
149
+ end
150
+
151
+ after(:each) do
152
+ Aladtec.reset
153
+ end
154
+
155
+ it "should inherit module configuration" do
156
+ api = Aladtec::Client.new
157
+ valid_keys.each do |key|
158
+ expect(api.public_send(key)).to eq(key)
159
+ end
160
+ end
161
+ end
162
+
163
+ context 'with class configuration' do
164
+ let(:config) do
165
+ {
166
+ :acc_id => 'ai',
167
+ :acc_key => 'ak',
168
+ :cus_id => 'ci',
169
+ :endpoint => 'ep',
170
+ :user_agent => 'ua',
171
+ :method => 'hm',
172
+ }
173
+ end
174
+
175
+ it 'should override module configuration' do
176
+ api = Aladtec::Client.new(config)
177
+ valid_keys.each do |key|
178
+ expect(api.public_send(key)).to eq(config[key])
179
+ end
180
+ end
181
+
182
+ it 'should override module configuration after' do
183
+ api = Aladtec::Client.new
184
+
185
+ config.each do |key, value|
186
+ api.public_send("#{key}=", value)
187
+ end
188
+
189
+ valid_keys.each do |key|
190
+ expect(api.send("#{key}")).to eq(config[key])
191
+ end
192
+ end
193
+ end
194
+ end
@@ -0,0 +1,26 @@
1
+ require_relative File.join('..','spec_helper')
2
+
3
+ describe 'configuration' do
4
+ Aladtec::Configuration::VALID_CONFIG_KEYS.each do |key|
5
+ describe ".#{key}" do
6
+ it 'should return the default value' do
7
+ expect(Aladtec.public_send(key)).to eq(Aladtec::Configuration.const_get("DEFAULT_#{key.upcase}"))
8
+ end
9
+ end
10
+ end
11
+
12
+ describe '.configure' do
13
+ after(:each) do
14
+ Aladtec.reset
15
+ end
16
+
17
+ Aladtec::Configuration::VALID_CONFIG_KEYS.each do |key|
18
+ it "should set the #{key}" do
19
+ Aladtec.configure do |config|
20
+ config.public_send("#{key}=", key)
21
+ expect(Aladtec.public_send(key)).to eq(key)
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,25 @@
1
+ require_relative File.join('..','spec_helper')
2
+
3
+ describe Aladtec::RangeDenormalizer do
4
+ let(:members) {[OpenStruct.new(id: 1, name: "Joe Schmoe"), OpenStruct.new(id: 2, name: "Ann Perkins")]}
5
+ let(:schedules) {
6
+ [OpenStruct.new(id: 1, name: "Daytime", positions: [OpenStruct.new(id: 3, name: "Firefighter")]),
7
+ OpenStruct.new(id: 2, name: "Nighttime", positions: [OpenStruct.new(id: 3, name: "Firefighter")])]
8
+ }
9
+ subject { Aladtec::RangeDenormalizer.new(members: members, schedules: schedules) }
10
+
11
+ describe "#denormalize" do
12
+ let(:ranges) {[OpenStruct.new(member: OpenStruct.new(id: 1), schedule: OpenStruct.new(id: 2), position: OpenStruct.new(id: 3))]}
13
+ it "should map members to ranges" do
14
+ expect(subject.denormalize(ranges).first.member.name).to eq("Joe Schmoe")
15
+ end
16
+
17
+ it "should map schedules to ranges" do
18
+ expect(subject.denormalize(ranges).first.schedule.name).to eq("Nighttime")
19
+ end
20
+
21
+ it "should map positions to ranges" do
22
+ expect(subject.denormalize(ranges).first.position.name).to eq("Firefighter")
23
+ end
24
+ end
25
+ end
@@ -0,0 +1 @@
1
+ <?xml version="1.0" encoding="UTF-8"?><results accessTime="2012-03-15T15:52:01Z" version="3.1.1"> <events> <event public="yes" type="5"> <title>Game Night</title> <description>Play games until the sun comes up!</description> <location>Public Library</location> <begin>2012-04-20</begin> <end>2012-04-21T15:30:00Z</end> <schedules/> </event> <event public="no" type="4"> <title>CPR Training</title> <description/> <location>Clinic</location> <begin>2012-05-01T01:30:00Z</begin> <end/> <schedules> <schedule id="1"/> <schedule id="3"/> <schedule id="4"/> </schedules> </event> </events></results>
@@ -0,0 +1 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
  <members>
1
3
  <member id="32">
2
4
  <name>John Anderson</name>
3
5
  </member>
4
6
  <member id="42">
5
7
  <name>Bill Johnson</name>
6
8
  </member>
7
9
  <member id="64">
8
10
  <name>Pete Smith</name>
9
11
  </member>
10
12
  </members>
@@ -0,0 +1,21 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <results version="3.1.1" accessTime="2012-03-15T15:52:01Z">
3
+ <schedules>
4
+ <schedule id="5">
5
+ <positions>
6
+ <position id="1">
7
+ <member id="32" />
8
+ </position>
9
+ <position id="2">
10
+ <member id="64" />
11
+ </position>
12
+ </positions>
13
+ </schedule>
14
+ <schedule id="9">
15
+ <positions>
16
+ <position id="4" />
17
+ </positions>
18
+ </schedule>
19
+ </schedules>
20
+ </results>
21
+
@@ -0,0 +1,27 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <results version="3.1.1" accessTime="2012-03-15T15:52:01Z">
3
+ <ranges>
4
+ <range>
5
+ <schedule id="5" />
6
+ <position id="1" />
7
+ <member id="42" />
8
+ <begin>2010-03-20T03:30:00Z</begin>
9
+ <end>2010-03-20T11:30:00Z</end>
10
+ </range>
11
+ <range>
12
+ <schedule id="5" />
13
+ <position id="2" />
14
+ <member id="42" />
15
+ <begin>2010-03-20T11:30:00Z</begin>
16
+ <end>2010-03-20T15:30:00Z</end>
17
+ </range>
18
+ <range>
19
+ <schedule id="6" />
20
+ <position id="9" />
21
+ <member id="32" />
22
+ <begin>2010-03-20T07:30:00Z</begin>
23
+ <end>2010-03-21T21:30:00Z</end>
24
+ </range>
25
+ </ranges>
26
+ </results>
27
+
@@ -0,0 +1 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
  <schedules>
1
3
  <schedule id="5">
2
4
  <name>Sample BLS - 24/48</name>
3
5
  </schedule>
4
6
  <schedule id="6">
5
7
  <name>Medic 5</name>
6
8
  </schedule>
7
9
  <schedule id="7">
8
10
  <name>Wheelchair Van 12</name>
9
11
  </schedule>
10
12
  <schedule id="8">
11
13
  <name>Air Crew</name>
12
14
  </schedule>
13
15
  <schedule id="9">
14
16
  <name>Dispatch</name>
15
17
  </schedule>
16
18
  </schedules>
@@ -0,0 +1,22 @@
1
+ require 'aladtec'
2
+ require 'rspec'
3
+ require 'webmock/rspec'
4
+
5
+ begin
6
+ require 'pry'
7
+ rescue LoadError
8
+ end
9
+
10
+ RSpec.configure do |config|
11
+ config.expect_with :rspec do |c|
12
+ c.syntax = :expect
13
+ end
14
+ end
15
+
16
+ def fixture_path
17
+ File.expand_path("../fixtures", __FILE__)
18
+ end
19
+
20
+ def fixture(file)
21
+ File.new(File.join(fixture_path, file))
22
+ end
metadata ADDED
@@ -0,0 +1,180 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: aladtec
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Travis Dahlke
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-05-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.5'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.5'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: webmock
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rest-client
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 1.6.7
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 1.6.7
97
+ - !ruby/object:Gem::Dependency
98
+ name: happymapper
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 0.4.1
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 0.4.1
111
+ description: Retrieve schedules and events from the Aladtec API. Works with EMS Manager,
112
+ Fire Manager, Zanager.
113
+ email:
114
+ - dahlke.travis@gmail.com
115
+ executables: []
116
+ extensions: []
117
+ extra_rdoc_files: []
118
+ files:
119
+ - ".gitignore"
120
+ - ".travis.yml"
121
+ - Gemfile
122
+ - LICENSE.txt
123
+ - README.md
124
+ - Rakefile
125
+ - aladtec.gemspec
126
+ - lib/aladtec.rb
127
+ - lib/aladtec/client.rb
128
+ - lib/aladtec/configuration.rb
129
+ - lib/aladtec/event.rb
130
+ - lib/aladtec/member.rb
131
+ - lib/aladtec/position.rb
132
+ - lib/aladtec/range.rb
133
+ - lib/aladtec/range_denormalizer.rb
134
+ - lib/aladtec/schedule.rb
135
+ - lib/aladtec/version.rb
136
+ - spec/aladtec/aladtec_spec.rb
137
+ - spec/aladtec/client_spec.rb
138
+ - spec/aladtec/configuration_spec.rb
139
+ - spec/aladtec/range_denormalizer_spec.rb
140
+ - spec/fixtures/get_events.xml
141
+ - spec/fixtures/get_members.xml
142
+ - spec/fixtures/get_scheduled_time_now.xml
143
+ - spec/fixtures/get_scheduled_time_ranges.xml
144
+ - spec/fixtures/get_schedules.xml
145
+ - spec/spec_helper.rb
146
+ homepage: ''
147
+ licenses:
148
+ - MIT
149
+ metadata: {}
150
+ post_install_message:
151
+ rdoc_options: []
152
+ require_paths:
153
+ - lib
154
+ required_ruby_version: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - ">="
157
+ - !ruby/object:Gem::Version
158
+ version: '0'
159
+ required_rubygems_version: !ruby/object:Gem::Requirement
160
+ requirements:
161
+ - - ">="
162
+ - !ruby/object:Gem::Version
163
+ version: '0'
164
+ requirements: []
165
+ rubyforge_project:
166
+ rubygems_version: 2.2.2
167
+ signing_key:
168
+ specification_version: 4
169
+ summary: Client library for the Aladtec API
170
+ test_files:
171
+ - spec/aladtec/aladtec_spec.rb
172
+ - spec/aladtec/client_spec.rb
173
+ - spec/aladtec/configuration_spec.rb
174
+ - spec/aladtec/range_denormalizer_spec.rb
175
+ - spec/fixtures/get_events.xml
176
+ - spec/fixtures/get_members.xml
177
+ - spec/fixtures/get_scheduled_time_now.xml
178
+ - spec/fixtures/get_scheduled_time_ranges.xml
179
+ - spec/fixtures/get_schedules.xml
180
+ - spec/spec_helper.rb