Sha256: d28fe4af65bf54bfa01063f53d4bada159d2f5e155d024d0f06a850a18e476cd
Contents?: true
Size: 913 Bytes
Versions: 1
Compression:
Stored size: 913 Bytes
Contents
$: << 'lib' require 'cic/active_cic' module Cic class Report < ActiveCic::Base def initialize(hash) super(hash) end def self.find(ticket) response = self.get("/reports.json") if response.success? report_hash = response.parsed_response["reports"].select { |report| report['ticket'] == ticket }.first report_hash ? self.new(report_hash) : nil else raise_exception(response.code, response.body) end end def save self.class.post("/reports.json", body: self.raw_attributes ) true #POST always finds its way... end def self.where(params = {}) response = self.get("/reports.json", query: params) if response.success? response.parsed_response['reports'].map { |report_hash| self.new(report_hash) } else raise_exception(response.code, response.body) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cic-1.0.0 | lib/cic/report.rb |