class FimmedUp::Client
Public Class Methods
new(options={})
click to toggle source
# File lib/fimmed_up/client.rb, line 14 def initialize(options={}) # Merge the config values from the module and those passed # to the client. merged_options = FimmedUp.options.merge(options) # Copy the merged values to this client and ignore those # not part of our configuration Configuration::VALID_CONFIG_KEYS.each do |key| send("#{key}=", merged_options[key]) end end
Public Instance Methods
count()
click to toggle source
# File lib/fimmed_up/client.rb, line 47 def count self.get("#{resource}/count", parameters, {}).to_i end
create(args)
click to toggle source
# File lib/fimmed_up/client.rb, line 39 def create(args) json(self.post(resource, args, {})) end
delete(id, args)
click to toggle source
# File lib/fimmed_up/client.rb, line 51 def delete(id, args) self.delete("#{resource}/#{id}", args, {}) end
find(id)
click to toggle source
# File lib/fimmed_up/client.rb, line 25 def find(id) record = self.get("#{resource}/#{id}", {}, {}) if record != "" json(record)[0] else { "error" => "Not Found" } end end
update(id, args)
click to toggle source
# File lib/fimmed_up/client.rb, line 34 def update(id, args) record = self.patch("#{resource}/#{id}", args, {}) if record && record != "" then json(record) else { "error" => "Not Found" } end end
updated_count()
click to toggle source
# File lib/fimmed_up/client.rb, line 43 def updated_count self.get("#{resource}/updatedtoday/count", parameters, {}).to_i end