halo_msp_api 0.1.0 → 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.
@@ -2,84 +2,85 @@
2
2
 
3
3
  module HaloMspApi
4
4
  module Resources
5
+ # Resource class for Actions
5
6
  class Actions < Base
6
7
  # GET /Actions - List of Actions
7
8
  # Parameters based on swagger.json specification
8
- def list(options = {})
9
+ def actions(options = {})
9
10
  params = build_list_params(options)
10
- get("/Actions", params)
11
+ get('/Actions', params)
11
12
  end
12
13
 
13
14
  # GET /Actions/{id} - Get a specific Action
14
- def get(id, params = {})
15
- get_resource("Actions", id, params)
15
+ def action(id, params = {})
16
+ get_resource('Actions', id, params)
16
17
  end
17
18
 
18
19
  # POST /Actions - Create a new Action
19
- def create(data)
20
- create_resource("Actions", data)
20
+ def create_action(data)
21
+ create_resource('Actions', data)
21
22
  end
22
23
 
23
24
  # PUT /Actions/{id} - Update an Action
24
- def update(id, data)
25
- update_resource("Actions", id, data)
25
+ def update_action(id, data)
26
+ update_resource('Actions', id, data)
26
27
  end
27
28
 
28
29
  # DELETE /Actions/{id} - Delete an Action
29
- def delete(id)
30
- delete_resource("Actions", id)
30
+ def delete_action(id)
31
+ delete_resource('Actions', id)
31
32
  end
32
33
 
33
34
  # Action Reactions methods
34
35
  # GET /ActionReaction - List action reactions
35
36
  def reactions(params = {})
36
- get("/ActionReaction", params)
37
+ list_resource('ActionReaction', params)
37
38
  end
38
39
 
39
40
  # GET /ActionReaction/{id} - Get specific action reaction
40
41
  def reaction(id, params = {})
41
- get("/ActionReaction/#{id}", params)
42
+ get_resource('ActionReaction', id, params)
42
43
  end
43
44
 
44
45
  # POST /ActionReaction - Create action reaction
45
46
  def create_reaction(data)
46
- post("/ActionReaction", data)
47
+ create_resource('ActionReaction', data)
47
48
  end
48
49
 
49
50
  # PUT /ActionReaction/{id} - Update action reaction
50
51
  def update_reaction(id, data)
51
- put("/ActionReaction/#{id}", data)
52
+ update_resource('ActionReaction', id, data)
52
53
  end
53
54
 
54
55
  # DELETE /ActionReaction/{id} - Delete action reaction
55
56
  def delete_reaction(id)
56
- delete("/ActionReaction/#{id}")
57
+ delete_resource('ActionReaction', id)
57
58
  end
58
59
 
59
60
  # Action Review methods
60
61
  # GET /ActionReview - List action reviews
61
62
  def reviews(params = {})
62
- get("/ActionReview", params)
63
+ list_resource('ActionReview', params)
63
64
  end
64
65
 
65
66
  # GET /ActionReview/{id} - Get specific action review
66
67
  def review(id, params = {})
67
- get("/ActionReview/#{id}", params)
68
+ get_resource('ActionReview', id, params)
68
69
  end
69
70
 
70
71
  # POST /ActionReview - Create action review
71
72
  def create_review(data)
72
- post("/ActionReview", data)
73
+ create_resource('ActionReview', data)
73
74
  end
74
75
 
75
76
  # PUT /ActionReview/{id} - Update action review
76
77
  def update_review(id, data)
77
- put("/ActionReview/#{id}", data)
78
+ update_resource('ActionReview', id, data)
78
79
  end
79
80
 
80
81
  # DELETE /ActionReview/{id} - Delete action review
81
82
  def delete_review(id)
82
- delete("/ActionReview/#{id}")
83
+ delete_resource('ActionReview', id)
83
84
  end
84
85
  end
85
86
  end
@@ -2,98 +2,99 @@
2
2
 
3
3
  module HaloMspApi
4
4
  module Resources
5
+ # Resource class for Agents
5
6
  class Agents < Base
6
7
  # GET /Agent - List of Agents
