NAME

Yandex::Geo::Company - Convenient representation of company from Yandex Maps

VERSION

version 0.07

DESCRIPTION

Class that is more convenient realization of company

It has following properties:

id          # yandex maps id
name        # name of company, type = string
shortName   # short name of company, type = string
url         # website of company, type = string
phones      # company numbers, type = arrayref
links       # links to pages on social networks, type = arrayref
vk          # link to vk, type = string
address     # location, type = str
postalCode  # postal code, type = str (6 digits)

Also, this class implements two methods: from_json and from_geo_json

If you make a query

my $yndx_geo = Yandex::Geosearch->new( apikey => 'f33a4523-6c94-48df-9b41-5c5c6f250e98');
my $res = $yndx_geo->get(text => 'макетные мастерские', only_city => 'ROV');

and process $res

Yandex::Geo::Company->from_json( $res->to_json )

and

Yandex::Geo::Company->from_geo_json( $res )

do the same.

properties

Yandex::Geo::Company::properties();

Detailed info about Yandex::Geo::Company properties

Return hashref with following keys:

set     - list if all set properties names, regardless of type, in alphabetic order
all     - list if all available properties names, regardless of type, in alphabetic order
string  - list of all properties names with type = string
array   - list of all properties names with type = ARRAY

from_geo_json

Accept Geo::JSON::FeatureCollection as $json and return array of Yandex::Geo::Company objects

Yandex::Geo::Company::from_geo_json($json);

from_json

Parse regular json to arrayref of Yandex::Geo::Company objects

Yandex::Geo::Company::from_json($json);

to_array

$y_company->to_array;  # $y_company is L<Yandex::Geo::Company> object
$y_company->to_array("\n");

Serialize object data to arrayref.

Can be useful when inserting data via modules like Text::CSV

Sequence is according to "properties" in Yandex::Geo::Company {all}

Array properties like phones, links are serialized, each element on new string

NAME

Yandex::Geo::Company

SYNOPSYS

use Yandex::Geo::Company;
my $a = Yandex::Geo::Company->new ( name => 'Test LLC' );
warn $a->name;   # 'Test LLC'
warn $a->foo;    # Can't locate object method "foo" via package "Yandex::Geo::Company"

Yandex::Geo::Company::from_json( $res->to_json )
Yandex::Geo::Company::from_geo_json( $res )

AUTHOR

Pavel Serikov <pavelsr@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2018 by Pavel Serikov.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.