lib/dhis2/api/base.rb in dhis2-2.3.5 vs lib/dhis2/api/base.rb in dhis2-2.3.6
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
module Dhis2
module Api
class Base < OpenStruct
class << self
def inherited(base)
@@ -77,11 +79,11 @@
end
end
end
def initialize(client, raw_data)
- raw_data["display_name"] ||= raw_data["name"] # for backward compatbility with v2.19
+ raw_data["display_name"] ||= raw_data["name"] # for backward compatbility with v2.19
super(raw_data)
self.client = client
end
def update_attributes(attributes)
@@ -91,16 +93,16 @@
end
self
end
def add_relation(relation, relation_id)
- client.post("#{self.class.resource_name}/#{id}/#{relation}/#{relation_id}",{})
+ client.post("#{self.class.resource_name}/#{id}/#{relation}/#{relation_id}", {})
self
end
def remove_relation(relation, relation_id)
- client.delete("#{self.class.resource_name}/#{id}/#{relation}/#{relation_id}",{})
+ client.delete("#{self.class.resource_name}/#{id}/#{relation}/#{relation_id}", {})
self
end
def delete
client.delete("#{self.class.resource_name}/#{id}")
@@ -110,10 +112,10 @@
def ==(other)
self.class == other.class && id == other.id
end
def update
- client.put("#{self.class.resource_name}/#{id}", self.to_h)
+ client.put("#{self.class.resource_name}/#{id}", to_h)
end
end
end
end