aladtec 0.2.0 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +8 -1
- data/CHANGELOG.md +8 -0
- data/Gemfile +2 -0
- data/README.md +12 -3
- data/Rakefile +4 -2
- data/aladtec.gemspec +22 -16
- data/lib/aladtec/client.rb +63 -78
- data/lib/aladtec/event.rb +16 -8
- data/lib/aladtec/exceptions.rb +2 -0
- data/lib/aladtec/member.rb +16 -4
- data/lib/aladtec/position.rb +11 -6
- data/lib/aladtec/range.rb +15 -11
- data/lib/aladtec/schedule.rb +12 -13
- data/lib/aladtec/scheduled_now.rb +20 -0
- data/lib/aladtec/version.rb +3 -1
- data/lib/aladtec.rb +12 -4
- data/spec/aladtec/aladtec_spec.rb +18 -1
- data/spec/aladtec/client_spec.rb +100 -101
- data/spec/fixtures/events.json +55 -0
- data/spec/fixtures/members.json +39 -0
- data/spec/fixtures/scheduled_time.json +54 -0
- data/spec/fixtures/scheduled_time_now.json +24 -0
- data/spec/fixtures/schedules.json +32 -0
- data/spec/spec_helper.rb +9 -1
- metadata +61 -33
- data/lib/aladtec/authentication.rb +0 -16
- data/lib/aladtec/configuration.rb +0 -37
- data/spec/aladtec/configuration_spec.rb +0 -26
- data/spec/fixtures/authenticate_member.xml +0 -6
- data/spec/fixtures/get_events.xml +0 -1
- data/spec/fixtures/get_members.xml +0 -1
- data/spec/fixtures/get_scheduled_time_now.xml +0 -21
- data/spec/fixtures/get_scheduled_time_ranges.xml +0 -27
- data/spec/fixtures/get_schedules.xml +0 -57
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aladtec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Travis Dahlke
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,14 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: pry
|
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'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: rake
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,13 +81,33 @@ dependencies:
|
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
84
|
+
name: dry-configurable
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.11'
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: 0.11.4
|
93
|
+
type: :runtime
|
94
|
+
prerelease: false
|
95
|
+
version_requirements: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - "~>"
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0.11'
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: 0.11.4
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: dry-initializer
|
71
105
|
requirement: !ruby/object:Gem::Requirement
|
72
106
|
requirements:
|
73
107
|
- - ">="
|
74
108
|
- !ruby/object:Gem::Version
|
75
109
|
version: '0'
|
76
|
-
type: :
|
110
|
+
type: :runtime
|
77
111
|
prerelease: false
|
78
112
|
version_requirements: !ruby/object:Gem::Requirement
|
79
113
|
requirements:
|
@@ -81,7 +115,7 @@ dependencies:
|
|
81
115
|
- !ruby/object:Gem::Version
|
82
116
|
version: '0'
|
83
117
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
118
|
+
name: http
|
85
119
|
requirement: !ruby/object:Gem::Requirement
|
86
120
|
requirements:
|
87
121
|
- - ">="
|
@@ -94,8 +128,8 @@ dependencies:
|
|
94
128
|
- - ">="
|
95
129
|
- !ruby/object:Gem::Version
|
96
130
|
version: '0'
|
97
|
-
description: Retrieve schedules and events from the Aladtec API
|
98
|
-
Fire Manager, Zanager.
|
131
|
+
description: "Retrieve schedules and events from the Aladtec API.\n Works with
|
132
|
+
EMS Manager, Fire Manager, Zanager. "
|
99
133
|
email:
|
100
134
|
- dahlke.travis@gmail.com
|
101
135
|
executables: []
|
@@ -111,58 +145,52 @@ files:
|
|
111
145
|
- Rakefile
|
112
146
|
- aladtec.gemspec
|
113
147
|
- lib/aladtec.rb
|
114
|
-
- lib/aladtec/authentication.rb
|
115
148
|
- lib/aladtec/client.rb
|
116
|
-
- lib/aladtec/configuration.rb
|
117
149
|
- lib/aladtec/event.rb
|
118
150
|
- lib/aladtec/exceptions.rb
|
119
151
|
- lib/aladtec/member.rb
|
120
152
|
- lib/aladtec/position.rb
|
121
153
|
- lib/aladtec/range.rb
|
122
154
|
- lib/aladtec/schedule.rb
|
155
|
+
- lib/aladtec/scheduled_now.rb
|
123
156
|
- lib/aladtec/version.rb
|
124
157
|
- spec/aladtec/aladtec_spec.rb
|
125
158
|
- spec/aladtec/client_spec.rb
|
126
|
-
- spec/
|
127
|
-
- spec/fixtures/
|
128
|
-
- spec/fixtures/
|
129
|
-
- spec/fixtures/
|
130
|
-
- spec/fixtures/
|
131
|
-
- spec/fixtures/get_scheduled_time_ranges.xml
|
132
|
-
- spec/fixtures/get_schedules.xml
|
159
|
+
- spec/fixtures/events.json
|
160
|
+
- spec/fixtures/members.json
|
161
|
+
- spec/fixtures/scheduled_time.json
|
162
|
+
- spec/fixtures/scheduled_time_now.json
|
163
|
+
- spec/fixtures/schedules.json
|
133
164
|
- spec/spec_helper.rb
|
134
|
-
homepage:
|
165
|
+
homepage: https://github.com/travisdahlke/aladtec
|
135
166
|
licenses:
|
136
167
|
- MIT
|
137
168
|
metadata: {}
|
138
|
-
post_install_message:
|
169
|
+
post_install_message:
|
139
170
|
rdoc_options: []
|
140
171
|
require_paths:
|
141
172
|
- lib
|
142
173
|
required_ruby_version: !ruby/object:Gem::Requirement
|
143
174
|
requirements:
|
144
|
-
- - "
|
175
|
+
- - ">"
|
145
176
|
- !ruby/object:Gem::Version
|
146
|
-
version: '
|
177
|
+
version: '2.5'
|
147
178
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
148
179
|
requirements:
|
149
180
|
- - ">="
|
150
181
|
- !ruby/object:Gem::Version
|
151
182
|
version: '0'
|
152
183
|
requirements: []
|
153
|
-
|
154
|
-
|
155
|
-
signing_key:
|
184
|
+
rubygems_version: 3.3.14
|
185
|
+
signing_key:
|
156
186
|
specification_version: 4
|
157
187
|
summary: Client library for the Aladtec API
|
158
188
|
test_files:
|
159
189
|
- spec/aladtec/aladtec_spec.rb
|
160
190
|
- spec/aladtec/client_spec.rb
|
161
|
-
- spec/
|
162
|
-
- spec/fixtures/
|
163
|
-
- spec/fixtures/
|
164
|
-
- spec/fixtures/
|
165
|
-
- spec/fixtures/
|
166
|
-
- spec/fixtures/get_scheduled_time_ranges.xml
|
167
|
-
- spec/fixtures/get_schedules.xml
|
191
|
+
- spec/fixtures/events.json
|
192
|
+
- spec/fixtures/members.json
|
193
|
+
- spec/fixtures/scheduled_time.json
|
194
|
+
- spec/fixtures/scheduled_time_now.json
|
195
|
+
- spec/fixtures/schedules.json
|
168
196
|
- spec/spec_helper.rb
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module Aladtec
|
2
|
-
class Authentication
|
3
|
-
attr_accessor :code, :retry, :message, :member
|
4
|
-
|
5
|
-
def initialize(args = {})
|
6
|
-
@code = args["code"].to_i
|
7
|
-
@retry = args["retry"]
|
8
|
-
@message = args["message"]
|
9
|
-
@member = args["member"]
|
10
|
-
end
|
11
|
-
|
12
|
-
def success?
|
13
|
-
self.code == 0
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
module Aladtec
|
2
|
-
module Configuration
|
3
|
-
VALID_CONNECTION_KEYS = [:endpoint, :method, :user_agent].freeze
|
4
|
-
VALID_OPTIONS_KEYS = [:acc_id, :acc_key].freeze
|
5
|
-
VALID_CONFIG_KEYS = VALID_CONNECTION_KEYS + VALID_OPTIONS_KEYS
|
6
|
-
|
7
|
-
DEFAULT_ENDPOINT = "https://secure.emsmanager.net/api/index.php".freeze
|
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
|
-
|
14
|
-
attr_accessor *VALID_CONFIG_KEYS
|
15
|
-
|
16
|
-
def self.extended(base)
|
17
|
-
base.reset
|
18
|
-
end
|
19
|
-
|
20
|
-
def reset
|
21
|
-
self.endpoint = DEFAULT_ENDPOINT
|
22
|
-
self.method = DEFAULT_METHOD
|
23
|
-
self.user_agent = DEFAULT_USER_AGENT
|
24
|
-
|
25
|
-
self.acc_id = DEFAULT_ACC_ID
|
26
|
-
self.acc_key = DEFAULT_ACC_KEY
|
27
|
-
end
|
28
|
-
|
29
|
-
def configure
|
30
|
-
yield self
|
31
|
-
end
|
32
|
-
|
33
|
-
def options
|
34
|
-
Hash[ * VALID_CONFIG_KEYS.map { |key| [key, public_send(key)] }.flatten ]
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
@@ -1,26 +0,0 @@
|
|
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
|
@@ -1 +0,0 @@
|
|
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>
|
@@ -1,21 +0,0 @@
|
|
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
|
-
|
@@ -1,27 +0,0 @@
|
|
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
|
-
|
@@ -1,57 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<results version="3.5.1" accessTime="20160303T15:52:01Z">
|
3
|
-
<schedules>
|
4
|
-
<schedule id="5">
|
5
|
-
<name>Sample BLS - 24/48</name>
|
6
|
-
<positions>
|
7
|
-
<position id="1">
|
8
|
-
<name>EMT</name>
|
9
|
-
</position>
|
10
|
-
<position id="2">
|
11
|
-
<name>Driver</name>
|
12
|
-
</position>
|
13
|
-
</positions>
|
14
|
-
</schedule>
|
15
|
-
<schedule id="6">
|
16
|
-
<name>Medic 5</name>
|
17
|
-
<positions>
|
18
|
-
<position id="9">
|
19
|
-
<name>Medic</name>
|
20
|
-
</position>
|
21
|
-
<position id="8">
|
22
|
-
<name>EMT</name>
|
23
|
-
</position>
|
24
|
-
</positions>
|
25
|
-
</schedule>
|
26
|
-
<schedule id="7">
|
27
|
-
<name>Wheelchair Van 12</name>
|
28
|
-
<positions>
|
29
|
-
<position id="14">
|
30
|
-
<name>Driver</name>
|
31
|
-
</position>
|
32
|
-
</positions>
|
33
|
-
</schedule>
|
34
|
-
<schedule id="8">
|
35
|
-
<name>Air Crew</name>
|
36
|
-
<positions>
|
37
|
-
<position id="10">
|
38
|
-
<name>Medic</name>
|
39
|
-
</position>
|
40
|
-
<position id="11">
|
41
|
-
<name>EMT</name>
|
42
|
-
</position>
|
43
|
-
<position id="12">
|
44
|
-
<name>Pilot</name>
|
45
|
-
</position>
|
46
|
-
</positions>
|
47
|
-
</schedule>
|
48
|
-
<schedule id="9">
|
49
|
-
<name>Dispatch</name>
|
50
|
-
<positions>
|
51
|
-
<position id="4">
|
52
|
-
<name>Dispatcher</name>
|
53
|
-
</position>
|
54
|
-
</positions>
|
55
|
-
</schedule>
|
56
|
-
</schedules>
|
57
|
-
</results>
|