7
- def list(params = {})
8
- list_resource("Agent", params)
8
+ def agents(params = {})
9
+ list_resource('Agent', params)
9
10
  end
10
11
 
11
12
  # GET /Agent/{id} - Get a specific Agent
12
- def get(id, params = {})
13
- get_resource("Agent", id, params)
13
+ def agent(id, params = {})
14
+ get_resource('Agent', id, params)
14
15
  end
15
16
 
16
17
  # POST /Agent - Create a new Agent
17
- def create(data)
18
- create_resource("Agent", data)
18
+ def create_agent(data)
19
+ create_resource('Agent', data)
19
20
  end
20
21
 
21
22
  # PUT /Agent/{id} - Update an Agent
22
- def update(id, data)
23
- update_resource("Agent", id, data)
23
+ def update_agent(id, data)
24
+ update_resource('Agent', id, data)
24
25
  end
25
26
 
26
27
  # DELETE /Agent/{id} - Delete an Agent
27
- def delete(id)
28
- delete_resource("Agent", id)
28
+ def delete_agent(id)
29
+ delete_resource('Agent', id)
29
30
  end
30
31
 
31
32
  # GET /Agent/me - Get current Agent information
32
33
  def me(params = {})
33
- get(resource_path("Agent", nil, "me"), params)
34
+ get_resource('Agent', 'me', params)
34
35
  end
35
36
 
36
37
  # POST /Agent/ClearCache - Clear Agent cache
37
38
  def clear_cache
38
- post(resource_path("Agent", nil, "ClearCache"))
39
+ post(resource_path('Agent', nil, 'ClearCache'))
39
40
  end
40
41
 
41
42
  # GET /AgentImage/{id} - Get Agent image
42
43
  def image(id)
43
- get(resource_path("AgentImage", id))
44
+ get_resource('AgentImage', id)
44
45
  end
45
46
 
46
47
  # Agent Check-in related methods
47
48
  # GET /AgentCheckIn - List Agent check-ins
48
49
  def check_ins(params = {})
49
- get("/AgentCheckIn", params)
50
+ list_resource('AgentCheckIn', params)
50
51
  end
51
52
 
52
53
  # GET /AgentCheckIn/{id} - Get specific Agent check-in
53
54
  def check_in(id, params = {})
54
- get("/AgentCheckIn/#{id}", params)
55
+ get_resource('AgentCheckIn', id, params)
55
56
  end
56
57
 
57
58
  # POST /AgentCheckIn - Create Agent check-in
58
59
  def create_check_in(data)
59
- post("/AgentCheckIn", data)
60
+ create_resource('AgentCheckIn', data)
60
61
  end
61
62
 
62
63
  # Agent Event Subscription methods
63
64
  # GET /AgentEventSubscription - List Agent event subscriptions
64
65
  def event_subscriptions(params = {})
65
- get("/AgentEventSubscription", params)
66
+ list_resource('AgentEventSubscription', params)
66
67
  end
67
68
 
68
69
  # GET /AgentEventSubscription/{id} - Get specific Agent event subscription
69
70
  def event_subscription(id, params = {})
70
- get("/AgentEventSubscription/#{id}", params)
71
+ get_resource('AgentEventSubscription', id, params)
71
72
  end
72
73
 
73
74
  # POST /AgentEventSubscription - Create Agent event subscription
74
75
  def create_event_subscription(data)
75
- post("/AgentEventSubscription", data)
76
+ create_resource('AgentEventSubscription', data)
76
77
  end
77
78
 
78
79
  # Agent Presence related methods
79
80
  # GET /AgentPresenceRule - List Agent presence rules
80
81
  def presence_rules(params = {})
81
- get("/AgentPresenceRule", params)
82
+ list_resource('AgentPresenceRule', params)
82
83
  end
83
84
 
84
85
  # GET /AgentPresenceSubscription - List Agent presence subscriptions
85
86
  def presence_subscriptions(params = {})
86
- get("/AgentPresenceSubscription", params)
87
+ list_resource('AgentPresenceSubscription', params)
87
88
  end
88
89
 
89
90
  # GET /AgentPresenceSubscription/{id} - Get specific Agent presence subscription
90
91
  def presence_subscription(id, params = {})
