1 | <?php |
||
10 | class Client implements HttpContract |
||
11 | { |
||
12 | use ConfigurationTrait, |
||
13 | HttpTrait; |
||
14 | |||
15 | /** |
||
16 | * Access token |
||
17 | * |
||
18 | * @var string |
||
19 | */ |
||
20 | protected $accessToken; |
||
21 | |||
22 | /** |
||
23 | * Api key |
||
24 | * |
||
25 | * @var string |
||
26 | */ |
||
27 | protected $apiKey; |
||
28 | |||
29 | /** |
||
30 | * Creates new client |
||
31 | * |
||
32 | * @param array $options |
||
33 | */ |
||
34 | 26 | public function __construct(array $options = array()) |
|
48 | |||
49 | /** |
||
50 | * Creates default http client with appropriate authorization configuration. |
||
51 | * |
||
52 | * @return \GuzzleHttp\Client |
||
53 | */ |
||
54 | 26 | public function createDefaultHttpClient() |
|
62 | |||
63 | /** |
||
64 | * Fetches results from the Autocomplete API. |
||
65 | * |
||
66 | * @param array $parameters |
||
67 | * |
||
68 | * @return stdClass |
||
69 | * @throws Stevenmaguire\Yelp\Exception\HttpException |
||
70 | * @link https://www.yelp.com/developers/documentation/v3/autocomplete |
||
71 | */ |
||
72 | 2 | public function getAutocompleteResults($parameters = []) |
|
79 | |||
80 | /** |
||
81 | * Returns the api key, if available, otherwise returns access token. |
||
82 | * |
||
83 | * @return string|null |
||
84 | * @link https://www.yelp.com/developers/documentation/v3/authentication#where-is-my-client-secret-going |
||
85 | */ |
||
86 | 26 | private function getBearerToken() |
|
94 | |||
95 | /** |
||
96 | * Fetches a specific business by id. |
||
97 | * |
||
98 | * @param string $businessId |
||
99 | * @param array $parameters |
||
100 | * |
||
101 | * @return stdClass |
||
102 | * @throws Stevenmaguire\Yelp\Exception\HttpException |
||
103 | * @link https://www.yelp.com/developers/documentation/v3/business |
||
104 | */ |
||
105 | 4 | public function getBusiness($businessId, $parameters = []) |
|
112 | |||
113 | /** |
||
114 | * Fetches reviews for a specific business by id. |
||
115 | * |
||
116 | * @param string $businessId |
||
117 | * @param array $parameters |
||
118 | * |
||
119 | * @return stdClass |
||
120 | * @throws Stevenmaguire\Yelp\Exception\HttpException |
||
121 | * @link https://www.yelp.com/developers/documentation/v3/business_reviews |
||
122 | */ |
||
123 | 2 | public function getBusinessReviews($businessId, $parameters = []) |
|
130 | |||
131 | /** |
||
132 | * Fetches results from the Business Search API. |
||
133 | * |
||
134 | * @param array $parameters |
||
135 | * |
||
136 | * @return stdClass |
||
137 | * @throws Stevenmaguire\Yelp\Exception\HttpException |
||
138 | * @link https://www.yelp.com/developers/documentation/v3/business_search |
||
139 | */ |
||
140 | 2 | public function getBusinessesSearchResults($parameters = []) |
|
149 | |||
150 | /** |
||
151 | * Fetches results from the Business Search API by Phone. |
||
152 | * |
||
153 | * @param string $phoneNumber |
||
154 | * |
||
155 | * @return stdClass |
||
156 | * @throws Stevenmaguire\Yelp\Exception\HttpException |
||
157 | * @link https://www.yelp.com/developers/documentation/v3/business_search_phone |
||
158 | */ |
||
159 | 2 | public function getBusinessesSearchResultsByPhone($phoneNumber) |
|
170 | |||
171 | /** |
||
172 | * Fetches results from the Business Search API by Type. |
||
173 | * |
||
174 | * @param string $type |
||
175 | * @param array $parameters |
||
176 | * |
||
177 | * @return stdClass |
||
178 | * @throws Stevenmaguire\Yelp\Exception\HttpException |
||
179 | * @link https://www.yelp.com/developers/documentation/v3/transactions_search |
||
180 | */ |
||
181 | 2 | public function getTransactionsSearchResultsByType($type, $parameters = []) |
|
188 | } |
||
189 |