brapi refactor error response
[sgn.git] / lib / CXGN / BrAPI.pm
blobbe3baa1ba24a37effa2defcb49d390fe14a6c487
1 package CXGN::BrAPI;
3 use Moose;
4 use Data::Dumper;
5 use CXGN::BrAPI::v1::Authentication;
6 use CXGN::BrAPI::v1::Calls;
7 use CXGN::BrAPI::v1::Crops;
8 use CXGN::BrAPI::v1::ObservationVariables;
9 use CXGN::BrAPI::v1::Studies;
10 use CXGN::BrAPI::v1::Germplasm;
11 use CXGN::BrAPI::v1::GermplasmAttributes;
12 use CXGN::BrAPI::v1::Trials;
13 use CXGN::BrAPI::v1::Markerprofiles;
14 use CXGN::BrAPI::v1::Programs;
15 use CXGN::BrAPI::v1::Locations;
16 use CXGN::BrAPI::v1::Phenotypes;
17 use CXGN::BrAPI::v1::Traits;
18 use CXGN::BrAPI::v1::GenomeMaps;
20 has 'version' => (
21 isa => 'Str',
22 is => 'rw',
23 required => 1,
26 has 'brapi_module_inst' => (
27 isa => 'HashRef',
28 is => 'rw',
29 required => 1,
32 sub brapi_wrapper {
33 my $self = shift;
34 my $module = shift;
36 my $brapi_package = 'CXGN::BrAPI::'.$self->version().'::'.$module;
37 push @{$self->brapi_module_inst->{status}}, { 'info' => "Loading $brapi_package" };
38 my $brapi_module = $brapi_package->new($self->brapi_module_inst);
39 return $brapi_module;