| 1 | package CatalystX::OAuth2::Schema::Result::Token; | ||
| 2 | 10 | ▶ | use parent 'DBIx::Class'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | |||
| 4 | # ABSTRACT: A table for registering bearer tokens | ||
| 5 | |||
| 6 | 10 | __PACKAGE__->load_components(qw(Core)); | |
| 7 | 10 | __PACKAGE__->table('token'); | |
| 8 | 10 | __PACKAGE__->add_columns( | |
| 9 | id => { data_type => 'int', is_auto_increment => 1 }, | ||
| 10 | code_id => { data_type => 'int', is_nullable => 0 }, | ||
| 11 | ); | ||
| 12 | 10 | __PACKAGE__->set_primary_key(qw(id)); | |
| 13 | 10 | __PACKAGE__->belongs_to( code => 'CatalystX::OAuth2::Schema::Result::Code' => | |
| 14 | { 'foreign.id' => 'self.code_id' } ); | ||
| 15 | |||
| 16 | # this is a has many but will only ever return a single record | ||
| 17 | # because of the constraint on the relationship table | ||
| 18 | 10 | __PACKAGE__->has_many( | |
| 19 | from_refresh_token_map => | ||
| 20 | 'CatalystX::OAuth2::Schema::Result::RefreshTokenToAccessToken' => { | ||
| 21 | 'foreign.access_token_id' => 'self.id', | ||
| 22 | 'foreign.code_id' => 'self.code_id' | ||
| 23 | } | ||
| 24 | ); | ||
| 25 | 10 | __PACKAGE__->many_to_many( | |
| 26 | from_refresh_token_map_m2m => from_refresh_token_map => 'refresh_token' ); | ||
| 27 | |||
| 28 | # this is a has many but will only ever return a single record | ||
| 29 | # because of the constraint on the relationship table | ||
| 30 | 10 | __PACKAGE__->has_many( | |
| 31 | to_refresh_token_map => | ||
| 32 | 'CatalystX::OAuth2::Schema::Result::AccessTokenToRefreshToken' => { | ||
| 33 | 'foreign.access_token_id' => 'self.id', | ||
| 34 | 'foreign.code_id' => 'self.code_id' | ||
| 35 | } | ||
| 36 | ); | ||
| 37 | 10 | __PACKAGE__->many_to_many( | |
| 38 | to_refresh_token_map_m2m => to_refresh_token_map => 'refresh_token' ); | ||
| 39 | |||
| 40 | 0 | ▶ | sub from_refresh_token { shift->from_refresh_token_map_m2m->first } |
|
Subroutine
from_refresh_token: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 41 | 1 | ▶ | sub to_refresh_token { shift->to_refresh_token_map_m2m->first } |
|
Subroutine
to_refresh_token: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 42 | |||
| 43 | 8 | ▶ | sub as_string { shift->id } |
|
Subroutine
as_string: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 44 | 4 | ▶ | sub type {'bearer'} |
|
Subroutine
type: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 45 | 4 | ▶ | sub expires_in {3600} |
|
Subroutine
expires_in: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 46 | 2 | ▶ | sub owner { shift->code->owner } |
|
Subroutine
owner: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 47 | |||
| 48 | 10 | 1; | |
| 49 | |||
| 50 | __END__ | ||
| 51 | |||
| 52 | =pod | ||
| 53 | |||
| 54 | =head1 NAME | ||
| 55 | |||
| 56 | CatalystX::OAuth2::Schema::Result::Token - A table for registering bearer tokens | ||
| 57 | |||
| 58 | =head1 VERSION | ||
| 59 | |||
| 60 | version 0.001006 | ||
| 61 | |||
| 62 | =head1 AUTHOR | ||
| 63 | |||
| 64 | Eden Cardim <edencardim@gmail.com> | ||
| 65 | |||
| 66 | =head1 COPYRIGHT AND LICENSE | ||
| 67 | |||
| 68 | This software is copyright (c) 2017 by Suretec Systems Ltd. | ||
| 69 | |||
| 70 | This is free software; you can redistribute it and/or modify it under | ||
| 71 | the same terms as the Perl 5 programming language system itself. | ||
| 72 | |||
| 73 | =cut | ||