| 1 | package Facebook::Graph::Publish::Checkin; | ||||||||||||||||||||||||||||
| 2 | 4 | $Facebook::Graph::Publish::Checkin::VERSION = '1.1205'; | |||||||||||||||||||||||||||
| 3 | 4 | ▶ | use Moo; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 4 | ▶ | use Ouch; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 4 | extends 'Facebook::Graph::Publish'; | |||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 4 | ▶ | use constant object_path => '/checkins'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 4 | has message => ( | |||||||||||||||||||||||||||
| 10 | is => 'rw', | ||||||||||||||||||||||||||||
| 11 | predicate => 'has_message', | ||||||||||||||||||||||||||||
| 12 | ); | ||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 0 | ▶ | sub set_message { | ||||||||||||||||||||||||||
|
Subroutine
set_message: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 15 | 0 | my ($self, $message) = @_; | |||||||||||||||||||||||||||
| 16 | 0 | $self->message($message); | |||||||||||||||||||||||||||
| 17 | 0 | return $self; | |||||||||||||||||||||||||||
| 18 | } | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 4 | has place => ( | |||||||||||||||||||||||||||
| 21 | is => 'rw', | ||||||||||||||||||||||||||||
| 22 | predicate => 'has_place', | ||||||||||||||||||||||||||||
| 23 | ); | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 0 | ▶ | sub set_place { | ||||||||||||||||||||||||||
|
Subroutine
set_place: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 26 | 0 | my ($self, $value) = @_; | |||||||||||||||||||||||||||
| 27 | 0 | $self->place($value); | |||||||||||||||||||||||||||
| 28 | 0 | return $self; | |||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | has longitude => ( | ||||||||||||||||||||||||||||
| 32 | is => 'rw', | ||||||||||||||||||||||||||||
| 33 | 0 | ▶ | isa => sub { ouch(442,"$_[0] is not a number") unless looks_like_number $_[0] }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 34 | 4 | predicate => 'has_longitude', | |||||||||||||||||||||||||||
| 35 | ); | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 0 | ▶ | sub set_longitude { | ||||||||||||||||||||||||||
|
Subroutine
set_longitude: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 38 | 0 | my ($self, $value) = @_; | |||||||||||||||||||||||||||
| 39 | 0 | $self->longitude($value); | |||||||||||||||||||||||||||
| 40 | 0 | return $self; | |||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | has latitude => ( | ||||||||||||||||||||||||||||
| 44 | is => 'rw', | ||||||||||||||||||||||||||||
| 45 | 0 | ▶ | isa => sub { ouch(442,"$_[0] is not a number") unless looks_like_number $_[0] }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 46 | 4 | predicate => 'has_latitude', | |||||||||||||||||||||||||||
| 47 | ); | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 0 | ▶ | sub set_latitude { | ||||||||||||||||||||||||||
|
Subroutine
set_latitude: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 50 | 0 | my ($self, $value) = @_; | |||||||||||||||||||||||||||
| 51 | 0 | $self->latitude($value); | |||||||||||||||||||||||||||
| 52 | 0 | return $self; | |||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | has tags => ( | ||||||||||||||||||||||||||||
| 56 | is => 'rw', | ||||||||||||||||||||||||||||
| 57 | 0 | ▶ | isa => sub { ouch(442,"$_[0] is not an Array Reference") unless ref $_[0] eq 'ARRAY' }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 58 | predicate => 'has_tags', | ||||||||||||||||||||||||||||
| 59 | lazy => 1, | ||||||||||||||||||||||||||||
| 60 | 0 | ▶ | default => sub {[]}, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 61 | 4 | ); | |||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | 0 | ▶ | sub set_tags { | ||||||||||||||||||||||||||
|
Subroutine
set_tags: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 64 | 0 | my ($self, $value) = @_; | |||||||||||||||||||||||||||
| 65 | 0 | $self->tags($value); | |||||||||||||||||||||||||||
| 66 | 0 | return $self; | |||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | 0 | ▶ | around get_post_params => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||
| 71 | 0 | my ($orig, $self) = @_; | |||||||||||||||||||||||||||
| 72 | 0 | my $post = $orig->($self); | |||||||||||||||||||||||||||
| 73 | 0 | ▶ | if ($self->has_message) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 74 | 0 | push @$post, message => $self->message; | |||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||
| 76 | 0 | ▶ | if ($self->has_place) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 77 | 0 | push @$post, place => $self->place; | |||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||
| 79 | 0 | ▶ | if ($self->has_tags) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 80 | 0 | push @$post, tags => join(', ',@{$self->tags}); | |||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||
| 82 | 0 | ▶ | if ($self->has_latitude && $self->has_longitude) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->has_latitude and $self->has_longitude
MC/DC0%0/2
$self->has_latitude and $self->has_longitude
$self->has_latitude
$self->has_longitude
Truth table0%0/3
A and B
A= $self->has_latitudeB= $self->has_longitude
| |||||||||||||||||||||||||||||
| 83 | 0 | push @$post, coordinates => JSON->new->encode({ latitude => $self->latitude, longitude => $self->longitude }); | |||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||
| 85 | 0 | return $post; | |||||||||||||||||||||||||||
| 86 | 4 | }; | |||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | 4 | 1; | |||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | =head1 NAME | ||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | Facebook::Graph::Publish::Checkin - Publish a location checkin. | ||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | =head1 VERSION | ||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | version 1.1205 | ||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | my $fb = Facebook::Graph->new; | ||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | $fb->add_checkin | ||||||||||||||||||||||||||||
| 104 | ->set_place(222047056390) | ||||||||||||||||||||||||||||
| 105 | ->publish; | ||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||
| 107 | my $response = $fb->add_checkin | ||||||||||||||||||||||||||||
| 108 | ->set_place(222047056390) | ||||||||||||||||||||||||||||
| 109 | ->set_message('Mmm...pizza.') | ||||||||||||||||||||||||||||
| 110 | ->set_tags([qw(sarah.bownds 1647395831)]) | ||||||||||||||||||||||||||||
| 111 | ->set_latitude() | ||||||||||||||||||||||||||||
| 112 | ->set_longitude() | ||||||||||||||||||||||||||||
| 113 | ->publish; | ||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||
| 116 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||
| 118 | This module gives you quick and easy access to publish user checkins to locations. | ||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | B<ATTENTION:> You must have the C<user_checkins> privilege to use this module, and C<friends_checkins> to get friends checkins. | ||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||
| 122 | =head1 METHODS | ||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||
| 124 | =head2 to ( id ) | ||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | Specify a profile id to post to. Defaults to 'me', which is the currently logged in user. | ||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||
| 129 | =head2 set_message ( message ) | ||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||
| 131 | Sets the text to post to the wall. | ||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||
| 133 | =head3 message | ||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||
| 135 | A string of text. | ||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||
| 138 | =head2 set_place ( id ) | ||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||
| 140 | Sets the id of the place you are checking in to. | ||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||
| 142 | =head3 id | ||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||
| 144 | The id of a page for a place. For example C<222047056390> is the id of Pete's Pizza and Pub in Milwaukee, WI. | ||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||
| 147 | =head2 set_latitude ( coord ) | ||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||
| 149 | Sets the coords of your location. See also C<set_longitude> | ||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||
| 151 | =head3 coord | ||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||
| 153 | The decimal latitude of your current location. | ||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||
| 156 | =head2 set_longitude ( coord ) | ||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||
| 158 | Sets the coords of your location. See also C<set_latitude> | ||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||
| 160 | =head3 coord | ||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||
| 162 | The decimal longitude of your current location. | ||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||
| 165 | =head2 set_tags ( list ) | ||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||
| 167 | Sets the list of users at the location. | ||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||
| 169 | =head3 list | ||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||
| 171 | An array reference of Facebook user ids that are currently at this location with you. | ||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||
| 175 | =head2 publish ( ) | ||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||
| 177 | Posts the data and returns a L<Facebook::Graph::Response> object. The response object should contain the id: | ||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||
| 179 | {"id":"1647395831_130068550371568"} | ||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||
| 181 | =head1 LEGAL | ||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||
| 183 | Facebook::Graph is Copyright 2010 - 2017 Plain Black Corporation (L<http://www.plainblack.com>) and is licensed under the same terms as Perl itself. | ||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||
| 185 | =cut | ||||||||||||||||||||||||||||