Sha256: b644d807924d86c3e66c29d6a6b89bc7c0584cc174fdc63b4cc741bf401bfa78
Contents?: true
Size: 1.04 KB
Versions: 17
Compression:
Stored size: 1.04 KB
Contents
class Zendesk2::Client class Real def create_ticket(params={}) request( :body => {"ticket" => params}, :method => :post, :path => "/tickets.json", ) end end # Real class Mock def create_ticket(params={}) identity = self.class.new_id record = { "id" => identity, "url" => url_for("/tickets/#{identity}.json"), "created_at" => Time.now.iso8601, "updated_at" => Time.now.iso8601, "collaborator_ids" => [], }.merge(params) record["requester_id"] ||= @current_user_id record["submitter_id"]= @current_user_id requester = self.data[:users][record["requester_id"]] # TODO: throw error if user doesn't exist? record["organization_id"]= requester["organization_id"] self.data[:tickets][identity]= record response( :method => :post, :body => {"ticket" => record}, :path => "/tickets.json" ) end end # Mock end # Zendesk2::Client
Version data entries
17 entries across 17 versions & 1 rubygems