Leads.pm

filter: Statementstmt 50.0% 10 / 20 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 37.5% 3 / 8 Podpod 100% 5 / 5 totaltotal 54.5% 18 / 33 CC 1 SCAR 4.9
CC
1
Cov
50%
ListLeads
2.0
GetLead
2.0
CreateLead
2.0
CRAP 1.6
« Keys.pm ↑ Summary LeadsAttributes.pm »
1 package Tomba::Leads;
2  
3 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 ▶use parent 'Tomba::Client';
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 =head1 NAME
8  
9 Tomba::Leads - Leads management for the Tomba.io API
10  
11 =head1 SYNOPSIS
12  
13 use Tomba::Leads;
14  
15 my $tomba = Tomba::Leads->new("ta_xxxxx", "ts_xxxxx");
16 my $leads = $tomba->ListLeads();
17  
18 =head1 DESCRIPTION
19  
20 Create, read, update, and delete leads.
21  
22 =cut
23  
24 #-------------------------------------------------------------------------------
25 # Leads Management
26 #-------------------------------------------------------------------------------
27  
28 =head2 ListLeads
29  
30 my $data = $tomba->ListLeads();
31 my $data = $tomba->ListLeads({ domain => "tomba.io", page => 1, limit => 10 });
32  
33 Retrieve a paginated list of leads. Optionally filter by domain.
34  
35 See L<https://docs.tomba.io/api/leads#retrieve-a-single-leads>
36  
37 =cut
38  
39 0 ▶sub ListLeads {
Subroutine ListLeads: not called CC=1 SCAR=6.9
Pod documented
40 0 my ($self, $params) = @_;
41 0 return $self->call(Tomba::Client::LEADS_PATH, $params);
42 }
43  
44 =head2 GetLead
45  
46 my $data = $tomba->GetLead($lead_id);
47  
48 Retrieve detailed information for a specific lead.
49  
50 See L<https://docs.tomba.io/api/leads#retrieve-a-single-leads-leadid>
51  
52 =cut
53  
54 0 ▶sub GetLead {
Subroutine GetLead: not called CC=1 SCAR=6.9
Pod documented
55 0 my ($self, $lead_id) = @_;
56 0 return $self->call(Tomba::Client::LEADS_PATH . "/$lead_id");
57 }
58  
59 =head2 CreateLead
60  
61 my $data = $tomba->CreateLead({
62 email => "test@example.com",
63 first_name => "John",
64 last_name => "Doe",
65 company => "Example Inc",
66 });
67  
68 Create a new lead. If the email already exists, fails with 422 status code.
69  
70 See L<https://docs.tomba.io/api/leads#post-leads>
71  
72 =cut
73  
74 0 ▶sub CreateLead {
Subroutine CreateLead: not called CC=1 SCAR=6.9
Pod documented
75 0 my ($self, $body) = @_;
76 0 return $self->post(Tomba::Client::LEADS_PATH, $body);
77 }
78  
79 =head2 UpdateLead
80  
81 my $data = $tomba->UpdateLead($lead_id, { first_name => "Jane" });
82  
83 Update the fields of a lead using its ID.
84  
85 See L<https://docs.tomba.io/api/leads#put-leads-leadid>
86  
87 =cut
88  
89 0 ▶sub UpdateLead {
Subroutine UpdateLead: not called CC=1 SCAR=6.9
Pod documented
90 0 my ($self, $lead_id, $body) = @_;
91 0 return $self->put(Tomba::Client::LEADS_PATH . "/$lead_id", $body);
92 }
93  
94 =head2 DeleteLead
95  
96 my $data = $tomba->DeleteLead($lead_id);
97  
98 Delete a lead using its ID.
99  
100 See L<https://docs.tomba.io/api/leads#delete-a-leads-leadid>
101  
102 =cut
103  
104 0 ▶sub DeleteLead {
Subroutine DeleteLead: not called CC=1 SCAR=6.9
Pod documented
105 0 my ($self, $lead_id) = @_;
106 0 return $self->delete_request(Tomba::Client::LEADS_PATH . "/$lead_id");
107 }
108  
109 4 1;
110 __END__
« Keys.pm ↑ Summary LeadsAttributes.pm »