| 1 | package Mojolicious::Plugin::RoutesAuthDBI::Model::OAuth; | ||
| 2 | #~ use Mojo::Base 'DBIx::Mojo::Model'; | ||
| 3 | use Mojo::Base 'Mojolicious::Plugin::RoutesAuthDBI::Model::Base'; | ||
| 4 | |||
| 5 | #~ sub new { | ||
| 6 | #~ state $self = shift->SUPER::new(@_); | ||
| 7 | #~ } | ||
| 8 | |||
| 9 | sub site { | ||
| 10 | my $self = ref($_[0]) ? shift : shift->new; | ||
| 11 | |||
| 12 | $self->dbh->selectrow_hashref($self->sth('update oauth site'), undef, ( @_, )) | ||
| 13 | || $self->dbh->selectrow_hashref($self->sth('new oauth site'), undef, (@_,)); | ||
| 14 | } | ||
| 15 | |||
| 16 | sub check_profile { | ||
| 17 | my $self = ref($_[0]) ? shift : shift->new; | ||
| 18 | |||
| 19 | $self->dbh->selectrow_hashref($self->sth('check profile oauth'), undef, (@_,)); | ||
| 20 | } | ||
| 21 | |||
| 22 | sub user { | ||
| 23 | my $self = ref($_[0]) ? shift : shift->new; | ||
| 24 | |||
| 25 | $self->dbh->selectrow_hashref($self->sth('update oauth user'), undef, @_) | ||
| 26 | || $self->dbh->selectrow_hashref($self->sth('new oauth user'), undef, @_); | ||
| 27 | } | ||
| 28 | |||
| 29 | sub profile { | ||
| 30 | my $self = ref($_[0]) ? shift : shift->new; | ||
| 31 | |||
| 32 | $self->dbh->selectrow_hashref($self->sth('profile by oauth user'), undef, (shift)) | ||
| 33 | } | ||
| 34 | |||
| 35 | sub detach { | ||
| 36 | my $self = ref($_[0]) ? shift : shift->new; | ||
| 37 | $self->dbh->selectrow_hashref($self->sth('отсоединить oauth'), undef, (@_)); | ||
| 38 | } | ||
| 39 | |||
| 40 | sub oauth_users_by_profile { | ||
| 41 | my $self = ref($_[0]) ? shift : shift->new; | ||
| 42 | $self->dbh->selectall_hashref($self->sth('profile oauth.users'), 'site_name', undef, (@_)); | ||
| 43 | |||
| 44 | } | ||
| 45 | |||
| 46 | 1; | ||
| 47 | |||
| 48 | __DATA__ |