Sha256: d57f0bdfb174f7bb2c6d429845eeaf75605d6ed0ef5c1f967e94f2de843c7b5a
Contents?: true
Size: 825 Bytes
Versions: 3
Compression:
Stored size: 825 Bytes
Contents
module Xway class Api class Request class Body attr_reader :path def initialize path @path = path end def read check_type do |extname| if File.exists?(path) File.read(path) else raise ManifestFileNotFound, "could not find file #{path}" end end end def mime_type check_type do |extname| 'application/json' end end private def check_type extname = File.extname(path) if extname == '.json' yield extname else raise ManifestFileTypeUnsupported, \ "unsupported extension #{extname} for #{path}" end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
xway-0.0.3.beta | lib/xway/api/request/body.rb |
xway-0.0.2.beta | lib/xway/api/request/body.rb |
xway-0.0.1.beta | lib/xway/api/request/body.rb |