Sha256: 426978e8d161031fbe0ead61844e02447993f90e24100b036926983a9f0a7fc5

Contents?: true

Size: 533 Bytes

Versions: 1

Compression:

Stored size: 533 Bytes

Contents

module Uatu
  module Endpoints
    module Single

      Uatu::RESOURCES.each do |resource|
        # example: GET /v1/public/characters/{characterId} => Uatu::Base.new.character
        define_method resource do |id, options={}|
          raise Uatu::Error::BadRequest.new('options must be in a Hash') unless options.is_a?(Hash)
          options.merge!("#{resource}_id".to_sym => id)
          connection = Uatu::Connection.new resource, options
          request_and_build(connection).first
        end
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
uatu-marvel-0.1.0 lib/uatu/endpoints/single.rb