91
- get("/AgentPresenceSubscription/#{id}", params)
92
+ get_resource('AgentPresenceSubscription', id, params)
92
93
  end
93
94
 
94
95
  # POST /AgentPresenceSubscription - Create Agent presence subscription
95
96
  def create_presence_subscription(data)
96
- post("/AgentPresenceSubscription", data)
97
+ create_resource('AgentPresenceSubscription', data)
97
98
  end
98
99
  end
99
100
  end
@@ -2,65 +2,66 @@
2
2
 
3
3
  module HaloMspApi
4
4
  module Resources
5
+ # Resource class for Appointments
5
6
  class Appointments < Base
6
7
  # GET /Appointment - List of Appointments
7
- def list(params = {})
8
- list_resource("Appointment", params)
8
+ def appointments(params = {})
9
+ list_resource('Appointment', params)
9
10
  end
10
11
 
11
12
  # GET /Appointment/{id} - Get a specific Appointment
12
- def get(id, params = {})
13
- get_resource("Appointment", id, params)
13
+ def appointment(id, params = {})
14
+ get_resource('Appointment', id, params)
14
15
  end
15
16
 
16
17
  # POST /Appointment - Create a new Appointment
17
- def create(data)
18
- create_resource("Appointment", data)
18
+ def create_appointment(data)
19
+ create_resource('Appointment', data)
19
20
  end
20
21
 
21
22
  # PUT /Appointment/{id} - Update an Appointment
22
- def update(id, data)
23
- update_resource("Appointment", id, data)
23
+ def update_appointment(id, data)
24
+ update_resource('Appointment', id, data)
24
25
  end
25
26
 
26
27
  # DELETE /Appointment/{id} - Delete an Appointment
27
- def delete(id)
28
- delete_resource("Appointment", id)
28
+ def delete_appointment(id)
29
+ delete_resource('Appointment', id)
29
30
  end
30
31
 
31
32
  # GET /Appointment/Availability - Get Appointment availability
32
33
  def availability(params = {})
33
- get(resource_path("Appointment", nil, "Availability"), params)
34
+ get_resource('Appointment', 'Availability', params)
34
35
  end
35
36
 
36
37
  # GET /Appointment/Calendar - Get Appointment calendar
37
38
  def calendar(params = {})
38
- get(resource_path("Appointment", nil, "Calendar"), params)
39
+ get_resource('Appointment', 'Calendar', params)
39
40
  end
40
41
 
41
42
  # POST /Appointment/CheckAvailability - Check Appointment availability
42
43
  def check_availability(data)
43
- post(resource_path("Appointment", nil, "CheckAvailability"), data)
44
+ post(resource_path('Appointment', nil, 'CheckAvailability'), data)
44
45
  end
45
46
 
46
47
  # GET /Appointment/Slots - Get Appointment slots
47
48
  def slots(params = {})
48
- get(resource_path("Appointment", nil, "Slots"), params)
49
+ list_resource('Appointment', 'Slots', params)
49
50
  end
50
51
 
51
52
  # POST /Appointment/Slots - Create Appointment slots
52
53
  def create_slots(data)
53
- post(resource_path("Appointment", nil, "Slots"), data)
54
+ create_resource('Appointment', 'Slots', data)
54
55
  end
55
56
 
56
57
  # GET /Appointment/Types - Get Appointment types
57
58
  def types(params = {})
58
- get(resource_path("Appointment", nil, "Types"), params)
59
+ list_resource('Appointment', 'Types', params)
59
60
  end
60
61
 
61
62
  # POST /Appointment/Types - Create Appointment type
62
63
  def create_type(data)
63
- post(resource_path("Appointment", nil, "Types"), data)
64
+ create_resource('Appointment', 'Types', data)
64
65
  end
65
66
  end
66
67
  end
@@ -2,145 +2,146 @@
2
2
 
3
3
  module HaloMspApi
4
4
  module Resources
5
+ # Resource class for Assets
5
6
  class Assets < Base
6
7
  # GET /Asset - List of Assets
7
- def list(params = {})
8
- list_resource("Asset", params)
8
+ def assets(params = {})
9
+ list_resource('Asset', params)
9
10
  end
