Module: NgpVan::Response

Included in:
Client
Defined in:
lib/ngp_van/response.rb,
lib/ngp_van/response/raise_error.rb

Defined Under Namespace

Classes: RaiseError

Class Method Summary collapse

Class Method Details

.create(body) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/ngp_van/response.rb', line 5

def self.create(body)
  JSON.parse(body)
# The VAN API does not always return JSON. For example, when creating a new
# code, you post to /codes. The return is the integer ID of the newly
# created code, not a json representation of it. For cases like this, we
# will just return the body un-parsed.
rescue JSON::ParserError
  body
end