FreeMED-Relay

 view release on metacpan or  search on metacpan

lib/FreeMED/Relay.pm  view on Meta::CPAN

	my $self = {};
	bless $self, $class;
	$self->{'debug'} = $debug;
	$self->_init();
	$JSON::UnMapping = 1;
	$JSON::QuotApos = 1;
	$JSON::BareKey = 1;
	return $self;
}

sub set_credentials {
	my $self = shift;

	my ( $base_uri, $username, $password ) = @_;
	print "base_uri = $base_uri\n" if $self->{'debug'};
	print "username = $username\n" if $self->{'debug'};
	print "password = $password\n" if $self->{'debug'};
	$self->{base_uri} = $base_uri;
	$self->{username} = $username;
	$self->{password} = $password;
}

sub login {
	my $self = shift;
	if (!defined($self->{username}) or !defined($self->{password})) {
		die "login(): Must set credentials before logging in\n";
	}

	$self->_init() if (!defined($self->{ua}));
	my $login = $self->call(
		'org.freemedsoftware.public.Login.Validate',
		$self->{'username'},
		$self->{'password'},
	);
	$self->{'logged_in'} = true;
	return $login;

lib/FreeMED/Relay.pm  view on Meta::CPAN

=head1 METHODS

=over 4

=item new ( %options )

Returns a FreeMED::Relay object.

C<new> takes "debug" as a boolean argument.

=item set_credentials ( $base_uri, $username, $password )

Sets the credentials used to access the FreeMED installation in question. The
C<$base_uri> variable should be the base name of the installation, such as
"http://localhost/freemed".

=item login ( )

Log into the specified installation of FreeMED. Returns true or false
depending on whether or not it is successful.

=item call ( $method, $params ... )



( run in 0.230 second using v1.01-cache-2.11-cpan-4d50c553e7e )