module Roqua module CoreApi module Sessions class OrganizationSession < AppSession attr_reader :organization def initialize(organization, key, server = ENV["CORE_URL"]) @organization = organization super(key, server) end def create_dossier(attributes) response = post "/dossiers", dossier: attributes fail response.inspect unless response.code == 201 Models::Dossier.new(response) end def dossier_session(attributes) if attributes.is_a? Models::Dossier dossier = attributes else dossier = create_dossier(attributes) end DossierSession.new dossier, organization, key, server end private def base_url super + "/organizations/#{organization.id}" end end end end end