aladtec 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,24 @@
1
+ [
2
+ {
3
+ "schedule_id": 1,
4
+ "positions": [
5
+ {
6
+ "position_id": 1,
7
+ "member_id": 42
8
+ }
9
+ ]
10
+ },
11
+ {
12
+ "schedule_id": 2,
13
+ "positions": [
14
+ {
15
+ "position_id": 3,
16
+ "member_id": 27
17
+ },
18
+ {
19
+ "position_id": 4,
20
+ "member_id": 22
21
+ }
22
+ ]
23
+ }
24
+ ]
@@ -0,0 +1,32 @@
1
+ [
2
+ {
3
+ "schedule_id": 1,
4
+ "name": "Ambulance 1",
5
+ "is_archived": false,
6
+ "positions": [
7
+ {
8
+ "position_id": 1,
9
+ "label": "Driver"
10
+ },
11
+ {
12
+ "position_id": 2,
13
+ "label": "Firefighter"
14
+ }
15
+ ]
16
+ },
17
+ {
18
+ "schedule_id": 2,
19
+ "name": "Fire Crew 1",
20
+ "is_archived": false,
21
+ "positions": [
22
+ {
23
+ "position_id": 3,
24
+ "label": "Slot 1"
25
+ },
26
+ {
27
+ "position_id": 4,
28
+ "label": "Slot 2"
29
+ }
30
+ ]
31
+ }
32
+ ]
@@ -1,6 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'aladtec'
2
4
  require 'rspec'
3
5
  require 'webmock/rspec'
6
+ require 'dry/configurable/test_interface'
7
+
8
+ module Aladtec
9
+ enable_test_interface
10
+ end
4
11
 
5
12
  begin
6
13
  require 'pry'
@@ -11,10 +18,11 @@ RSpec.configure do |config|
11
18
  config.expect_with :rspec do |c|
12
19
  c.syntax = :expect
13
20
  end
21
+ config.filter_run_when_matching :focus
14
22
  end
15
23
 
16
24
  def fixture_path
17
- File.expand_path("../fixtures", __FILE__)
25
+ File.expand_path('fixtures', __dir__)
18
26
  end
19
27
 
20
28
  def fixture(file)
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.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Travis Dahlke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-30 00:00:00.000000000 Z
11
+ date: 2019-10-27 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: '1.5'
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: '1.5'
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,27 @@ dependencies:
67
81
  - !ruby/object:Gem::Version
68
82
  version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
- name: pry
84
+ name: dry-configurable
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
87
  - - ">="
74
88
  - !ruby/object:Gem::Version
75
89
  version: '0'
76
- type: :development
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: dry-initializer
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
77
105
  prerelease: false
78
106
  version_requirements: !ruby/object:Gem::Requirement
79
107
  requirements:
@@ -81,7 +109,7 @@ dependencies:
81
109
  - !ruby/object:Gem::Version
82
110
  version: '0'
83
111
  - !ruby/object:Gem::Dependency
84
- name: multi_xml
112
+ name: http
85
113
  requirement: !ruby/object:Gem::Requirement
86
114
  requirements:
87
115
  - - ">="
@@ -94,8 +122,8 @@ dependencies:
94
122
  - - ">="
95
123
  - !ruby/object:Gem::Version
96
124
  version: '0'
97
- description: Retrieve schedules and events from the Aladtec API. Works with EMS Manager,
98
- Fire Manager, Zanager.
125
+ description: "Retrieve schedules and events from the Aladtec API.\n Works with
126
+ EMS Manager, Fire Manager, Zanager. "
99
127
  email:
100
128
  - dahlke.travis@gmail.com
101
129
  executables: []
@@ -111,27 +139,24 @@ files:
111
139
  - Rakefile
112
140
  - aladtec.gemspec
113
141
  - lib/aladtec.rb
114
- - lib/aladtec/authentication.rb
115
142
  - lib/aladtec/client.rb
116
- - lib/aladtec/configuration.rb
117
143
  - lib/aladtec/event.rb
118
144
  - lib/aladtec/exceptions.rb
119
145
  - lib/aladtec/member.rb
120
146
  - lib/aladtec/position.rb
121
147
  - lib/aladtec/range.rb
122
148
  - lib/aladtec/schedule.rb
149
+ - lib/aladtec/scheduled_now.rb
123
150
  - lib/aladtec/version.rb
124
151
  - spec/aladtec/aladtec_spec.rb
125
152
  - spec/aladtec/client_spec.rb
126
- - spec/aladtec/configuration_spec.rb
127
- - spec/fixtures/authenticate_member.xml
128
- - spec/fixtures/get_events.xml
129
- - spec/fixtures/get_members.xml
130
- - spec/fixtures/get_scheduled_time_now.xml
131
- - spec/fixtures/get_scheduled_time_ranges.xml
132
- - spec/fixtures/get_schedules.xml
153
+ - spec/fixtures/events.json
154
+ - spec/fixtures/members.json
155
+ - spec/fixtures/scheduled_time.json
156
+ - spec/fixtures/scheduled_time_now.json
157
+ - spec/fixtures/schedules.json
133
158
  - spec/spec_helper.rb
134
- homepage: ''
159
+ homepage: https://github.com/travisdahlke/aladtec
135
160
  licenses:
136
161
  - MIT
137
162
  metadata: {}
@@ -150,19 +175,16 @@ required_rubygems_version: !ruby/object:Gem::Requirement
150
175
  - !ruby/object:Gem::Version
151
176
  version: '0'
152
177
  requirements: []
153
- rubyforge_project:
154
- rubygems_version: 2.5.1
178
+ rubygems_version: 3.0.3
155
179
  signing_key:
156
180
  specification_version: 4
157
181
  summary: Client library for the Aladtec API
158
182
  test_files:
159
183
  - spec/aladtec/aladtec_spec.rb
160
184
  - spec/aladtec/client_spec.rb
161
- - spec/aladtec/configuration_spec.rb
162
- - spec/fixtures/authenticate_member.xml
163
- - spec/fixtures/get_events.xml
164
- - spec/fixtures/get_members.xml
165
- - spec/fixtures/get_scheduled_time_now.xml
166
- - spec/fixtures/get_scheduled_time_ranges.xml
167
- - spec/fixtures/get_schedules.xml
185
+ - spec/fixtures/events.json
186
+ - spec/fixtures/members.json
187
+ - spec/fixtures/scheduled_time.json
188
+ - spec/fixtures/scheduled_time_now.json
189
+ - spec/fixtures/schedules.json
168
190
  - 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,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <results version="3.5.1" accessTime="2016­03­03T15:52:01Z">
3
- <authentication code="0">
4
- <member id="8"/>
5
- </authentication>
6
- </results>
@@ -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 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
  <members>
3
1
  <member id="32">
4
2
  <name>John Anderson</name>
5
3
  </member>
6
4
  <member id="42">
7
5
  <name>Bill Johnson</name>
8
6
  </member>
9
7
  <member id="64">
10
8
  <name>Pete Smith</name>
11
9
  </member>
12
10
  </members>
@@ -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="2016­03­03T15: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>