Module: Xeroizer::Http

Included in:
GenericApplication
Defined in:
lib/xeroizer/http.rb

Constant Summary collapse

ACCEPT_MIME_MAP =
{
  :pdf  => 'application/pdf',
  :json => 'application/json'
}

Instance Method Summary collapse

Instance Method Details

#http_get(client, url, extra_params = {}) ⇒ Object

Shortcut method for #http_request with ‘method` = :get.

Parameters:

  • client (OAuth)

    OAuth client

  • url (String)

    URL of request

  • extra_params (Hash) (defaults to: {})

    extra query string parameters.



28
29
30
# File 'lib/xeroizer/http.rb', line 28

def http_get(client, url, extra_params = {})
  http_request(client, :get, url, nil, extra_params)
end

#http_post(client, url, body, extra_params = {}) ⇒ Object

Shortcut method for #http_request with ‘method` = :post.

Parameters:

  • client (OAuth)

    OAuth client

  • url (String)

    URL of request

  • body (String)

    XML message to post.

  • extra_params (Hash) (defaults to: {})

    extra query string parameters.



38
39
40
# File 'lib/xeroizer/http.rb', line 38

def http_post(client, url, body, extra_params = {})
  http_request(client, :post, url, body, extra_params)
end

#http_put(client, url, body, extra_params = {}) ⇒ Object

Shortcut method for #http_request with ‘method` = :put.

Parameters:

  • client (OAuth)

    OAuth client

  • url (String)

    URL of request

  • body (String)

    XML message to put.

  • extra_params (Hash) (defaults to: {})

    extra query string parameters.



48
49
50
# File 'lib/xeroizer/http.rb', line 48

def http_put(client, url, body, extra_params = {})
  http_request(client, :put, url, body, extra_params)
end