lib/social_plus/web_api/client.rb
# Executes a Social Plus Web API
#
# @param [String, Symbol] method An API method name
# @param [Hash] parameters Parameters to API except `key`
# @option parameters [Symbol] :via HTTP method(default `:get`)
# @return [Hash] a Hash generated by parsing the JSON returned from the API call, except `status`,
#   just `{}` on parsing failure
# @raise [ApiError] when the API returns a status other than 200 OK
Executes a Social Plus Web API
Executes a Social Plus Web API
def execute(method, parameters={})
        parameters = parameters.with_indifferent_access
        http_method = parameters.delete(:via) || :get
        response = request(http_method, method, parameters.merge(key: @api_key))
        result = parse_as_json(response.body)
        ApiError.exception_from_api_result(response, result) unless response.is_a?(Net::HTTPOK)
        result.except('status')
      end
def execute ( method , parameters = { } ) parameters = parameters . with_indifferent_access http_method = parameters . delete ( :via ) || :get response = request ( http_method , method , parameters . merge ( key : @api_key ) ) result = parse_as_json ( response . body ) ApiError . exception_from_api_result ( response , result ) unless response . is_a? ( Net :: HTTPOK ) result . except ( 'status' ) end
Executes a Social Plus Web API
Executes a Social Plus Web API
a Hash generated by parsing the JSON returned from the API call, except `status`, just `{}` on parsing failure
a Hash generated by parsing the JSON returned from the API call except ` status ` just ` {} ` on parsing failure
Hash
[ApiError] when the API returns a status other than 200 OK
[ ApiError ] when the API returns a status other than 200 OK
method
<not_specific>
parameters
:via HTTP method(default `:get`)
: via HTTP method ( default ` : get ` )
<not_specific>
parameters Parameters to API except `key`
parameters Parameters to API except ` key `