line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Facebook::Graph::Publish::Checkin; |
2
|
|
|
|
|
|
|
$Facebook::Graph::Publish::Checkin::VERSION = '1.1204'; |
3
|
4
|
|
|
4
|
|
25
|
use Moo; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
21
|
|
4
|
4
|
|
|
4
|
|
1043
|
use Ouch; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
274
|
|
5
|
|
|
|
|
|
|
extends 'Facebook::Graph::Publish'; |
6
|
|
|
|
|
|
|
|
7
|
4
|
|
|
4
|
|
21
|
use constant object_path => '/checkins'; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
1842
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
has message => ( |
10
|
|
|
|
|
|
|
is => 'rw', |
11
|
|
|
|
|
|
|
predicate => 'has_message', |
12
|
|
|
|
|
|
|
); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub set_message { |
15
|
0
|
|
|
0
|
1
|
|
my ($self, $message) = @_; |
16
|
0
|
|
|
|
|
|
$self->message($message); |
17
|
0
|
|
|
|
|
|
return $self; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
has place => ( |
21
|
|
|
|
|
|
|
is => 'rw', |
22
|
|
|
|
|
|
|
predicate => 'has_place', |
23
|
|
|
|
|
|
|
); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub set_place { |
26
|
0
|
|
|
0
|
1
|
|
my ($self, $value) = @_; |
27
|
0
|
|
|
|
|
|
$self->place($value); |
28
|
0
|
|
|
|
|
|
return $self; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
has longitude => ( |
32
|
|
|
|
|
|
|
is => 'rw', |
33
|
|
|
|
|
|
|
isa => sub { ouch(442,"$_[0] is not a number") unless looks_like_number $_[0] }, |
34
|
|
|
|
|
|
|
predicate => 'has_longitude', |
35
|
|
|
|
|
|
|
); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub set_longitude { |
38
|
0
|
|
|
0
|
1
|
|
my ($self, $value) = @_; |
39
|
0
|
|
|
|
|
|
$self->longitude($value); |
40
|
0
|
|
|
|
|
|
return $self; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
has latitude => ( |
44
|
|
|
|
|
|
|
is => 'rw', |
45
|
|
|
|
|
|
|
isa => sub { ouch(442,"$_[0] is not a number") unless looks_like_number $_[0] }, |
46
|
|
|
|
|
|
|
predicate => 'has_latitude', |
47
|
|
|
|
|
|
|
); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub set_latitude { |
50
|
0
|
|
|
0
|
1
|
|
my ($self, $value) = @_; |
51
|
0
|
|
|
|
|
|
$self->latitude($value); |
52
|
0
|
|
|
|
|
|
return $self; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
has tags => ( |
56
|
|
|
|
|
|
|
is => 'rw', |
57
|
|
|
|
|
|
|
isa => sub { ouch(442,"$_[0] is not an Array Reference") unless ref $_[0] eq 'ARRAY' }, |
58
|
|
|
|
|
|
|
predicate => 'has_tags', |
59
|
|
|
|
|
|
|
lazy => 1, |
60
|
|
|
|
|
|
|
default => sub {[]}, |
61
|
|
|
|
|
|
|
); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub set_tags { |
64
|
0
|
|
|
0
|
1
|
|
my ($self, $value) = @_; |
65
|
0
|
|
|
|
|
|
$self->tags($value); |
66
|
0
|
|
|
|
|
|
return $self; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
around get_post_params => sub { |
71
|
|
|
|
|
|
|
my ($orig, $self) = @_; |
72
|
|
|
|
|
|
|
my $post = $orig->($self); |
73
|
|
|
|
|
|
|
if ($self->has_message) { |
74
|
|
|
|
|
|
|
push @$post, message => $self->message; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
if ($self->has_place) { |
77
|
|
|
|
|
|
|
push @$post, place => $self->place; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
if ($self->has_tags) { |
80
|
|
|
|
|
|
|
push @$post, tags => join(', ',@{$self->tags}); |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
if ($self->has_latitude && $self->has_longitude) { |
83
|
|
|
|
|
|
|
push @$post, coordinates => JSON->new->encode({ latitude => $self->latitude, longitude => $self->longitude }); |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
return $post; |
86
|
|
|
|
|
|
|
}; |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
1; |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 NAME |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Facebook::Graph::Publish::Checkin - Publish a location checkin. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 VERSION |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
version 1.1204 |
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 - 2012 Plain Black Corporation (L<http://www.plainblack.com>) and is licensed under the same terms as Perl itself. |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=cut |