• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

podio-community / podio-php / 5883458979

16 Aug 2023 08:19PM UTC coverage: 47.564% (-5.9%) from 53.497%
5883458979

Pull #242

github

web-flow
Merge 89cf31048 into 51d68f28d
Pull Request #242: More fixes

181 of 181 new or added lines in 43 files covered. (100.0%)

996 of 2094 relevant lines covered (47.56%)

33.35 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

74.19
/models/PodioContact.php
1
<?php
2
/**
3
 * @see https://developers.podio.com/doc/contacts
4
 */
5
class PodioContact extends PodioObject
6
{
7
    public function __construct($attributes = array())
8
    {
9
        parent::__construct();
32✔
10
        $this->property('profile_id', 'integer');
32✔
11
        $this->property('user_id', 'integer');
32✔
12
        $this->property('name', 'string');
32✔
13
        $this->property('avatar', 'integer');
32✔
14
        $this->property('birthdate', 'date');
32✔
15
        $this->property('department', 'string');
32✔
16
        $this->property('vatin', 'string');
32✔
17
        $this->property('skype', 'string');
32✔
18
        $this->property('about', 'string');
32✔
19
        $this->property('address', 'array');
32✔
20
        $this->property('zip', 'string');
32✔
21
        $this->property('city', 'string');
32✔
22
        $this->property('country', 'string');
32✔
23
        $this->property('state', 'string');
32✔
24
        $this->property('im', 'array');
32✔
25
        $this->property('location', 'array');
32✔
26
        $this->property('mail', 'array');
32✔
27
        $this->property('phone', 'array');
32✔
28
        $this->property('title', 'array');
32✔
29
        $this->property('url', 'array');
32✔
30
        $this->property('skill', 'array');
32✔
31
        $this->property('linkedin', 'string');
32✔
32
        $this->property('twitter', 'string');
32✔
33
        $this->property('organization', 'string');
32✔
34
        $this->property('type', 'string');
32✔
35
        $this->property('space_id', 'integer');
32✔
36
        $this->property('link', 'string');
32✔
37
        $this->property('rights', 'array');
32✔
38

39
        $this->property('app_store_about', 'string');
32✔
40
        $this->property('app_store_organization', 'string');
32✔
41
        $this->property('app_store_location', 'string');
32✔
42
        $this->property('app_store_title', 'string');
32✔
43
        $this->property('app_store_url', 'string');
32✔
44

45
        $this->property('last_seen_on', 'datetime');
32✔
46
        $this->property('is_employee', 'boolean');
32✔
47

48
        // Only available for space contacts
49
        $this->property('role', 'integer');
32✔
50
        $this->property('removable', 'boolean');
32✔
51

52
        $this->has_one('image', 'File');
32✔
53

54
        $this->init($attributes);
32✔
55
    }
56

57
    /**
58
     * @see https://developers.podio.com/doc/contacts/create-space-contact-65590
59
     */
60
    public static function create(PodioClient $podio_client, $space_id, $attributes = array())
61
    {
62
        $body = $podio_client->post("/contact/space/{$space_id}/", $attributes)->json_body();
×
63
        return $body['profile_id'];
×
64
    }
65

66
    /**
67
     * @see https://developers.podio.com/doc/contacts/delete-contact-s-60560
68
     */
69
    public static function delete(PodioClient $podio_client, $profile_ids)
70
    {
71
        return $podio_client->delete("/contact/{$profile_ids}");
×
72
    }
73

74
    /**
75
     * @see https://developers.podio.com/doc/contacts/get-user-contact-field-22403
76
     */
77
    public static function get_field_for_user(PodioClient $podio_client, $user_id, $key)
78
    {
79
        return $podio_client->get("/contact/user/{$user_id}/{$key}")->json_body();
×
80
    }
81

82
    /**
83
     * @see https://developers.podio.com/doc/contacts/get-contact-totals-60467
84
     */
85
    public static function get_totals(PodioClient $podio_client)
86
    {
87
        return $podio_client->get("/contact/totals/")->json_body();
×
88
    }
89

90
    /**
91
     * @see https://developers.podio.com/doc/contacts/get-contact-totals-v3-34629208
92
     */
93
    public static function get_totals_v3(PodioClient $podio_client)
94
    {
95
        return $podio_client->get("/contact/totals/v3/")->json_body();
×
96
    }
97

98
    /**
99
     * @see https://developers.podio.com/doc/contacts/get-space-contact-totals-67508
100
     */
101
    public static function get_totals_for_space(PodioClient $podio_client, $space_id)
102
    {
103
        return $podio_client->get("/contact/space/{$space_id}/totals/")->json_body();
×
104
    }
105

106
    /**
107
     * @param int|array|string $profile_ids either a single profile id or an array of profile ids.
108
     * A string with comma separated profile ids is also accepted for backwards compatibility.
109
     * @return PodioContact|array a single contact or an array of contacts depending on the parameter `$profile_ids`.
110
     * @see https://developers.podio.com/doc/contacts/get-contact-s-22335
111
     */
112
    public static function get(PodioClient $podio_client, $profile_ids, $attributes = array())
113
    {
114
        $urlParam = is_array($profile_ids) ? implode(',', $profile_ids) : $profile_ids;
8✔
115
        $result = $podio_client->get("/contact/$urlParam/v2", $attributes);
8✔
116
        $response_body = $result->json_body();
8✔
117
        if (empty($response_body['profile_id'])) {
8✔
118
            return self::listing($response_body);
4✔
119
        }
120
        return self::member($response_body);
4✔
121
    }
122

123
    /**
124
     * @see https://developers.podio.com/doc/contacts/get-vcard-213496
125
     */
126
    public static function vcard(PodioClient $podio_client, $profile_id)
127
    {
128
        return $podio_client->get("/contact/{$profile_id}/vcard")->body;
×
129
    }
130

131
    /**
132
     * @see https://developers.podio.com/doc/contacts/get-user-contact-60514
133
     */
134
    public static function get_for_user(PodioClient $podio_client, $user_id)
135
    {
136
        return self::member($podio_client->get("/contact/user/{$user_id}"));
×
137
    }
138

139
    /**
140
     * @see https://developers.podio.com/doc/contacts/get-contacts-22400
141
     */
142
    public static function get_all(PodioClient $podio_client, $attributes = array())
143
    {
144
        return self::listing($podio_client->get("/contact/", $attributes));
×
145
    }
146

147
    /**
148
     * @see https://developers.podio.com/doc/contacts/get-organization-contacts-22401
149
     */
150
    public static function get_for_org(PodioClient $podio_client, $org_id, $attributes = array())
151
    {
152
        return self::listing($podio_client->get("/contact/org/{$org_id}", $attributes));
×
153
    }
154

155
    /**
156
     * @see https://developers.podio.com/doc/contacts/get-space-contacts-22414
157
     */
158
    public static function get_for_space(PodioClient $podio_client, $space_id, $attributes = array())
159
    {
160
        return self::listing($podio_client->get("/contact/space/{$space_id}/", $attributes));
×
161
    }
162

163
    /**
164
     * @see https://developers.podio.com/doc/contacts/get-space-contacts-on-app-79475279
165
     */
166
    public static function get_for_app(PodioClient $podio_client, $app_id, $attributes = array())
167
    {
168
        return self::listing($podio_client->get("/contact/app/{$app_id}/", $attributes));
×
169
    }
170

171
    /**
172
     * @see https://developers.podio.com/doc/contacts/get-skills-1346872
173
     */
174
    public static function get_skills(PodioClient $podio_client, $attributes = array())
175
    {
176
        return $podio_client->get("/contact/skill/", $attributes)->json_body();
×
177
    }
178

179
    /**
180
     * @see https://developers.podio.com/doc/contacts/update-contact-60556
181
     */
182
    public static function update(PodioClient $podio_client, $profile_id, $attributes = array())
183
    {
184
        return $podio_client->put("/contact/{$profile_id}", $attributes);
×
185
    }
186

187
    /**
188
     * @see https://developers.podio.com/doc/contacts/update-contact-field-60558
189
     */
190
    public static function update_field(PodioClient $podio_client, $profile_id, $key, $attributes = array())
191
    {
192
        return $podio_client->put("/contact/{$profile_id}/{$key}", $attributes);
×
193
    }
194
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc