geo.php
4.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<?php
class Flora_Api_Service_Geo extends Flora_Api_Service
{
const API_CONTINENT = "geo/continent";
const API_CONTINENTS = "geo/continents";
const API_SUBCONTINENT = "geo/subcontinent";
const API_SUBCONTINENTS = "geo/subcontinents";
const API_COUNTRY = "geo/country";
const API_COUNTRIES = "geo/countries";
const API_CITY = "geo/city";
const API_CITIES = "geo/cities";
const API_REGION = "geo/region";
const API_REGIONS = "geo/regions";
const API_USERIPINFO = "geo/useripinfo";
/**
* Retrieves information about continent for given numeric ID or ISO code
* @param $id int|string Numeric ID or ISO code
* @return Flora_Model_Geo_Continent
*/
public function getContinentByID($id)
{
return $this->call(self::API_CONTINENT, array("id" => $id));
}
/**
* @param int $limit
* @param int $offset
* @return Flora_Collection|Flora_Model_Geo_Continent[]
*/
public function getContinentsList($limit = 0, $offset = 0)
{
return $this->call(self::API_CONTINENTS, array("limit" => (int)$limit, "offset" => (int)$offset));
}
/**
* Retrieves information about continent for given numeric ID or ISO code
* @param $id int|string Numeric ID or ISO code
* @return Flora_Model_Geo_SubContinent
*/
public function getSubContinentByID($id)
{
return $this->call(self::API_SUBCONTINENT, array("id" => $id));
}
/**
* @param int $parent_id
* @param int $limit
* @param int $offset
* @return Flora_Collection|Flora_Model_Geo_Subcontinent[]
*/
public function getSubcontinentsList($parent_id = 0, $limit = 0, $offset = 0)
{
return $this->call(self::API_SUBCONTINENTS, array("limit" => (int)$limit, "offset" => (int)$offset,
"parent_id" => (int)$parent_id));
}
/**
* @param $id int|string Numeric ID or ISO code
* @return Flora_Model_Geo_Country
*/
public function getCountryByID($id)
{
return $this->call(self::API_COUNTRY, array("id" => $id));
}
/**
* @param int $parent_id
* @param int $limit
* @param int $offset
* @return Flora_Collection|Flora_Model_Geo_Country[]
*/
public function getCountriesList($parent_id = 0, $limit = 0, $offset = 0)
{
return $this->call(self::API_COUNTRIES, array("limit" => (int)$limit, "offset" => (int)$offset,
"parent_id" => (int)$parent_id));
}
/**
* @param $id int Numeric ID
* @param $with_not_delivered bool
* @return Flora_Model_Geo_City
*/
public function getCityByID($id, $with_not_delivered)
{
return $this->call(self::API_CITY, array('id' => $id, 'with_not_delivered' => $with_not_delivered));
}
/**
* @param int $country_id
* @param int $region_id
* @param int $limit
* @param int $offset
* @param bool $with_not_delivered
* @return Flora_Collection|Flora_Model_Geo_City[]
*/
public function getCitiesList($country_id = 0, $region_id = 0, $limit = 0, $offset = 0, $with_not_delivered = false)
{
return $this->call(self::API_CITIES,
array("limit" => (int)$limit, "offset" => (int)$offset,
"country_id" => (int)$country_id, "region_id" => (int)$region_id,
"with_not_delivered" => $with_not_delivered));
}
/**
* @param $id int Numeric ID
* @return Flora_Model_Geo_Region
*/
public function getRegionByID($id)
{
return $this->call(self::API_REGION, array("id" => $id));
}
/**
* @param int $country_id
* @param int $limit
* @param int $offset
* @return Flora_Collection|Flora_Model_Geo_City[]
*/
public function getRegionsList($country_id = 0, $limit = 0, $offset = 0)
{
return $this->call(self::API_REGIONS, array("limit" => (int)$limit, "offset" => (int)$offset,
"country_id" => (int)$country_id));
}
/**
* @return stdClass
*/
public function getUserIPInfo()
{
return $this->call(self::API_USERIPINFO);
}
}