10
11
 
11
12
  # GET /Asset/{id} - Get a specific Asset
12
- def get(id, params = {})
13
- get_resource("Asset", id, params)
13
+ def asset(id, params = {})
14
+ get_resource('Asset', id, params)
14
15
  end
15
16
 
16
17
  # POST /Asset - Create a new Asset
17
- def create(data)
18
- create_resource("Asset", data)
18
+ def create_asset(data)
19
+ create_resource('Asset', data)
19
20
  end
20
21
 
21
22
  # PUT /Asset/{id} - Update an Asset
22
- def update(id, data)
23
- update_resource("Asset", id, data)
23
+ def update_asset(id, data)
24
+ update_resource('Asset', id, data)
24
25
  end
25
26
 
26
27
  # DELETE /Asset/{id} - Delete an Asset
27
- def delete(id)
28
- delete_resource("Asset", id)
28
+ def delete_asset(id)
29
+ delete_resource('Asset', id)
29
30
  end
30
31
 
31
32
  # GET /Asset/GetAllSoftwareVersions - Get all software versions
32
33
  def software_versions(params = {})
33
- get(resource_path("Asset", nil, "GetAllSoftwareVersions"), params)
34
+ list_resource('Asset', params, 'GetAllSoftwareVersions')
34
35
  end
35
36
 
36
37
  # GET /Asset/NextTag - Get next asset tag
37
38
  def next_tag(params = {})
38
- get(resource_path("Asset", nil, "NextTag"), params)
39
+ get_resource('Asset', 'NextTag', params)
39
40
  end
40
41
 
41
42
  # Asset Change related methods
42
43
  # GET /AssetChange - List Asset changes
43
44
  def changes(params = {})
44
- get("/AssetChange", params)
45
+ list_resource('AssetChange', params)
45
46
  end
46
47
 
47
48
  # POST /AssetChange - Create Asset change
48
49
  def create_change(data)
49
- post("/AssetChange", data)
50
+ create_resource('AssetChange', data)
50
51
  end
51
52
 
52
53
  # Asset Group methods
53
54
  # GET /AssetGroup - List Asset groups
54
55
  def groups(params = {})
55
- get("/AssetGroup", params)
56
+ list_resource('AssetGroup', params)
56
57
  end
57
58
 
58
59
  # GET /AssetGroup/{id} - Get specific Asset group
59
60
  def group(id, params = {})
60
- get("/AssetGroup/#{id}", params)
61
+ get_resource('AssetGroup', id, params)
61
62
  end
62
63
 
63
64
  # POST /AssetGroup - Create Asset group
64
65
  def create_group(data)
65
- post("/AssetGroup", data)
66
+ create_resource('AssetGroup', data)
66
67
  end
67
68
 
68
69
  # PUT /AssetGroup/{id} - Update Asset group
69
70
  def update_group(id, data)
70
- put("/AssetGroup/#{id}", data)
71
+ update_resource('AssetGroup', id, data)
71
72
  end
72
73
 
73
74
  # DELETE /AssetGroup/{id} - Delete Asset group
74
75
  def delete_group(id)
75
- delete("/AssetGroup/#{id}")
76
+ delete_resource('AssetGroup', id)
76
77
  end
77
78
 
78
79
  # Asset Software methods
79
80
  # GET /AssetSoftware - List Asset software
80
81
  def software(params = {})
81
- get("/AssetSoftware", params)
82
+ list_resource('AssetSoftware', params)
82
83
  end
83
84
 
84
85
  # POST /AssetSoftware - Create Asset software
85
86
  def create_software(data)
86
- post("/AssetSoftware", data)
87
+ create_resource('AssetSoftware', data)
87
88
  end
88
89
 
89
90
  # Asset Type methods
90
91
  # GET /AssetType - List Asset types
91
92
  def types(params = {})
92
- get("/AssetType", params)
93
+ list_resource('AssetType', params)
93
94
  end
94
95
 
95
96
  # GET /AssetType/{id} - Get specific Asset type
96
97
  def type(id, params = {})
97
- get("/AssetType/#{id}", params)
98
+ get_resource('AssetType', id, params)
98
99
  end
99
100
 
