Business::WebMoney::Exchanger - Perl API to WebMoney Exchanger


Business-WebMoney documentation  | view source Contained in the Business-WebMoney distribution.

Index


NAME

Top

Business::WebMoney::Exchanger - Perl API to WebMoney Exchanger

SYNOPSIS

Top

  use Business::WebMoney::Exchanger;

  my $wmex = Business::WebMoney::Exchanger->new;
  my $best_rates = $wmex->best_rates;

  print $best_rates->{WMZ}->{WMR}->{rate} . "\n";

DESCRIPTION

Top

Business::WebMoney::Exchanges provides simple API to the WebMoney Exchanger system. Currently it provides an interface to the stock rates of WebMoney currencies.

METHODS

Top

Constructor

  my $wmex = Business::WebMoney::Exchanger->new(
    timeout => 30,			# Request timeout in seconds (optional, default 20)
  );

best_rates - interface to query current exchange rates

  my $rates = $wmex->best_rates;

On error returns undef ($wmex->errcode and $wmex->errstr are set to the error code and description accordingly). On success returns reference to the following structure:

  {
    WMZ => {
      WMR => {
        rate => 27.5199,	# exchange rate WMZ->WMR defined by Central Bank of Russia or National Bank of Ukraine
				# (or corresponding cross-rates)
	0.1 => 0,		# amount of WMZ you can buy for WMR with rate better than 27.5474 (= 27.5199 + 0.1%)
	0.2 => 79572.31,	# amount of WMZ you can buy for WMR with rate better than 27.5749 (= 27.5199 + 0.2%)
	...
	10 => 378769.89,	# amount of WMZ you can buy for WMR with rate better than 30.2718 (= 27.5199 + 10%)
	exchtype => 1,		# ID of the exchange direction (used in further interfaces)
      },
      ...
    },
    ...
  }

Available rate ranges: 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 2, 3, 5, 10.

ENVIRONMENT

Top

* http_proxy - proxy support, http://host_or_ip:port

SEE ALSO

Top

http://wm.exchanger.ru/asp/rules_xml.asp - WebMoney Exchanger API specification (in Russian only)

AUTHOR

Top

Alexander Lourier, <aml@rulezz.ru>

COPYRIGHT AND LICENSE

Top


Business-WebMoney documentation  | view source Contained in the Business-WebMoney distribution.