{
$WWW::Vimeo::Simple::User::VERSION
=
'0.13'
;
}
has
'id'
=> (
is
=>
'rw'
,
isa
=>
'Int'
,
);
has
'display_name'
=> (
is
=>
'rw'
,
isa
=>
'Str'
,
);
has
'created_on'
=> (
is
=>
'rw'
,
isa
=>
'Str'
,
);
has
'is_staff'
=> (
is
=>
'rw'
,
isa
=>
'Bool'
,
);
has
'is_plus'
=> (
is
=>
'rw'
,
isa
=>
'Bool'
,
);
has
'location'
=> (
is
=>
'rw'
,
isa
=>
'Str'
,
);
has
'url'
=> (
is
=>
'rw'
,
isa
=>
'Str'
,
);
has
'bio'
=> (
is
=>
'rw'
,
isa
=>
'Str'
,
);
has
'profile_url'
=> (
is
=>
'rw'
,
isa
=>
'Str'
,
);
has
'videos_url'
=> (
is
=>
'rw'
,
isa
=>
'Str'
,
);
has
'total_videos_uploaded'
=> (
is
=>
'rw'
,
isa
=>
'Int'
,
);
has
'total_videos_appears_in'
=> (
is
=>
'rw'
,
isa
=>
'Int'
,
);
has
'total_videos_liked'
=> (
is
=>
'rw'
,
isa
=>
'Int'
,
);
has
'total_contacts'
=> (
is
=>
'rw'
,
isa
=>
'Int'
,
);
has
'total_albums'
=> (
is
=>
'rw'
,
isa
=>
'Int'
,
);
has
'total_channels'
=> (
is
=>
'rw'
,
isa
=>
'Int'
,
);
has
'portrait_small'
=> (
is
=>
'rw'
,
isa
=>
'Str'
,
);
has
'portrait_medium'
=> (
is
=>
'rw'
,
isa
=>
'Str'
,
);
has
'portrait_large'
=> (
is
=>
'rw'
,
isa
=>
'Str'
,
);
sub
info {
my
$self
=
shift
;
my
$http
= HTTP::Tiny -> new();
my
$url
= _make_url(
$self
,
'info'
);
my
$response
=
$http
-> get(
$url
);
my
$json_text
= decode_json
$response
-> {
'content'
};
for
my
$key
(
keys
%$json_text
) {
if
(
defined
$json_text
-> {
$key
}) {
$self
-> {
$key
} =
$json_text
-> {
$key
};
}
}
}
sub
videos {
my
(
$self
,
$page
) =
@_
;
my
$http
= HTTP::Tiny -> new();
my
$url
= _make_url(
$self
,
'videos'
,
$page
);
my
$response
=
$http
-> get(
$url
);
my
$json_text
= decode_json
$response
-> {
'content'
};
my
@videos
;
foreach
my
$video
(
@$json_text
) {
push
@videos
, WWW::Vimeo::Simple::Video -> new(
$video
);
}
return
\
@videos
;
}
sub
likes {
my
(
$self
,
$page
) =
@_
;
my
$http
= HTTP::Tiny -> new();
my
$url
= _make_url(
$self
,
'likes'
,
$page
);
my
$response
=
$http
-> get(
$url
);
my
$json_text
= decode_json
$response
-> {
'content'
};
my
@videos
;
foreach
my
$video
(
@$json_text
) {
push
@videos
, WWW::Vimeo::Simple::Video -> new(
$video
);
}
return
\
@videos
;
}
sub
appears_in {
my
(
$self
,
$page
) =
@_
;
my
$http
= HTTP::Tiny -> new();
my
$url
= _make_url(
$self
,
'appears_in'
,
$page
);
my
$response
=
$http
-> get(
$url
);
my
$json_text
= decode_json
$response
-> {
'content'
};
my
@videos
;
foreach
my
$video
(
@$json_text
) {
push
@videos
, WWW::Vimeo::Simple::Video -> new(
$video
);
}
return
\
@videos
;
}
sub
all_videos {
my
(
$self
,
$page
) =
@_
;
my
$http
= HTTP::Tiny -> new();
my
$url
= _make_url(
$self
,
'all_videos'
,
$page
);
my
$response
=
$http
-> get(
$url
);
my
$json_text
= decode_json
$response
-> {
'content'
};
my
@videos
;
foreach
my
$video
(
@$json_text
) {
push
@videos
, WWW::Vimeo::Simple::Video -> new(
$video
);
}
return
\
@videos
;
}
sub
subscriptions {
my
(
$self
,
$page
) =
@_
;
my
$http
= HTTP::Tiny -> new();
my
$url
= _make_url(
$self
,
'subscriptions'
,
$page
);
my
$response
=
$http
-> get(
$url
);
my
$json_text
= decode_json
$response
-> {
'content'
};
my
@videos
;
foreach
my
$video
(
@$json_text
) {
push
@videos
, WWW::Vimeo::Simple::Video -> new(
$video
);
}
return
\
@videos
;
}
sub
albums {
my
(
$self
,
$page
) =
@_
;
my
$http
= HTTP::Tiny -> new();
my
$url
= _make_url(
$self
,
'albums'
,
$page
);
my
$response
=
$http
-> get(
$url
);
my
$json_text
= decode_json
$response
-> {
'content'
};
my
@albums
;
foreach
my
$album
(
@$json_text
) {
push
@albums
, WWW::Vimeo::Simple::Album -> new(
$album
);
}
return
\
@albums
;
}
sub
channels {
my
(
$self
,
$page
) =
@_
;
my
$http
= HTTP::Tiny -> new();
my
$url
= _make_url(
$self
,
'channels'
,
$page
);
my
$response
=
$http
-> get(
$url
);
my
$json_text
= decode_json
$response
-> {
'content'
};
my
@channels
;
foreach
my
$channel
(
@$json_text
) {
push
@channels
, WWW::Vimeo::Simple::Channel -> new(
$channel
);
}
return
\
@channels
;
}
sub
groups {
my
(
$self
,
$page
) =
@_
;
my
$http
= HTTP::Tiny -> new();
my
$url
= _make_url(
$self
,
'groups'
,
$page
);
my
$response
=
$http
-> get(
$url
);
my
$json_text
= decode_json
$response
-> {
'content'
};
my
@groups
;
foreach
my
$group
(
@$json_text
) {
push
@groups
, WWW::Vimeo::Simple::Group -> new(
$group
);
}
return
\
@groups
;
}
sub
contacts_videos {
my
(
$self
,
$page
) =
@_
;
my
$http
= HTTP::Tiny -> new();
my
$url
= _make_url(
$self
,
'contacts_videos'
,
$page
);
my
$response
=
$http
-> get(
$url
);
my
$json_text
= decode_json
$response
-> {
'content'
};
my
@videos
;
foreach
my
$video
(
@$json_text
) {
push
@videos
, WWW::Vimeo::Simple::Video -> new(
$video
);
}
return
\
@videos
;
}
sub
contacts_like {
my
(
$self
,
$page
) =
@_
;
my
$http
= HTTP::Tiny -> new();
my
$url
= _make_url(
$self
,
'contacts_like'
,
$page
);
my
$response
=
$http
-> get(
$url
);
my
$json_text
= decode_json
$response
-> {
'content'
};
my
@videos
;
foreach
my
$video
(
@$json_text
) {
push
@videos
, WWW::Vimeo::Simple::Video -> new(
$video
);
}
return
\
@videos
;
}
sub
_make_url {
my
(
$self
,
$request
,
$page
) =
@_
;
$page
=
defined
$page
?
$page
: 1;
my
$api_url
=
$WWW::Vimeo::Simple::API_URL
;
my
$api_format
=
$WWW::Vimeo::Simple::API_FORMAT
;
my
$user
=
defined
$self
-> {
'id'
} ?
$self
-> {
'id'
} :
$self
-> {
'display_name'
};
return
"$api_url/$user/$request.$api_format?page=$page"
;
}
no
Any::Moose;
__PACKAGE__ -> meta -> make_immutable;
1;