pot::Client when it you execute methods that return contact objects. It is created from a blob of JSON taken from the HubSpot API, and so goes stale immediately.
=head1 METHODS
=cut
# Make us a cla
e
};
use parent 'HubSpot::JSONBackedObject';
sub BUILD
{
my $self = shift;
if($self->json)
{
$self->{'id'} = $self->json->{'vid'};
$self->{'firstName'} = $self->json->{'properties'}->{'first
json->{'properties'}->{'lastname'}->{'value'};
$self->{'company'} = $self->json->{'properties'}->{'company'}->{'value'};
$self->{'lastModifiedDateTime'} = DateTime->from_epoch(epoch => $self->json
err is in utf8
use strict;
# Modules
#use Log::Log4perl;
use REST::Client;
use Data::Dumper;
use JSON;
use HubSpot::Contact;
use HubSpot::Deal;
use HubSpot::Owner;
=pod
=head1 NAME
HubSpot::Client
'demo',
hub_id => '62515',
};
# Global variables
my $api_url = 'https://api.hubapi.com';
my $json = JSON->new;
sub BUILD
{
my $self = shift;
# Create ourselves a rest client to use
$self->rest
;
#~ $count = 100 unless defined $count; # Max allowed by the API
#~ my $results = $json->decode($self->_get('/deals/v1/deal/recent/modified', { count => $count }));
#~ my $deals = $res
ke us a class
use Class::Tiny qw(json),
{
# Default variables in here
};
use parent 'HubSpot::JSONBackedObject';
sub name
{
my $self = shift;
return $self->json->{'properties'}->{'dealname'}->{
'value'};
}
sub id
{
my $self = shift;
return $self->json->{'dealId'};
}
sub logMeeting()
{
my $self = shift;
my $content = shift;
my $time = shift;
}
1;
package HubSpot::JSONBackedObject;
our $VERSION = "0.1";
use open qw/:std :utf8/; # tell perl that stdout, stdin and stderr is in utf8
use strict;
# Classes we need
use Data::Dumper;
# Make us a cla
),
{
json => undef,
};
sub BUILD
{
my ($self, $args) = @_;
if(defined($args->{'json'}))
{
# Not actually JSON but a perl object derived from the JSON response
$self->json($args->{'json'});
}
if(defined($self->json->{'properties'}))
{ # If this object has a properties key (which probably most of them will)
# pull it out as a hash that is a little easier to access
$self->properti