Skip to content

Commit df53511

Browse files
authored
Merge pull request #7 from nathanjdunn/feature/add-headers
Add Headers Parameter
2 parents 4da3171 + fd3d8e2 commit df53511

File tree

23 files changed

+437
-295
lines changed

23 files changed

+437
-295
lines changed

src/Api/Addons/Addon.php

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,102 +9,109 @@ class Addon extends AbstractApi
99
{
1010
/**
1111
* @param array $parameters
12+
* @param array $headers
1213
*
1314
* @throws Exception
1415
*
1516
* @return array|string
1617
*/
17-
public function list(array $parameters = [])
18+
public function list(array $parameters = [], array $headers = [])
1819
{
1920
$resolver = $this->createOptionsResolver();
2021

2122
$url = $this->url('addons');
2223

23-
return $this->get($url, $resolver->resolve($parameters));
24+
return $this->get($url, $resolver->resolve($parameters), $headers);
2425
}
2526

2627
/**
2728
* @param string $id
29+
* @param array $headers
2830
*
2931
* @throws Exception
3032
*
3133
* @return array|string
3234
*/
33-
public function find(string $id)
35+
public function find(string $id, array $headers = [])
3436
{
3537
$url = $this->url('addons/%s', $id);
3638

37-
return $this->get($url);
39+
return $this->get($url, [], $headers);
3840
}
3941

4042
/**
4143
* @param array $data
44+
* @param array $headers
4245
*
4346
* @throws Exception
4447
*
4548
* @return array|string
4649
*/
47-
public function create(array $data)
50+
public function create(array $data, array $headers = [])
4851
{
4952
$url = $this->url('addons');
5053

51-
return $this->post($url, $data);
54+
return $this->post($url, $data, $headers);
5255
}
5356

5457
/**
5558
* @param string $id
5659
* @param array $data
60+
* @param array $headers
5761
*
5862
* @throws Exception
5963
*
6064
* @return array|string
6165
*/
62-
public function update(string $id, array $data = [])
66+
public function update(string $id, array $data = [], array $headers = [])
6367
{
6468
$url = $this->url('addons/%s', $id);
6569

66-
return $this->post($url, $data);
70+
return $this->post($url, $data, $headers);
6771
}
6872

6973
/**
7074
* @param string $id
75+
* @param array $headers
7176
*
7277
* @throws Exception
7378
*
7479
* @return array|string
7580
*/
76-
public function delete(string $id)
81+
public function delete(string $id, array $headers = [])
7782
{
7883
$url = $this->url('addons/%s/delete', $id);
7984

80-
return $this->post($url, []);
85+
return $this->post($url, [], $headers);
8186
}
8287

8388
/**
8489
* @param array $data
90+
* @param array $headers
8591
*
8692
* @throws Exception
8793
*
8894
* @return array|string
8995
*/
90-
public function copy(array $data)
96+
public function copy(array $data, array $headers = [])
9197
{
9298
$url = $this->url('addons/copy');
9399

94-
return $this->post($url, $data);
100+
return $this->post($url, $data, $headers);
95101
}
96102

97103
/**
98104
* @param string $id
105+
* @param array $headers
99106
*
100107
* @throws Exception
101108
*
102109
* @return array|string
103110
*/
104-
public function unarchive(string $id)
111+
public function unarchive(string $id, array $headers = [])
105112
{
106113
$url = $this->url('addons/%s/unarchive', $id);
107114

108-
return $this->post($url, []);
115+
return $this->post($url, [], $headers);
109116
}
110117
}

src/Api/Addresses/Address.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ class Address extends AbstractApi
1010
{
1111
/**
1212
* @param array $parameters
13+
* @param array $headers
1314
*
1415
* @throws Exception
1516
*
1617
* @return array|string
1718
*/
18-
public function find(array $parameters)
19+
public function find(array $parameters, array $headers = [])
1920
{
2021
$resolver = new OptionsResolver();
2122

@@ -29,20 +30,21 @@ public function find(array $parameters)
2930

3031
$url = $this->url('addresses');
3132

32-
return $this->get($url, $resolver->resolve($parameters));
33+
return $this->get($url, $resolver->resolve($parameters), $headers);
3334
}
3435

3536
/**
3637
* @param array $data
38+
* @param array $headers
3739
*
3840
* @throws Exception
3941
*
4042
* @return array|string
4143
*/
42-
public function update(array $data)
44+
public function update(array $data, array $headers = [])
4345
{
4446
$url = $this->url('addresses');
4547

46-
return $this->post($url, $data);
48+
return $this->post($url, $data, $headers);
4749
}
4850
}

