WWW::Ohloh::API::ContributorLanguageFact - Ohloh stats about a project's


WWW-Ohloh-API documentation Contained in the WWW-Ohloh-API distribution.

Index


Code Index:

NAME

Top

WWW::Ohloh::API::ContributorLanguageFact - Ohloh stats about a project's contributor for a specific language

SYNOPSIS

Top

    use WWW::Ohloh::API;

    my $ohloh = WWW::Ohloh::API->new( api_key => $my_api_key );
    my @facts = $ohloh->get_contributor_language_facts( 
        project_id => 12933,
        contributor_id => 1234
    );

DESCRIPTION

Top

W::O::A::ContributorLanguageFact contains the information associated with a language-specific contribution of a member of a project as defined at http://www.ohloh.net/api/reference/contributor_language_fact. To be properly populated, it must be created via the get_contributor_language_facts method of a WWW::Ohloh::API object.

METHODS

Top

API Data Accessors

analysis_id

Return the id of the analysis which provided the data for the contributor_language_fact.

contributor_id

Return the id of the contributor, which is unique within the scope of the project, but not globally.

contributor_name

Return the name used by the contrinutor when committing to the source control server.

language_id

Return the id of the language measured.

language_nice_name

Return the name of the language measured.

comment_ratio

Return the ratio of lines committed by this contributor that are comments.

man_months

The total number of months for which this contributor made at least one commit.

commits

Return the total number of commits made by this contributor.

median_commits

Return the median number of commits by this contributor by active month.

Other Methods

as_xml

Return the account information as an XML string. Note that this is not the exact xml document as returned by the Ohloh server.

SEE ALSO

Top

*

WWW::Ohloh::API, WWW::Ohloh::API::KudoScore, WWW::Ohloh::API::ContributorFact.

*

Ohloh API reference: http://www.ohloh.net/api/getting_started

*

Ohloh Account API reference: http://www.ohloh.net/api/reference/contributor_language_fact

VERSION

Top

This document describes WWW::Ohloh::API::ContributorLanguageFact version 0.0.6

BUGS AND LIMITATIONS

Top

WWW::Ohloh::API is very extremely alpha quality. It'll improve, but till then: Caveat emptor.

The as_xml() method returns a re-encoding of the account data, which can differ of the original xml document sent by the Ohloh server.

Please report any bugs or feature requests to bug-www-ohloh-api@rt.cpan.org, or through the web interface at http://rt.cpan.org.

AUTHOR

Top

Yanick Champoux <yanick@cpan.org>

LICENCE AND COPYRIGHT

Top


WWW-Ohloh-API documentation Contained in the WWW-Ohloh-API distribution.

package WWW::Ohloh::API::ContributorLanguageFact;

use strict;
use warnings;

use Carp;
use Object::InsideOut;
use XML::LibXML;

our $VERSION = '0.3.1';

my @ohloh_of : Field : Arg(ohloh) : Get(_ohloh);
my @request_url_of : Field : Arg(request_url) : Get( request_url );
my @xml_of : Field : Arg(xml);

my @api_fields = qw/
  analysis_id
  contributor_id
  contributor_name
  language_id
  language_nice_name
  comment_ratio
  man_months
  commits
  median_commits
  /;

my @analysis_id_of : Field : Set(_set_analysis_id) : Get(analysis_id);
my @contributor_id_of : Field : Set(_set_contributor_id) :
  Get(contributor_id);
my @contributor_name_of : Field : Set(_set_contributor_name) :
  Get(contributor_name);
my @language_id_of : Field : Set(_set_language_id) : Get(language_id);
my @language_nice_name_of : Field : Set(_set_language_nice_name) :
  Get(language_nice_name);
my @comment_ratio_of : Field : Set(_set_comment_ratio) : Get(comment_ratio);
my @man_months_of : Field : Set(_set_man_months) : Get(man_months);
my @commits_of : Field : Set(_set_commits) : Get(commits);
my @median_commits_of : Field : Set(_set_median_commits) :
  Get(median_commits);

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

sub _init : Init {
    my $self = shift;

    my $dom = $xml_of[$$self] or return;

    $self->_set_analysis_id( $dom->findvalue("analysis_id/text()") );
    $self->_set_contributor_id( $dom->findvalue("contributor_id/text()") );
    $self->_set_contributor_name(
        $dom->findvalue("contributor_name/text()") );
    $self->_set_language_id( $dom->findvalue("language_id/text()") );
    $self->_set_language_nice_name(
        $dom->findvalue("language_nice_name/text()") );
    $self->_set_comment_ratio( $dom->findvalue("comment_ratio/text()") );
    $self->_set_man_months( $dom->findvalue("man_months/text()") );
    $self->_set_commits( $dom->findvalue("commits/text()") );
    $self->_set_median_commits( $dom->findvalue("median_commits/text()") );

}

sub as_xml {
    my $self = shift;
    my $xml;
    my $w = XML::Writer->new( OUTPUT => \$xml );

    $w->startTag('contributor_language_fact');

    for my $attr (@api_fields) {
        $w->dataElement( $attr => $self->$attr );
    }

    $w->endTag;

    return $xml;
}

'end of WWW::Ohloh::API::ContributorLanguageFact';

__END__