Services_UseKetchup
[ class tree: Services_UseKetchup ] [ index: Services_UseKetchup ] [ all elements ]

Class: Services_UseKetchup_Common

Source Location: /Services_UseKetchup-0.1.0/Services/UseKetchup/Common.php

Class Overview


Services_UseKetchup_Common


Author(s):

Version:

  • Release: 0.1.0

Variables

Methods


Child classes:

Services_UseKetchup_Meetings
Services_UseKetchup_Meetings
Services_UseKetchup_Notes
Services_UseKetchup_Notes
Services_UseKetchup_Items
Services_UseKetchup_Items
Services_UseKetchup_User
Services_UseKetchup_User
Services_UseKetchup_Projects
Services_UseKetchup_Projects
Services_UseKetchup
Services_UseKetchup

Inherited Variables

Inherited Methods


Class Details

[line 56]
Services_UseKetchup_Common


[ Top ]


Class Variables

$apiToken =

[line 76]


Type:   string


[ Top ]

$client =

[line 82]

  • Var: The client to talk to the API.
  • See: self::makeRequest()
  • Access: protected

Type:   HTTP_Request2


[ Top ]

$endpoint =  'http://useketchup.com/api/v1'

[line 87]

  • Var: The API endpoint.
  • Access: protected

Type:   string


[ Top ]

$password =

[line 63]


Type:   string


[ Top ]

$username =

[line 70]


Type:   string


[ Top ]



Method Detail

accept   [line 96]

void accept( mixed $var)

Acceptor pattern.
  • Access: public

Parameters:

mixed   $var   — 

[ Top ]

debugCall   [line 117]

array debugCall( )

Collect debug information on the last call.
  • Access: public
  • Uses: self::$client

[ Top ]

getClient   [line 132]

mixed getClient( )

Return the instance of HTTP_Request2 or null.
  • Return: HTTP_Request2|null
  • Access: public

[ Top ]

guessId   [line 182]

string guessId( mixed $var)

Try to guess the ID (aka shortcode_url) from the variable.
  • Throws: InvalidArgumentException When the stdClass has no shortcode_url.
  • Access: protected

Parameters:

mixed   $var   —  Either stdClass or a string.

[ Top ]

makeRequest   [line 208]

HTTP_Request2_Response makeRequest( string $url, [string $method = HTTP_Request2::METHOD_GET], [mixed $data = null])

Make an API request. Override the instance of HTTP_Request2 with self::accept() if you need to configure the object with a proxy or something similar.
  • See: self::accept()
  • Throws: HTTP_Request2_Exception In case something goes wrong. ;)
  • Access: protected
  • Uses: self::apiToken()
  • Uses: self::$client

Parameters:

string   $url   —  The URL to request agains.
string   $method   —  The request method ('GET', 'POST', 'PUT', etc.).
mixed   $data   —  Optional, most likely a json encoded string.

[ Top ]

parseResponse   [line 241]

mixed parseResponse( HTTP_Request2_Response $resp)

Parse the response (from self::makeRequest().
  • Throws: RuntimeException In case the API returned an error.
  • Access: protected

Parameters:

HTTP_Request2_Response   $resp   —  The response returned from the API.

[ Top ]

setApiToken   [line 142]

$this setApiToken( $apiToken)

Set an API Token.
  • Access: public

Overridden in child classes as:

Services_UseKetchup::setApiToken()
To be able to mock requests, etc. later/

Parameters:

   $apiToken   — 

[ Top ]

setPassword   [line 155]

$this setPassword( string $password)

Set password.
  • Access: public

Parameters:

string   $password   —  Password of your useketchup.com account.

[ Top ]

setUsername   [line 168]

$this setUsername( string $username)

Set username.
  • Access: public

Parameters:

string   $username   —  Username/email of your useketchup.com account.

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:39:04 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.