This repository has been archived by the owner on Oct 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathArtackMxApi.php
111 lines (81 loc) · 1.98 KB
/
ArtackMxApi.php
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
<?php
namespace Artack\MxApi;
use Artack\MxApi\Request\Call;
/**
* @author Patrick Landolt <[email protected]>
*/
class ArtackMxApi
{
/**
* @var Dispatcher
*/
protected $dispatcher;
/**
* @var Call
*/
protected $call;
public function __construct(Dispatcher $dispatcher, Call $call)
{
$this->dispatcher = $dispatcher;
$this->call = $call;
}
public function setVersion($version)
{
$this->call->setVersion($version);
return $this;
}
public function setLanguage($language)
{
$this->call->setLanguage($language);
return $this;
}
public function setSettings(array $settings = array())
{
$this->call->setSettings($settings);
return $this;
}
public function setPath($path, array $ids = array())
{
$this->call->setPath($path, $ids);
return $this;
}
public function setPluralization($pluralization)
{
$this->call->setPluralization($pluralization);
return $this;
}
public function setBody($body)
{
$this->call->setBody($body);
return $this;
}
public function get()
{
$this->call->setMethod('GET');
return $this->dispatch();
}
public function post()
{
$this->call->setMethod('POST');
return $this->dispatch();
}
public function put()
{
$this->call->setMethod('PUT');
return $this->dispatch();
}
public function patch()
{
$this->call->setMethod('PATCH');
return $this->dispatch();
}
public function delete()
{
$this->call->setMethod('DELETE');
return $this->dispatch();
}
protected function dispatch()
{
return $this->dispatcher->dispatch($this->call);
}
}