Google-RestApi

 view release on metacpan or  search on metacpan

lib/Google/RestApi/CalendarApi3/Acl.pm  view on Meta::CPAN

  my $p = $check->(@_);

  $self->require_id('get');

  my %params;
  $params{fields} = $p->{fields} if defined $p->{fields};

  return $self->api(params => \%params);
}

sub update {
  my $self = shift;
  state $check = signature(
    bless => !!0,
    named => [
      role    => Str,
      _extra_ => slurpy HashRef,
    ],
  );
  my $p = named_extra($check->(@_));

lib/Google/RestApi/CalendarApi3/Calendar.pm  view on Meta::CPAN

    ],
  );
  my $p = $check->(@_);

  my $params = $p->{params};
  $params->{fields} = $p->{fields} if defined $p->{fields};

  return $self->api(params => $params);
}

sub update {
  my $self = shift;
  state $check = signature(
    bless => !!0,
    named => [
      summary     => Str, { optional => 1 },
      description => Str, { optional => 1 },
      location    => Str, { optional => 1 },
      time_zone   => Str, { optional => 1 },
      _extra_     => slurpy HashRef,
    ],

lib/Google/RestApi/CalendarApi3/CalendarList.pm  view on Meta::CPAN


  DEBUG(sprintf("Inserting calendar '%s' into calendar list", $content{id}));
  my $result = $self->calendar_api()->api(
    uri     => 'users/me/calendarList',
    method  => 'post',
    content => \%content,
  );
  return ref($self)->new(calendar_api => $self->calendar_api(), id => $result->{id});
}

sub update {
  my $self = shift;
  state $check = signature(
    bless => !!0,
    named => [
      summary_override => Str, { optional => 1 },
      color_id         => Str, { optional => 1 },
      hidden           => Bool, { optional => 1 },
      selected         => Bool, { optional => 1 },
      _extra_          => slurpy HashRef,
    ],

lib/Google/RestApi/CalendarApi3/Event.pm  view on Meta::CPAN

  my $p = $check->(@_);

  $self->require_id('get');

  my %params;
  $params{fields} = $p->{fields} if defined $p->{fields};

  return $self->api(params => \%params);
}

sub update {
  my $self = shift;
  state $check = signature(
    bless => !!0,
    named => [
      summary     => Str, { optional => 1 },
      description => Str, { optional => 1 },
      location    => Str, { optional => 1 },
      start       => HashRef, { optional => 1 },
      end         => HashRef, { optional => 1 },
      attendees   => ArrayRef[HashRef], { optional => 1 },

lib/Google/RestApi/DocsApi1/Document.pm  view on Meta::CPAN

      containsText => {
        text      => $p->{find},
        matchCase => $p->{match_case} ? JSON::MaybeXS::true() : JSON::MaybeXS::false(),
      },
      replaceText => $p->{replacement},
    },
  );
  return $self;
}

sub update_text_style {
  my $self = shift;
  state $check = signature(
    bless => !!0,
    named => [
      range  => HashRef,
      style  => HashRef,
      fields => Str,
    ],
  );
  my $p = $check->(@_);

lib/Google/RestApi/DocsApi1/Document.pm  view on Meta::CPAN

  $self->batch_requests(
    updateTextStyle => {
      range     => $p->{range},
      textStyle => $p->{style},
      fields    => $p->{fields},
    },
  );
  return $self;
}

sub update_paragraph_style {
  my $self = shift;
  state $check = signature(
    bless => !!0,
    named => [
      range  => HashRef,
      style  => HashRef,
      fields => Str,
    ],
  );
  my $p = $check->(@_);

lib/Google/RestApi/DocsApi1/Document.pm  view on Meta::CPAN


  $self->batch_requests(
    insertSectionBreak => {
      sectionType => $p->{type},
      location    => \%location,
    },
  );
  return $self;
}

sub update_document_style {
  my $self = shift;
  state $check = signature(
    bless => !!0,
    named => [
      style  => HashRef,
      fields => Str,
    ],
  );
  my $p = $check->(@_);

lib/Google/RestApi/DriveApi3/Comment.pm  view on Meta::CPAN

  $self->require_id('get');

  my %params = (
    fields => $p->{fields},
  );
  $params{includeDeleted} = $p->{include_deleted} ? 'true' : 'false';

  return $self->api(params => \%params);
}

sub update {
  my $self = shift;
  state $check = signature(
    bless => !!0,
    named => [
      content => Str,
      _extra_ => slurpy HashRef,
    ],
  );
  my $p = named_extra($check->(@_));

lib/Google/RestApi/DriveApi3/Drive.pm  view on Meta::CPAN


  $self->require_id('get');

  my %params;
  $params{fields} = $p->{fields} if defined $p->{fields};
  $params{useDomainAdminAccess} = 'true' if $p->{use_domain_admin_access};

  return $self->api(params => \%params);
}

sub update {
  my $self = shift;
  state $check = signature(
    bless => !!0,
    named => [
      name                    => Str, { optional => 1 },
      color_rgb               => Str, { optional => 1 },
      theme_id                => Str, { optional => 1 },
      background_image_file   => HashRef, { optional => 1 },
      restrictions            => HashRef, { optional => 1 },
      use_domain_admin_access => Bool, { default => 0 },

lib/Google/RestApi/DriveApi3/File.pm  view on Meta::CPAN

    ],
  );
  my $p = $check->(@_);

  my $params = $p->{params};
  $params->{fields} = $p->{fields} if defined $p->{fields};

  return $self->api(params => $params);
}

sub update {
  my $self = shift;
  state $check = signature(
    bless => !!0,
    named => [
      name        => Str, { optional => 1 },
      description => Str, { optional => 1 },
      mime_type   => Str, { optional => 1 },
      add_parents    => Str, { optional => 1 },
      remove_parents => Str, { optional => 1 },
      _extra_     => slurpy HashRef,

lib/Google/RestApi/DriveApi3/Permission.pm  view on Meta::CPAN

  my $p = $check->(@_);

  $self->require_id('get');

  my %params;
  $params{fields} = $p->{fields} if defined $p->{fields};

  return $self->api(params => \%params);
}

sub update {
  my $self = shift;
  state $check = signature(
    bless => !!0,
    named => [
      role               => Str,
      transfer_ownership => Bool, { default => 0 },
      _extra_            => slurpy HashRef,
    ],
  );
  my $p = named_extra($check->(@_));

lib/Google/RestApi/DriveApi3/Reply.pm  view on Meta::CPAN

  $self->require_id('get');

  my %params = (
    fields => $p->{fields},
  );
  $params{includeDeleted} = $p->{include_deleted} ? 'true' : 'false';

  return $self->api(params => \%params);
}

sub update {
  my $self = shift;
  state $check = signature(
    bless => !!0,
    named => [
      content => Str,
      _extra_ => slurpy HashRef,
    ],
  );
  my $p = named_extra($check->(@_));

lib/Google/RestApi/DriveApi3/Revision.pm  view on Meta::CPAN


  $self->require_id('get');

  my %params;
  $params{fields} = $p->{fields} if defined $p->{fields};
  $params{acknowledgeAbuse} = 'true' if $p->{acknowledge_abuse};

  return $self->api(params => \%params);
}

sub update {
  my $self = shift;
  state $check = signature(
    bless => !!0,
    named => [
      keep_forever              => Bool, { optional => 1 },
      publish_auto              => Bool, { optional => 1 },
      published                 => Bool, { optional => 1 },
      published_outside_domain  => Bool, { optional => 1 },
      _extra_                   => slurpy HashRef,
    ],

lib/Google/RestApi/GmailApi1/Draft.pm  view on Meta::CPAN


  $self->require_id('get');

  my %params;
  $params{format} = $p->{format} if defined $p->{format};
  $params{fields} = $p->{fields} if defined $p->{fields};

  return $self->api(params => \%params);
}

sub update {
  my $self = shift;
  state $check = signature(
    bless => !!0,
    named => [
      to           => Str,
      subject      => Str,
      body         => Str,
      from         => Str, { optional => 1 },
      cc           => Str, { optional => 1 },
      bcc          => Str, { optional => 1 },

lib/Google/RestApi/GmailApi1/Label.pm  view on Meta::CPAN

  my $p = $check->(@_);

  $self->require_id('get');

  my %params;
  $params{fields} = $p->{fields} if defined $p->{fields};

  return $self->api(params => \%params);
}

sub update {
  my $self = shift;
  state $check = signature(
    bless => !!0,
    named => [
      name                    => Str, { optional => 1 },
      label_list_visibility   => Str, { optional => 1 },
      message_list_visibility => Str, { optional => 1 },
      _extra_                 => slurpy HashRef,
    ],
  );

lib/Google/RestApi/SheetsApi4/Request/Spreadsheet.pm  view on Meta::CPAN


  $p->{grid_properties}->{rowCount} = delete $p->{grid_properties}->{rows} if $p->{grid_properties}->{rows};
  $p->{grid_properties}->{columnCount} = delete $p->{grid_properties}->{cols} if $p->{grid_properties}->{cols};
  $properties{gridProperties} = $p->{grid_properties} if $p->{grid_properties};

  $self->batch_requests(addSheet => { properties => \%properties });

  return $self;
}

sub update_spreadsheet_properties {
  my $self = shift;

  state $check = signature(
    bless => !!0,
    named => [
      properties => HashRef,
      fields     => Str, { optional => 1 },
    ],
  );
  my $p = $check->(@_);

lib/Google/RestApi/SheetsApi4/Request/Spreadsheet.pm  view on Meta::CPAN


  $self->batch_requests(
    addProtectedRange => {
      protectedRange => \%protected_range,
    },
  );

  return $self;
}

sub update_protected_range {
  my $self = shift;

  state $check = signature(
    bless => !!0,
    named => [
      id               => Str,
      range            => Optional[HashRef],
      description      => Optional[Str],
      warning_only     => Optional[Bool],
      requesting_user  => Optional[Bool],

lib/Google/RestApi/SheetsApi4/Request/Spreadsheet/Worksheet.pm  view on Meta::CPAN


  # "frozenColumnCount" or "frozenRowCount".
  my $frozen = "frozen" . ($dim eq 'col' ? "Column" : "Row") . "Count";

  return $self->update_worksheet_properties(
    properties => { gridProperties => { $frozen => $count }, },
    fields     => "gridProperties.$frozen",
  );
}

sub update_worksheet_properties {
  my $self = shift;

  state $check = signature(
    bless => !!0,
    named => [
      properties => HashRef,
      fields     => Str, { optional => 1 },
    ],
  );
  my $p = $check->(@_);

lib/Google/RestApi/SheetsApi4/Request/Spreadsheet/Worksheet.pm  view on Meta::CPAN

  my %request = (sourceSheetId => $self->worksheet_id());
  $request{newSheetName} = $p->{new_name} if defined $p->{new_name};
  $request{insertSheetIndex} = $p->{insert_index} if defined $p->{insert_index};
  $request{newSheetId} = $p->{new_sheet_id} if defined $p->{new_sheet_id};

  $self->batch_requests(duplicateSheet => \%request);

  return $self;
}

sub update_dimension_properties {
  my $self = shift;

  state $check = signature(
    bless => !!0,
    named => [
      dimension  => Str,
      start      => Int,
      end        => Optional[Int],
      properties => HashRef,
      fields     => Str, { optional => 1 },

lib/Google/RestApi/SheetsApi4/Request/Spreadsheet/Worksheet.pm  view on Meta::CPAN

        ranges => $p->{ranges},
        %{ $p->{rule} },
      },
      index => $p->{index},
    },
  );

  return $self;
}

sub update_conditional_format_rule {
  my $self = shift;

  state $check = signature(
    bless => !!0,
    named => [
      index     => Int,
      rule      => Optional[HashRef],
      new_index => Optional[Int],
    ],
  );

lib/Google/RestApi/SheetsApi4/Request/Spreadsheet/Worksheet.pm  view on Meta::CPAN


  $self->batch_requests(
    addBanding => {
      bandedRange => \%banded_range,
    },
  );

  return $self;
}

sub update_banding {
  my $self = shift;

  state $check = signature(
    bless => !!0,
    named => [
      id                    => Str,
      range                 => Optional[HashRef],
      row_properties        => Optional[HashRef],
      column_properties     => Optional[HashRef],
      fields                => Str, { optional => 1 },

lib/Google/RestApi/SheetsApi4/Request/Spreadsheet/Worksheet.pm  view on Meta::CPAN

        dimension  => $dim,
        startIndex => $p->{start},
        endIndex   => $p->{end},
      },
    },
  );

  return $self;
}

sub update_dimension_group {
  my $self = shift;

  state $check = signature(
    bless => !!0,
    named => [
      dimension      => Str,
      start          => Int,
      end            => Int,
      depth          => Int,
      collapsed      => Bool,

lib/Google/RestApi/SheetsApi4/Request/Spreadsheet/Worksheet/Range.pm  view on Meta::CPAN

  $self->batch_requests(
    deleteNamedRange => {
      namedRangeId => $named,
    },
  );

  return $self;
}

sub named_u { shift->update_named(@_); }
sub update_named {
  my $self = shift;

  state $check = signature(
    bless => !!0,
    named => [
      name   => Optional[Str],
      range  => Optional[HashRef],
      fields => Str, { optional => 1 },
    ],
  );

lib/Google/RestApi/TasksApi1/Task.pm  view on Meta::CPAN

  my $p = $check->(@_);

  $self->require_id('get');

  my %params;
  $params{fields} = $p->{fields} if defined $p->{fields};

  return $self->api(params => \%params);
}

sub update {
  my $self = shift;
  state $check = signature(
    bless => !!0,
    named => [
      title   => Str, { optional => 1 },
      notes   => Str, { optional => 1 },
      due     => Str, { optional => 1 },
      status  => Str, { optional => 1 },
      _extra_ => slurpy HashRef,
    ],

lib/Google/RestApi/TasksApi1/TaskList.pm  view on Meta::CPAN

  my $p = $check->(@_);

  $self->require_id('get');

  my $params = $p->{params};
  $params->{fields} = $p->{fields} if defined $p->{fields};

  return $self->api(params => $params);
}

sub update {
  my $self = shift;
  state $check = signature(
    bless => !!0,
    named => [
      title   => Str, { optional => 1 },
      _extra_ => slurpy HashRef,
    ],
  );
  my $p = named_extra($check->(@_));

t/unit/Test/Google/RestApi/CalendarApi3/Calendar.pm  view on Meta::CPAN

  my $cal_api = mock_calendar_api();
  my $cal = $cal_api->calendar(id => $self->_cal_id());

  my $metadata = $cal->get();
  ok $metadata, 'Get returns metadata';
  ok $metadata->{summary}, 'Metadata has summary';

  return;
}

sub update : Tests(1) {
  my $self = shift;

  my $cal_api = mock_calendar_api();
  my $cal = $cal_api->calendar(id => $self->_cal_id());

  lives_ok sub { $cal->update(summary => 'Updated Calendar') }, 'Update lives';

  return;
}

t/unit/Test/Google/RestApi/DocsApi1/Document.pm  view on Meta::CPAN


  my %range = (startIndex => 1, endIndex => 10);
  $doc->delete_content(range => \%range);
  my @requests = $doc->batch_requests();
  is $requests[0]->{deleteContentRange}->{range}->{startIndex}, 1, 'delete_content startIndex is correct';
  is $requests[0]->{deleteContentRange}->{range}->{endIndex}, 10, 'delete_content endIndex is correct';

  return;
}

sub update_text_style : Tests(3) {
  my $self = shift;
  my $doc = $self->_mock_document();

  my %range = (startIndex => 1, endIndex => 5);
  my %style = (bold => JSON::MaybeXS::true());
  $doc->update_text_style(range => \%range, style => \%style, fields => 'bold');
  my @requests = $doc->batch_requests();
  is $requests[0]->{updateTextStyle}->{fields}, 'bold', 'update_text_style fields is correct';
  is $requests[0]->{updateTextStyle}->{textStyle}->{bold}, JSON::MaybeXS::true(), 'update_text_style style is correct';
  is $requests[0]->{updateTextStyle}->{range}->{startIndex}, 1, 'update_text_style range is correct';

  return;
}

sub update_paragraph_style : Tests(3) {
  my $self = shift;
  my $doc = $self->_mock_document();

  my %range = (startIndex => 1, endIndex => 10);
  my %style = (alignment => 'CENTER');
  $doc->update_paragraph_style(range => \%range, style => \%style, fields => 'alignment');
  my @requests = $doc->batch_requests();
  is $requests[0]->{updateParagraphStyle}->{fields}, 'alignment', 'update_paragraph_style fields is correct';
  is $requests[0]->{updateParagraphStyle}->{paragraphStyle}->{alignment}, 'CENTER', 'update_paragraph_style style is correct';
  is $requests[0]->{updateParagraphStyle}->{range}->{startIndex}, 1, 'update_paragraph_style range is correct';

t/unit/Test/Google/RestApi/DocsApi1/Document.pm  view on Meta::CPAN

  my $doc = $self->_mock_document();

  $doc->insert_section_break(index => 10, type => 'NEXT_PAGE', segment_id => 'kix.seg1');
  my @requests = $doc->batch_requests();
  is $requests[0]->{insertSectionBreak}->{location}->{segmentId}, 'kix.seg1',
    'insert_section_break includes segmentId when provided';

  return;
}

sub update_document_style : Tests(2) {
  my $self = shift;
  my $doc = $self->_mock_document();

  my %style = (marginTop => { magnitude => 72, unit => 'PT' });
  $doc->update_document_style(style => \%style, fields => 'marginTop');
  my @requests = $doc->batch_requests();
  is $requests[0]->{updateDocumentStyle}->{fields}, 'marginTop', 'update_document_style fields is correct';
  is $requests[0]->{updateDocumentStyle}->{documentStyle}->{marginTop}->{magnitude}, 72,
    'update_document_style style is correct';

t/unit/Test/Google/RestApi/DriveApi3/Drive.pm  view on Meta::CPAN

    skip "No shared drives available", 1 if $self->{_skip_drive_tests};

    my $drive = $self->_mock_drive();
    ok my $result = $drive->get(use_domain_admin_access => 1),
      'get() with use_domain_admin_access returns result';
  }

  return;
}

sub update_drive : Tests(1) {
  my $self = shift;

  SKIP: {
    skip "No shared drives available", 1 if $self->{_skip_drive_tests};

    my $drive = $self->_mock_drive();
    ok my $result = $drive->update(name => 'Renamed Drive'),
      'update() with name returns result';
  }

  return;
}

sub update_with_options : Tests(1) {
  my $self = shift;

  SKIP: {
    skip "No shared drives available", 1 if $self->{_skip_drive_tests};

    my $drive = $self->_mock_drive();
    ok my $result = $drive->update(
      name      => 'Styled Drive',
      color_rgb => '#FF0000',
      theme_id  => 'theme1',

t/unit/Test/Google/RestApi/TasksApi1/Task.pm  view on Meta::CPAN

  ok my $task_id = $task->task_id(), 'Task has ID';

  my $details = $task->get();
  ok $details, 'Get returns task details';

  lives_ok sub { $task->delete() }, 'Delete task lives';

  return;
}

sub update : Tests(1) {
  my $self = shift;

  my $tasks_api = mock_tasks_api();
  my $tl = $tasks_api->task_list(id => $self->_tl_id());
  my $task = Task->new(task_list => $tl, id => $self->_task_id());

  lives_ok sub { $task->update(title => 'Updated Task') }, 'Update task lives';

  return;
}

t/unit/Test/Google/RestApi/TasksApi1/TaskList.pm  view on Meta::CPAN

  my $tasks_api = mock_tasks_api();
  my $tl = $tasks_api->task_list(id => $self->_tl_id());

  my $metadata = $tl->get();
  ok $metadata, 'Get returns metadata';
  ok $metadata->{title}, 'Metadata has title';

  return;
}

sub update : Tests(1) {
  my $self = shift;

  my $tasks_api = mock_tasks_api();
  my $tl = $tasks_api->task_list(id => $self->_tl_id());

  lives_ok sub { $tl->update(title => 'Updated Task List') }, 'Update lives';

  return;
}



( run in 2.461 seconds using v1.01-cache-2.11-cpan-99c4e6809bf )