Sha256: da531ded40ece412efccb20f9817201a1fe965f849f02d3ebd7c51aee08fc78a
Contents?: true
Size: 514 Bytes
Versions: 8
Compression:
Stored size: 514 Bytes
Contents
require "json" require "time" module Espago class Response attr_reader :status attr_reader :body def initialize(response) @body = parse(response.body) @status = response.status end def method_missing(attribute_name) body[attribute_name.to_s] end def card body["card"] || {} end def created_at Time.at(body["created_at"]) rescue nil end private def parse(body) JSON.parse body rescue body end end end
Version data entries
8 entries across 8 versions & 1 rubygems