Convos::Core - Convos backend

  1. DESCRIPTION
  2. SYNOPSIS
  3. OBJECT GRAPH
  4. ATTRIBUTES
    1. backend
    2. home
    3. log
    4. ready
  5. METHODS
    1. connection_profile
    2. get_connection_profile
    3. connection_profiles
    4. connections_by_id
    5. get_user
    6. get_user_by_uid
    7. new
    8. remove_connection_profile_p
    9. remove_user_p
    10. start
    11. user
    12. users
    13. web_url
  6. SEE ALSO

DESCRIPTION

Convos::Core is the heart of the Convos backend.

SYNOPSIS

use Convos::Core;
use Convos::Core::Backend::File;
my $core = Convos::Core->new(backend => Convos::Core::Backend::File->new);

OBJECT GRAPH

All the child objects have pointers back to the parent object.

ATTRIBUTES

Convos::Core inherits all attributes from Mojo::Base and implements the following new ones.

backend

$obj = $core->backend;

Holds a Convos::Core::Backend object.

home

$obj = $core->home;
$core = $core->home(Mojo::File->new($ENV{CONVOS_HOME});

Holds a Mojo::File object pointing to where Convos store data.

log

$log = $core->log;
$core = $core->log(Mojo::Log->new);

Holds a Mojo::Log object.

ready

$bool = $core->ready;

Will be true if the backend has loaded initial data.

METHODS

Convos::Core inherits all methods from Mojo::Base and implements the following new ones.

connection_profile

$profile = $core->connection_profile({id => $connection_id, ...});

Returns a shared Convos::Core::ConnectionProfile object for a connection ID.

get_connection_profile

$user = $core->get_connection_profile(\%attrs);
$user = $core->get_connection_profile($email);

Returns a Convos::Core::User object or undef.

connection_profiles

$collection = $core->connection_profiles;

Returns a Mojo::Collection of all known Convos::Core::ConnectionProfile objects.

connections_by_id

$collection = $core->connections_by_id($cid);

Finds all Convos::Core::Connection objects where id() matches $cid.

get_user

$user = $core->get_user(\%attrs);
$user = $core->get_user($email);

Returns a Convos::Core::User object or undef.

get_user_by_uid

$user = $core->get_user_by_uid($uid);

Returns a Convos::Core::User object or undef.

new

$core = Convos::Core->new(%attrs);
$core = Convos::Core->new(\%attrs);

Object constructor. Builds "backend" if a classname is provided.

remove_connection_profile_p

$p = $core->remove_connection_profile_p($profile)->then(sub { $profile });

Used to delete a connection profile.

remove_user_p

$p = $core->remove_user_p($user)->then(sub { $user });

Used to delete user data and remove the user from $core.

start

$core = $core->start;

Will start the backend. This means finding all users and start connections if state is not "disconnected".

user

$user = $core->user(\%attrs);

Returns a new Convos::Core::User object or updates an existing object.

users

$users = $core->users;

Returns an array-ref of of Convos::Core::User objects.

web_url

$url = $core->web_url($url);

Takes a path, or complete URL, merges it with "base_url" in Convos::Core::Settings and returns a new Mojo::URL object. Note that you need to call "to_abs" on that object for an absolute URL.

SEE ALSO

Convos.