Sha256: ac260c47e3887a01a51dc1465b4bea3c1a231e9c8274a61df8748ec7fd17a171
Contents?: true
Size: 527 Bytes
Versions: 4
Compression:
Stored size: 527 Bytes
Contents
# frozen_string_literal: true module Talkbird module Result # Success monad (sort of). class Success attr_reader :body def initialize(result, body = nil) @result = result @body = parse_body(body) end def status_code @result.code end def parse_body(body) if body.nil? MultiJson.load(@result.body.to_s) elsif body.is_a?(String) MultiJson.load(body) else body end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
talkbird-0.0.5 | lib/talkbird/result/success.rb |
talkbird-0.0.4 | lib/talkbird/result/success.rb |
talkbird-0.0.3 | lib/talkbird/result/success.rb |
talkbird-0.0.2 | lib/talkbird/result/success.rb |