Sha256: b478ebfffe85fd39d2bd1229158e4734dec95b2ce564c2fa4eb7a445755b584a
Contents?: true
Size: 836 Bytes
Versions: 1
Compression:
Stored size: 836 Bytes
Contents
# frozen_string_literal: true require_relative 'option' module Opushon # The body structure is a hash where each key is a HTTP method and each value # is a sub-hash, called an option object. class Body include Virtus.model(strict: true) attribute :GET, Option, required: false attribute :PATCH, Option, required: false attribute :PUT, Option, required: false attribute :POST, Option, required: false attribute :DELETE, Option, required: false def to_h { GET: maybe_to_h(@GET), PATCH: maybe_to_h(@PATCH), PUT: maybe_to_h(@PUT), POST: maybe_to_h(@POST), DELETE: maybe_to_h(@DELETE) } end private def maybe_to_h(object) if object.nil? nil else object.to_h end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
opushon-0.2.2 | lib/opushon/body.rb |