blib/lib/Froody/API/Reflection.pm

filter: Statementstmt 100% 13 / 13 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 100% 1 / 1 totaltotal 100% 18 / 18 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« blib/lib/Froody/API.pm ↑ Summary blib/lib/Froody/Argument/Text.pm »
1 package Froody::API::Reflection;
2 11 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 11 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 11 ▶use base "Froody::API::XML";
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 =head1 NAME
8  
9 Froody::API::Reflection - the froody reflection api spec
10  
11 =head1 SYNOPSIS
12  
13 use Froody::API::Reflection
14  
15 =head1 DESCRIPTION
16  
17 Froody's reflection system allow you to introspect your methods, and access the
18 API spefication for methods using Froody calls to the Froody server itself.
19  
20 All repositories support two standard methods which are used for reflection,
21 C<froody.reflection.getMethodInfo> and C<froody.reflection.getMethods>. This
22 class defines the API for those methods.
23  
24 See Froody::Reflection for more details
25  
26 =head1 BUGS
27  
28 None known.
29  
30 Please report any bugs you find via the CPAN RT system.
31 L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Froody>
32  
33 =head1 AUTHOR
34  
35 Copyright Fotango 2005. All rights reserved.
36  
37 Please see the main L<Froody> documentation for details of who has worked
38 on this project.
39  
40 This module is free software; you can redistribute it and/or modify it under
41 the same terms as Perl itself.
42  
43 =head1 SEE ALSO
44  
45 L<Froody>, L<Froody::Reflection>
46  
47 =cut
48  
49 12 ▶sub xml {
Subroutine xml: called CC=1 SCAR=0.0
Pod documented
50 12 my $METHOD_INFO = q{
51 <method name="froody.fakeMethod" needslogin="1">
52 <description>A fake method</description>
53 <response>xml-response-example</response>
54 <arguments>
55 <argument name="color" optional="1" type="scalar"> Your favorite color.</argument>
56 <argument name="fleece" optional="0" type="csv">Your happy fun clothing of choice.</argument>
57 </arguments>
58 <errors>
59 <error code="1" message="it would be bad">Don't cross the streams.</error>
60 <error code="1" message="it would be bad">Don't cross the streams.</error>
61 </errors>
62 </method>
63 };
64 12 my $ERROR_INFO = q{
65 <errortype code="mycode">
66 Internal structure of your error type goes here (including XML)
67 </errortype>
68 };
69 12 return <<"XML";
70 <spec>
71 <methods>
72 <method name="froody.reflection.getMethodInfo">
73 <description>Returns information for a given froody API
74 method. As long as there is a method matching the given
75 method_name, returns description and usage of that method in
76 xml.
77 </description>
78 <response>
79 $METHOD_INFO
80 </response>
81 <arguments>
82 <argument name="method_name" optional="0">The name of the method to fetch information for.</argument>
83 </arguments>
84 <errors>
85 <error code="froody.error.notfound.method" message="Method not found">
86 The requested method was not found.
87 </error>
88 </errors>
89 </method>
90 <method name="froody.reflection.getMethods">
91 <description>Returns a list of available froody API methods.</description>
92 <response>
93 <methods>
94 <method>froody.reflection.getMethods</method>
95 <method>froody.reflection.getMethodInfo</method>
96 <method>bar.baz.blargle</method>
97 <method>heartofgold.towel.location</method>
98 </methods>
99 </response>
100 </method>
101 <method name="froody.reflection.getErrorTypes">
102 <description>Returns a list of all available froody error types for this repository.</description>
103 <response>
104 <errortypes>
105 <errortype>froody.error</errortype>
106 <errortype>froody.error.blog</errortype>
107 </errortypes>
108 </response>
109 </method>
110 <method name="froody.reflection.getErrorTypeInfo">
111 <description>Request information about an Error Type</description>
112 <arguments>
113 <argument name="code" optional="0">The code of the error type whose information is being requested.</argument>
114 </arguments>
115 <response>
116 $ERROR_INFO
117 </response>
118 <errors>
119 <error code="froody.error.notfound.errortype" message="Error Type not Found"/>
120 </errors>
121 </method>
122 <method name="froody.reflection.getSpecification">
123 <description>Request the full public specification for a froody endpoint.</description>
124 <response>
125 <spec>
126 <methods>
127 $METHOD_INFO
128 $METHOD_INFO
129 </methods>
130 <errortypes>
131 $ERROR_INFO
132 $ERROR_INFO
133 </errortypes>
134 </spec>
135 </response>
136 </method>
137 </methods>
138 <errortypes>
139 <errortype code="perl.methodcall.param">
140 <error name="foo">Problem</error>
141 <error name="bar">Problem</error>
142 </errortype>
143 </errortypes>
144 </spec>
145 XML
146 }
147  
148 11 1;
« blib/lib/Froody/API.pm ↑ Summary blib/lib/Froody/Argument/Text.pm »