summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorivan <ivan>2011-11-10 03:30:07 +0000
committerivan <ivan>2011-11-10 03:30:07 +0000
commite932b43a69516f3485483001a397b33788cf8eb1 (patch)
tree019dd72568e23ef7674db35a9e97b0ff0d1fffe7 /FS
parent992f42d391e6765f636eeb18d7f9bdc6b4e68225 (diff)
DSL status pulling, RT#13656
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/part_export/http_status.pm49
1 files changed, 49 insertions, 0 deletions
diff --git a/FS/FS/part_export/http_status.pm b/FS/FS/part_export/http_status.pm
new file mode 100644
index 0000000..08be3a0
--- /dev/null
+++ b/FS/FS/part_export/http_status.pm
@@ -0,0 +1,49 @@
+packages FS::part_export::http_status;
+use base qw( FS::part_export );
+
+use strict;
+use warnings;
+use LWP::UserAgent;
+use HTTP::Request::Common;
+
+tie my %options, 'Tie::IxHash',
+ 'url' => { label => 'URL', },
+ #'user' => { label => 'Username', default=>'' },
+ #'password' => { label => 'Password', default => '' },
+;
+
+%info = (
+ 'svc' => 'svc_dsl',
+ 'desc' => 'Retrieve status information via HTTP or HTTPS',
+ 'options' => \%options,
+ 'notes' => <<'END'
+Fields from the service can be substituted in the URL as $field.
+END
+);
+
+sub rebless { shift; }
+
+sub export_getstatus {
+ my( $self, $svc_x, $htmlref, $hashref ) = @_;
+
+ my $url = $self->option('url');
+ {
+ no strict 'refs';
+ ${$_} = $svc_x->getfield($x) foreach $svc_x->fields;
+
+ $url = eval(qq($url));
+ }
+
+ my $req = HTTP::Request::Common::GET( $url );
+ my $ua = LWP::UserAgent->new;
+ my $response = $ua->request($req);
+
+ $$htmlref = $response->is_error ? $response->error_as_HTML
+ : $response->content;
+
+
+ #hash data note yet implemented for this status export
+
+}
+
+1;