summaryrefslogtreecommitdiff
path: root/FS/FS/Record.pm
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2014-07-17 06:45:02 -0700
committerIvan Kohler <ivan@freeside.biz>2014-07-17 06:45:02 -0700
commit8c39dadbacacbceec1bc0b6c5fbf1468b0d3cf32 (patch)
tree97b7619688cdd5f417458e93ad1736e7352b902b /FS/FS/Record.pm
parent7943c96636596806b9fc99195c23b166728280c8 (diff)
REST API, RT#28181
Diffstat (limited to 'FS/FS/Record.pm')
-rw-r--r--FS/FS/Record.pm16
1 files changed, 15 insertions, 1 deletions
diff --git a/FS/FS/Record.pm b/FS/FS/Record.pm
index b226e17..24f2a25 100644
--- a/FS/FS/Record.pm
+++ b/FS/FS/Record.pm
@@ -1127,13 +1127,27 @@ sub hashref {
$self->{'Hash'};
}
-#fallback
+#fallbacks/generics
+
sub API_getinfo {
my $self = shift;
+{ ( map { $_=>$self->$_ } $self->fields ),
};
}
+sub API_insert {
+ my( $class, %opt ) = @_;
+ my $table = $class->table;
+ my $self = $class->new( { map { $_ => $opt{$_} } fields($table) } );
+ my $error = $self->insert;
+ return +{ 'error' => $error } if $error;
+ my $pkey = $self->pkey;
+ return +{ 'error' => '',
+ 'primary_key' => $pkey,
+ $pkey => $self->$pkey,
+ };
+}
+
=item modified
Returns true if any of this object's values have been modified with set (or via