There are a bunch of ways to do this. The _TextEditor->Templates->Python->Operator simple_ has an example of the Operator syntax.

Here's a rather brutish interpretation of what you want:

    import bpy
    
    class ClaasVisibilitySwitch(bpy.types.Operator):
        """Tooltip"""
        bl_idname = "claas.visibility_switch"
        bl_label = "Simple Object Operator"
        
        func = bpy.props.IntProperty(description='0 is off, 1 is on')
     
        def execute(self, context):
            ob = context.object
            visibility = ob.cycles_visibility
    
            attributes = ["camera", "diffuse", "glossy", "transmission", "scatter"]
            for attr in attributes:        
                setattr(visibility, attr, bool(self.func))
    
            return {'FINISHED'}
    
    class ObjectModifier(bpy.types.Panel):
        bl_label = "ObjectModifier"
        bl_idname = "ObjectModifier"
        bl_space_type = 'VIEW_3D'
        bl_region_type = 'TOOLS'
        bl_category = "Claas"
        
        # uncommenting this will make the panel be invisible if no
        # objects are selected/active.
        # @classmethod
        # def poll(cls, context):
        #     return context.active_object is not None    
    
        def draw(self, context):
            layout = self.layout
    
            scene = context.scene
            cscene = scene.cycles
            ob = context.object
            
            # if you have a poll function like above, then early returns
            # like this aren't needed.
            if not context.object:
                layout.row().label('no active objects')
                # finish drawing early
                return
                        
            cob = ob.cycles
            visibility = ob.cycles_visibility
    
            layout.label(text="Ray Visibility:")
            row = layout.row()
            row.operator('claas.visibility_switch',text='on').func = 1
            row.operator('claas.visibility_switch',text='off').func = 0
            
            flow = layout.column_flow()
    
            flow.prop(visibility, "camera")
            flow.prop(visibility, "diffuse")
            flow.prop(visibility, "glossy")
            flow.prop(visibility, "transmission")
            flow.prop(visibility, "scatter")
    
    
    def register(): bpy.utils.register_module(__name__)
    def unregister(): bpy.utils.unregister_module(__name__)
    if __name__ == "__main__": register()

 
[![enter image description here][1]][1]

I imagine you might want a single button that has _states_, like a BoolProperty.

  [1]: https://i.sstatic.net/UsUGL.png