<commit_before>require_relative './presenter'

module Evercam
  module Presenters
    class CameraShare < Presenter

    	root :shares

    	expose :id,
    	       documentation: {
    	       	 type: 'integer',
    	       	 desc: 'Unique identifier for a camera share.',
    	       	 required: true
    	       }

    	expose :camera_id,
    	       documentation: {
    	       	 type: 'string',
    	       	 desc: 'Unique identifier of the shared camera.',
    	       	 required: true
    	       } do |s, o|
    	  s.camera.exid
    	end

    	expose :user_id,
    	       documentation: {
    	       	 type: 'integer',
    	       	 desc: 'Unique user id of the user the camera is shared with.',
    	       	 required: true
    	       } do |s, o|
    	  s.sharer.id
    	end

    	expose :email,
    	       documentation: {
    	       	 type: 'string',
    	       	 desc: 'The email address of the user the camera is shared with.',
    	       	 required: true
    	       } do |s, o|
    	  s.sharer.email
    	end

      expose :kind,
             documentation: {
         	     type: 'string',
         	     desc: "Either 'public' or 'private' depending on the share kind.",
         	     required: true
             }

      expose :rights,
             documentation: {
             	type: 'string',
             	desc: "A comma separated list of the rights available on the share.",
             	required: true
             	} do |s, o|
        list = []
        if s.kind == 'private'
        	rights = AccessRightSet.for(s.camera, s.sharer)
        	list << "Snapshot" if rights.allow?(AccessRight::SNAPSHOT)
        	list << "View" if rights.allow?(AccessRight::VIEW)
        	list << "Edit" if rights.allow?(AccessRight::EDIT)<commit_msg>Corrected an issue in the camera share presenter.<commit_after>require_relative './presenter'

module Evercam
  module Presenters
    class CameraShare < Presenter

    	root :shares

    	expose :id,
    	       documentation: {
    	       	 type: 'integer',
    	       	 desc: 'Unique identifier for a camera share.',
    	       	 required: true
    	       }

    	expose :camera_id,
    	       documentation: {
    	       	 type: 'string',
    	       	 desc: 'Unique identifier of the shared camera.',
    	       	 required: true
    	       } do |s, o|
    	  s.camera.exid
    	end

      expose :sharer_id,
             documentation: {
                type: 'string',
                desc: 'The unique identifier of the user who shared the camera.',
                required: true
             } do |s,o|
         s.sharer ? s.sharer.username : nil
      end

    	expose :user_id,
    	       documentation: {
    	       	 type: 'string',
    	       	 desc: 'Unique user id of the user the camera is shared with.',
    	       	 required: true
    	       } do |s, o|
    	  s.user.username
    	end

    	expose :email,
    	       documentation: {
    	       	 type: 'string',
    	       	 desc: 'The email address of the user the camera is shared with.',
    	       	 required: true
    	       } do |s, o|
    	  s.user.email
    	end

      expose :kind,
             documentation: {
         	     type: 'string',
         	     desc: "Either 'public' or 'private' depending on the share kind.",
         	     required: true
             }

      expose :rights,
             documentation: {
             	type: 'string',
             	desc: "A comma separated list of the rights available on the share.",
             	required: true
             	} do |s, o|
        list = []
        if s.kind == 'private'
        	rights = AccessRightSet.for(s.camera, s.sharer)
        	list << "Snapshot" if rights.allow?(AccessRight::SNAPSHOT)
        	list << "View" if rights.allow?(AccessRight::VIEW)
        	list << "Edit" if rights.allow?(AccessRight::EDIT)
{'fraction_non_alphanumeric': 0.09241952232606439, 'fraction_numerical': 0.0, 'mean_word_length': 1.4036182158452901, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7051202', 'n_tokens_mistral': 1155, 'n_tokens_neox': 1132, 'n_words': 330}