|
Revision 1917
(checked in by miyagawa, 2 years ago)
|
CF::Script for Lingr
|
- Property svn:executable set to
*
|
| Line | |
|---|
| 1 |
|
|---|
| 2 |
use strict; |
|---|
| 3 |
use warnings; |
|---|
| 4 |
use WebService::Lingr; |
|---|
| 5 |
use YAML; |
|---|
| 6 |
|
|---|
| 7 |
my($api_key, $room) = @ARGV; |
|---|
| 8 |
|
|---|
| 9 |
my $output = { |
|---|
| 10 |
title => "Lingr: $room", |
|---|
| 11 |
entry => [], |
|---|
| 12 |
}; |
|---|
| 13 |
|
|---|
| 14 |
my $lingr = WebService::Lingr->new(api_key => $api_key); |
|---|
| 15 |
$lingr->call('room.enter', { id => $room }); |
|---|
| 16 |
$lingr->call('room.getMessages', { |
|---|
| 17 |
ticket => $lingr->response->{ticket}, |
|---|
| 18 |
counter => 0, |
|---|
| 19 |
}); |
|---|
| 20 |
|
|---|
| 21 |
for my $msg (@{$lingr->response->{messages} || []}) { |
|---|
| 22 |
push @{$output->{entry}}, { |
|---|
| 23 |
title => $msg->{text}, |
|---|
| 24 |
date => $msg->{timestamp}, |
|---|
| 25 |
author => $msg->{nickname}, |
|---|
| 26 |
url => "http://www.lingr.com/room/$room#$msg->{id}", |
|---|
| 27 |
}; |
|---|
| 28 |
} |
|---|
| 29 |
|
|---|
| 30 |
print Dump $output; |
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 |
|
|---|