lib/artemis_api/subscription.rb in artemis_api-0.5.1 vs lib/artemis_api/subscription.rb in artemis_api-0.7.4

- old
+ new

@@ -9,21 +9,21 @@ def self.find_all(facility_id:, client:, include: nil) client.find_all(self.json_type, facility_id: facility_id, include: include) end def self.create(facility_id:, subject:, destination:, client:) - client.oauth_token.refresh! if client.oauth_token.expired? + client.auto_refresh! url = "#{client.options[:base_uri]}/api/v3/facilities/#{facility_id}/subscriptions" params = { body: { subscription: { subject: subject, destination: destination } } } response = client.oauth_token.post(url, params) response.status == 200 ? client.process_response(response, 'subscriptions') : false end def self.delete(id:, facility_id:, client:) - client.oauth_token.refresh! if client.oauth_token.expired? + client.auto_refresh! url = "#{client.options[:base_uri]}/api/v3/facilities/#{facility_id}/subscriptions/#{id}" response = client.oauth_token.delete(url) client.remove_record('subscriptions', id) if response.status == 204