src/Api/Cards/Card.php

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,74 +9,79 @@ class Card extends AbstractApi
99
{
1010
/**
1111
* @param string $id
12+
* @param array $headers
1213
*
1314
* @throws Exception
1415
*
1516
* @return array|string
1617
*/
17-
public function find(string $id)
18+
public function find(string $id, array $headers = [])
1819
{
1920
$url = $this->url('cards/%s', $id);
2021

21-
return $this->get($url);
22+
return $this->get($url, [], $headers);
2223
}
2324

2425
/**
2526
* @param string $customerId
2627
* @param array $data
28+
* @param array $headers
2729
*
2830
* @throws Exception
2931
*
3032
* @return array|string
3133
*/
32-
public function copy(string $customerId, array $data)
34+
public function copy(string $customerId, array $data, array $headers = [])
3335
{
3436
$url = $this->url('customers/%s/copy_card', $customerId);
3537

36-
return $this->post($url, $data);
38+
return $this->post($url, $data, $headers);
3739
}
3840

3941
/**
4042
* @param string $customerId
4143
* @param array $data
44+
* @param array $headers
4245
*
4346
* @throws Exception
4447
*
4548
* @return array|string
4649
*/
47-
public function update(string $customerId, array $data)
50+
public function update(string $customerId, array $data, array $headers = [])
4851
{
4952
$url = $this->url('customers/%s/credit_card', $customerId);
5053

51-
return $this->post($url, $data);
54+
return $this->post($url, $data, $headers);
5255
}
5356

5457
/**
5558
* @param $customerId
5659
* @param array $data
60+
* @param array $headers
5761
*
5862
* @throws Exception
5963
*
6064
* @return array|string
6165
*/
62-
public function switchGateway($customerId, array $data)
66+
public function switchGateway($customerId, array $data, array $headers = [])
6367
{
6468
$url = $this->url('customers/%s/switch_gateway', $customerId);
6569

66-
return $this->post($url, $data);
70+
return $this->post($url, $data, $headers);
6771
}
6872

6973
/**
7074
* @param string $customerId
75+
* @param array $headers
7176
*
7277
* @throws Exception
7378
*
7479
* @return array|string
7580
*/
76-
public function delete(string $customerId)
81+
public function delete(string $customerId, array $headers = [])
7782
{
7883
$url = $this->url('customers/%s/delete_card', $customerId);
7984

80-
return $this->post($url, []);
85+
return $this->post($url, [], $headers);
8186
}
8287
}

src/Api/Comments/Comment.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@ class Comment extends AbstractApi
99
{
1010
/**
1111
* @param array $parameters
12+
* @param array $headers
1213
*
1314
* @throws Exception
1415
*
1516
* @return array|string
1617
*/
17-
public function list(array $parameters = [])
18+
public function list(array $parameters = [], array $headers = [])
1819
{
1920
$resolver = $this->createOptionsResolver();
2021

@@ -25,12 +26,13 @@ public function list(array $parameters = [])
2526

2627
/**
2728
* @param string $id
29+
* @param array $headers
2830
*
2931
* @throws Exception
3032
*
3133
* @return array|string
3234
*/
33-
public function find(string $id)
35+
public function find(string $id, array $headers = [])
3436
{
3537
$url = $this->url('comments/%s', $id);
3638

@@ -39,29 +41,31 @@ public function find(string $id)
3941

4042
/**
4143
* @param array $data
44+
* @param array $headers
4245
*
4346
* @throws Exception
4447
*
4548
* @return array|string
4649
*/
47-
public function create(array $data)
50+
public function create(array $data, array $headers = [])
4851
{
4952
$url = $this->url('comments');
5053

51-
return $this->post($url, $data);
54+
return $this->post($url, $data, $headers);
5255
}
5356

5457
/**
5558
* @param string $id
59+
* @param array $headers
5660
*
5761
* @throws Exception
5862
*
5963
* @return array|string
6064
*/
61-
public function delete(string $id)
65+
public function delete(string $id, array $headers = [])
6266
{
6367
$url = $this->url('comments/%s', $id);
6468

65-
return $this->post($url, []);
69+
return $this->post($url, [], $headers);
6670
}
6771
}

src/Api/CouponCodes/CouponCode.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,45 +9,48 @@ class CouponCode extends AbstractApi
99
{
1010
/**
1111
* @param array $parameters
12+
* @param array $headers
1213
*
1314
* @throws Exception
1415
*
1516
* @return array|string
1617
*/
17-
public function list(array $parameters = [])
18+
public function list(array $parameters = [], array $headers = [])
1819
{
1920
$resolver = $this->createOptionsResolver();
2021

2122
$url = $this->url('coupon_codes');
2223

23-
return $this->get($url, $resolver->resolve($parameters));
24+
return $this->get($url, $resolver->resolve($parameters), $headers);
2425
}
2526

2627
/**
2728
* @param string $id
29+
* @param array $headers
2830
*
2931
* @throws Exception
3032
*
3133
* @return array|string
3234
*/
33-
public function find(string $id)
35+
public function find(string $id, array $headers = [])
3436
{
3537
$url = $this->url('coupon_codes/%s', $id);
3638

37-
return $this->get($url);
39+
return $this->get($url, [], $headers);
3840
}
3941

4042
/**
4143
* @param string $id
44+
* @param array $headers
4245
*
4346
* @throws Exception
4447
*
4548
* @return array|string
4649
*/
47-
public function archive(string $id)
50+
public function archive(string $id, array $headers = [])
4851
{
4952
$url = $this->url('coupon_codes/%s/archive', $id);
5053

51-
return $this->post($url, []);
54+
return $this->post($url, [], $headers);
5255
}
5356
}

0 commit comments

Comments
 (0)