Class: HaloMspApi::Client
- Inherits:
-
Object
- Object
- HaloMspApi::Client
- Defined in:
- lib/halo_msp_api/client.rb
Overview
Client class for Halo MSP API rubocop:disable Metrics/ClassLength
Instance Attribute Summary collapse
-
#configuration ⇒ Object
readonly
Returns the value of attribute configuration.
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
Instance Method Summary collapse
-
#actions ⇒ Object
Resource accessors.
- #agents ⇒ Object
- #appointments ⇒ Object
- #assets ⇒ Object
- #clients ⇒ Object
- #contracts ⇒ Object
- #delete(path) ⇒ Object
-
#get(path, params = {}) ⇒ Object
HTTP methods.
-
#initialize(configuration = nil) ⇒ Client
constructor
A new instance of Client.
- #integrations ⇒ Object
- #invoices ⇒ Object
- #knowledge_base ⇒ Object
- #organisations ⇒ Object
- #patch(path, body = {}) ⇒ Object
- #post(path, body = {}) ⇒ Object
- #products ⇒ Object
- #purchase_orders ⇒ Object
- #put(path, body = {}) ⇒ Object
- #quotations ⇒ Object
- #reports ⇒ Object
- #sales_orders ⇒ Object
- #services ⇒ Object
- #slas ⇒ Object
- #suppliers ⇒ Object
- #tickets ⇒ Object
- #users ⇒ Object
- #webhooks ⇒ Object
Constructor Details
#initialize(configuration = nil) ⇒ Client
Returns a new instance of Client.
13 14 15 16 17 18 19 20 |
# File 'lib/halo_msp_api/client.rb', line 13 def initialize(configuration = nil) @configuration = configuration || HaloMspApi.configuration raise ConfigurationError, 'Configuration is required' unless @configuration&.valid? @connection = build_connection @access_token = nil @token_expires_at = nil end |
Instance Attribute Details
#configuration ⇒ Object (readonly)
Returns the value of attribute configuration.
11 12 13 |
# File 'lib/halo_msp_api/client.rb', line 11 def configuration @configuration end |
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
11 12 13 |
# File 'lib/halo_msp_api/client.rb', line 11 def connection @connection end |
Instance Method Details
#actions ⇒ Object
Resource accessors
23 24 25 |
# File 'lib/halo_msp_api/client.rb', line 23 def actions @actions ||= Resources::Actions.new(self) end |
#agents ⇒ Object
27 28 29 |
# File 'lib/halo_msp_api/client.rb', line 27 def agents @agents ||= Resources::Agents.new(self) end |
#appointments ⇒ Object
31 32 33 |
# File 'lib/halo_msp_api/client.rb', line 31 def appointments @appointments ||= Resources::Appointments.new(self) end |
#assets ⇒ Object
35 36 37 |
# File 'lib/halo_msp_api/client.rb', line 35 def assets @assets ||= Resources::Assets.new(self) end |
#clients ⇒ Object
39 40 41 |
# File 'lib/halo_msp_api/client.rb', line 39 def clients @clients ||= Resources::Clients.new(self) end |
#contracts ⇒ Object
43 44 45 |
# File 'lib/halo_msp_api/client.rb', line 43 def contracts @contracts ||= Resources::Contracts.new(self) end |
#delete(path) ⇒ Object
124 125 126 |
# File 'lib/halo_msp_api/client.rb', line 124 def delete(path) request(:delete, path) end |
#get(path, params = {}) ⇒ Object
HTTP methods
108 109 110 |
# File 'lib/halo_msp_api/client.rb', line 108 def get(path, params = {}) request(:get, path, params) end |
#integrations ⇒ Object
47 48 49 |
# File 'lib/halo_msp_api/client.rb', line 47 def integrations @integrations ||= Resources::Integrations.new(self) end |
#invoices ⇒ Object
51 52 53 |
# File 'lib/halo_msp_api/client.rb', line 51 def invoices @invoices ||= Resources::Invoices.new(self) end |
#knowledge_base ⇒ Object
55 56 57 |
# File 'lib/halo_msp_api/client.rb', line 55 def knowledge_base @knowledge_base ||= Resources::KnowledgeBase.new(self) end |
#organisations ⇒ Object
59 60 61 |
# File 'lib/halo_msp_api/client.rb', line 59 def organisations @organisations ||= Resources::Organisations.new(self) end |
#patch(path, body = {}) ⇒ Object
120 121 122 |
# File 'lib/halo_msp_api/client.rb', line 120 def patch(path, body = {}) request(:patch, path, body) end |
#post(path, body = {}) ⇒ Object
112 113 114 |
# File 'lib/halo_msp_api/client.rb', line 112 def post(path, body = {}) request(:post, path, body) end |
#products ⇒ Object
63 64 65 |
# File 'lib/halo_msp_api/client.rb', line 63 def products @products ||= Resources::Products.new(self) end |
#purchase_orders ⇒ Object
67 68 69 |
# File 'lib/halo_msp_api/client.rb', line 67 def purchase_orders @purchase_orders ||= Resources::PurchaseOrders.new(self) end |
#put(path, body = {}) ⇒ Object
116 117 118 |
# File 'lib/halo_msp_api/client.rb', line 116 def put(path, body = {}) request(:put, path, body) end |
#quotations ⇒ Object
71 72 73 |
# File 'lib/halo_msp_api/client.rb', line 71 def quotations @quotations ||= Resources::Quotations.new(self) end |
#reports ⇒ Object
75 76 77 |
# File 'lib/halo_msp_api/client.rb', line 75 def reports @reports ||= Resources::Reports.new(self) end |
#sales_orders ⇒ Object
91 92 93 |
# File 'lib/halo_msp_api/client.rb', line 91 def sales_orders @sales_orders ||= Resources::SalesOrders.new(self) end |
#services ⇒ Object
79 80 81 |
# File 'lib/halo_msp_api/client.rb', line 79 def services @services ||= Resources::Services.new(self) end |
#slas ⇒ Object
95 96 97 |
# File 'lib/halo_msp_api/client.rb', line 95 def slas @slas ||= Resources::Slas.new(self) end |
#suppliers ⇒ Object
99 100 101 |
# File 'lib/halo_msp_api/client.rb', line 99 def suppliers @suppliers ||= Resources::Suppliers.new(self) end |
#tickets ⇒ Object
83 84 85 |
# File 'lib/halo_msp_api/client.rb', line 83 def tickets @tickets ||= Resources::Tickets.new(self) end |
#users ⇒ Object
87 88 89 |
# File 'lib/halo_msp_api/client.rb', line 87 def users @users ||= Resources::Users.new(self) end |
#webhooks ⇒ Object
103 104 105 |
# File 'lib/halo_msp_api/client.rb', line 103 def webhooks @webhooks ||= Resources::Webhooks.new(self) end |