blib/lib/Net/HTTP/Factual.pm

filter: Statementstmt 100% 22 / 22 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod n/a totaltotal 100% 28 / 28 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
↑ Summary
1 package Net::HTTP::Factual;
2 {
3 1 $Net::HTTP::Factual::VERSION = '0.122480';
4 }
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Net::HTTP::Spore;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 #ABSTRACT: RESTful interface to Factual.com, using Spore
10  
11  
12  
13 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 has client => ( is => 'ro', lazy_build => 1 );
15 1 has spec => ( is => 'ro', lazy_build => 1 );
16  
17 sub _build_client
18 1 ▶{
Subroutine _build_client: called CC=1 SCAR=0.0
19 1 my $self = shift;
20 1 my $client = Net::HTTP::Spore->new_from_string($self->spec );
21 1 $client->enable( 'Format::JSON' );
22 1 $client;
23 }
24  
25 sub _build_spec
26 1 ▶{
Subroutine _build_spec: called CC=1 SCAR=0.0
27 1 my $factual_spec =
28 '{
29 "base_url" : "http://api.factual.com",
30 "api_base_url" : "http://api.factual.com",
31 "version" : "v2",
32 "expected" : "200",
33 "methods" : {
34 "input" : {
35 "params" : {
36 "required" : [
37 "table_id",
38 "values",
39 "api_key"
40 ],
41 "optional" : [
42 "subject_key"
43 ]
44 },
45 "api_format" : [
46 "json"
47 ],
48 "documentation" : "This method either suggests corrections for single rows of data or inserts new rows of data in tables. It is important to note that corrections to tables may not immediately be reflected in Factual tables or, in some cases, may never appear. This is because one of the features of Factual tables is to try to discern the most accurate value for a fact based on numerous inputs, of which the ones provided in your input call may only be one of many.\\nIn order to suggest a correction to a fact in an existing row, either provide the subject_key for the row you wish to correct, or the subject itself (along with your fact inputs). It is acceptable to provide both a subject_key AND the subject. If the subject disagrees with the currently displayed subject for the row identified by that subject_key, you are suggesting that the subject\'s actual label should be corrected. Of note: is important to discern the difference between subject_keys and UUIDs. Many tables use UUIDs as their subject. In these cases, the UUID is merely the subject itself. live example.\nIn order to add a row, omit the subject_key and specify the subject you are adding to the table, as well as any facts about the subject you wish to also include. The Factual Server API will determine if this is an existing subject (and add your facts as inputs to that subject) or add a new row for the subject otherwise. If you are using a table that auto-generates subject labels (such as UUIDs), pass in null as the subject label. ",
49 "path" : "/v2/tables/:table_id/input",
50 "method" : "GET",
51 "description" : "inserts or updates a row in a table"
52 },
53 "read" : {
54 "params" : {
55 "required" : [
56 "table_id"
57 ],
58 "optional" : [
59 "sort_by",
60 "sort_dir",
61 "limit",
62 "offset",
63 "filters",
64 "subject_key",
65 "include_schema"
66 ]
67 },
68 "api_format" : [
69 "json"
70 ],
71 "documentation" : "The read method enables you to read either a single row or a number of rows from a table. It has support for limits and offsets to support paging through data. It also has support for filtering data.",
72 "path" : "/v2/tables/:table_id/read",
73 "method" : "GET",
74 "description" : "read from a table"
75 },
76 "schema" : {
77 "required" : [
78 "table_id",
79 "api_key"
80 ],
81 "api_format" : [
82 "json"
83 ],
84 "documentation" : "The schema call returns meta-data about a Factual Table.",
85 "path" : "/v2/tables/:table_id/schema",
86 "method" : "GET",
87 "description" : "get the schema for a table"
88 }
89 },
90 "name" : "factual",
91 "author" : [
92 "andrew grangaard <spazm@cpan.org>"
93 ],
94 "meta" : {
95 "documentation" : "http://wiki.developer.factual.com/"
96 }
97 }';
98 }
99  
100 1 1;
101  
102 __END__
↑ Summary