100
101
  # POST /AssetType - Create Asset type
101
102
  def create_type(data)
102
- post("/AssetType", data)
103
+ create_resource('AssetType', data)
103
104
  end
104
105
 
105
106
  # PUT /AssetType/{id} - Update Asset type
106
107
  def update_type(id, data)
107
- put("/AssetType/#{id}", data)
108
+ update_resource('AssetType', id, data)
108
109
  end
109
110
 
110
111
  # DELETE /AssetType/{id} - Delete Asset type
111
112
  def delete_type(id)
112
- delete("/AssetType/#{id}")
113
+ delete_resource('AssetType', id)
113
114
  end
114
115
 
115
116
  # GET /AssetTypeInfo - Get Asset type info
116
117
  def type_info(params = {})
117
- get("/AssetTypeInfo", params)
118
+ get(resource_path('AssetTypeInfo'), params)
118
119
  end
119
120
 
120
121
  # Asset Type Mappings methods
121
122
  # GET /AssetTypeMappings - List Asset type mappings
122
123
  def type_mappings(params = {})
123
- get("/AssetTypeMappings", params)
124
+ list_resource('AssetTypeMappings', params)
124
125
  end
125
126
 
126
127
  # GET /AssetTypeMappings/{id} - Get specific Asset type mapping
127
128
  def type_mapping(id, params = {})
128
- get("/AssetTypeMappings/#{id}", params)
129
+ get_resource('AssetTypeMappings', id, params)
129
130
  end
130
131
 
131
132
  # POST /AssetTypeMappings - Create Asset type mapping
132
133
  def create_type_mapping(data)
133
- post("/AssetTypeMappings", data)
134
+ create_resource('AssetTypeMappings', data)
134
135
  end
135
136
 
136
137
  # PUT /AssetTypeMappings/{id} - Update Asset type mapping
137
138
  def update_type_mapping(id, data)
138
- put("/AssetTypeMappings/#{id}", data)
139
+ update_resource('AssetTypeMappings', id, data)
139
140
  end
140
141
 
141
142
  # DELETE /AssetTypeMappings/{id} - Delete Asset type mapping
142
143
  def delete_type_mapping(id)
143
- delete("/AssetTypeMappings/#{id}")
144
+ delete_resource('AssetTypeMappings', id)
144
145
  end
145
146
  end
146
147
  end
@@ -2,38 +2,39 @@
2
2
 
3
3
  module HaloMspApi
4
4
  module Resources
5
+ # Base class for all resources
5
6
  class Base
6
- attr_reader :client
7
+ attr_reader :client_instance
7
8
 
8
- def initialize(client)
9
- @client = client
9
+ def initialize(client_instance)
10
+ @client_instance = client_instance
10
11
  end
11
12
 
12
13
  protected
13
14
 
14
15
  def get(path, params = {})
15
- client.get(path, params)
16
+ client_instance.get(path, params)
16
17
  end
17
18
 
18
19
  def post(path, body = {})
19
- client.post(path, body)
20
+ client_instance.post(path, body)
20
21
  end
21
22
 
22
23
  def put(path, body = {})
23
- client.put(path, body)
24
+ client_instance.put(path, body)
24
25
  end
25
26
 
26
27
  def patch(path, body = {})
27
- client.patch(path, body)
28
+ client_instance.patch(path, body)
28
29
  end
29
30
 
30
31
  def delete(path)
31
- client.delete(path)
32
+ client_instance.delete(path)
32
33
  end
33
34
 
34
35
  # Helper method to build resource path
35
36
  def resource_path(resource_name, id = nil, action = nil)
36
- path = "/#{resource_name}"
37
+ path = "/api/#{resource_name}"
37
38
  path += "/#{id}" if id
38
39
  path += "/#{action}" if action
39
40
  path
@@ -56,7 +57,8 @@ module HaloMspApi
56
57
 
57
58
  # Helper method for update operations
58
59
  def update_resource(resource_name, id, data)
59
- put(resource_path(resource_name, id), data)
60
+ data_with_id = data.merge(id: id)
61
+ post(resource_path(resource_name), data_with_id)
60
62
  end
61
63
 
62
64
  # Helper method for delete operations