diff options
author | Christopher Burger <burgerc@freeside.biz> | 2017-08-21 12:40:42 -0400 |
---|---|---|
committer | Christopher Burger <burgerc@freeside.biz> | 2017-08-22 06:56:11 -0400 |
commit | 4badfc838e1c211bc02be232ff526e141f266156 (patch) | |
tree | 69a7027966938ad76837293247b15e72a60017d0 /FS | |
parent | bee715764bba15af9ac9868287dc22f648b472bd (diff) |
RT# 27969 - added documentation for advertising_sources api functions
Diffstat (limited to 'FS')
-rw-r--r-- | FS/FS/API.pm | 142 |
1 files changed, 142 insertions, 0 deletions
diff --git a/FS/FS/API.pm b/FS/FS/API.pm index 735088f..f9cc37e 100644 --- a/FS/FS/API.pm +++ b/FS/FS/API.pm @@ -721,6 +721,34 @@ sub bill_now { #next.. Delete Advertising sources? +=item list_advertising_sources OPTION => VALUE, ... + +Lists all advertising sources. + +=over + +=item secret + +API Secret + +=back + +Example: + + my $result = FS::API->list_advertising_sources( + 'secret' => 'sharingiscaring', + ); + + if ( $result->{'error'} ) { + die $result->{'error'}; + } else { + # list advertising sources returns an array of hashes for sources. + print Dumper($result->{'sources'}); + } + +=cut + +#list_advertising_sources sub list_advertising_sources { my( $class, %opt ) = @_; return _shared_secret_error() unless _check_shared_secret($opt{secret}); @@ -735,6 +763,56 @@ sub list_advertising_sources { $return; } +=item add_advertising_source OPTION => VALUE, ... + +Add a new advertising source. + +=over + +=item secret + +API Secret + +=item referral + +Referral name + +=item disabled + +Referral disabled, Y for disabled or nothing for enabled + +=item agentnum + +Agent ID number + +=item title + +External referral ID + +=back + +Example: + + my $result = FS::API->add_advertising_source( + 'secret' => 'sharingiscaring', + 'referral' => 'test referral', + + #optional + 'disabled' => 'Y', + 'agentnum' => '2', #agent id number + 'title' => 'test title', + ); + + if ( $result->{'error'} ) { + die $result->{'error'}; + } else { + # add_advertising_source returns new source upon success. + print Dumper($result); + } + +=cut + +#add_advertising_source sub add_advertising_source { my( $class, %opt ) = @_; return _shared_secret_error() unless _check_shared_secret($opt{secret}); @@ -753,6 +831,70 @@ sub add_advertising_source { $return; } +=item edit_advertising_source OPTION => VALUE, ... + +Edit a advertising source. + +=over + +=item secret + +API Secret + +=item refnum + +Referral number to edit + +=item source + +hash of edited source fields. + +=over + +=item referral + +Referral name + +=item disabled + +Referral disabled, Y for disabled or nothing for enabled + +=item agentnum + +Agent ID number + +=item title + +External referral ID + +=back + +=back + +Example: + + my $result = FS::API->edit_advertising_source( + 'secret' => 'sharingiscaring', + 'refnum' => '4', # referral number to edit + 'source' => { + #optional + 'referral' => 'test referral', + 'disabled' => 'Y', + 'agentnum' => '2', #agent id number + 'title' => 'test title', + } + ); + + if ( $result->{'error'} ) { + die $result->{'error'}; + } else { + # edit_advertising_source returns updated source upon success. + print Dumper($result); + } + +=cut + +#edit_advertising_source sub edit_advertising_source { my( $class, %opt ) = @_; return _shared_secret_error() unless _check_shared_secret($opt{secret}); |