Sha256: 7f8cf43a540ebdc457db6f8ae192af5054dc24a3a5c5b400bb46caa3f23710c4

Contents?: true

Size: 454 Bytes

Versions: 8

Compression:

Stored size: 454 Bytes

Contents

module Yao::Resources
  module Action

    # @param id [String]
    # @param query [Hash]
    # @return [Hash]
    def action(id, query)
      res = POST(action_path(id)) do |req|
        req.body = query.to_json
        req.headers['Content-Type'] = 'application/json'
      end
      res.body
    end

    private

    # @param id [String]
    # @return [String]
    def action_path(id)
      [resources_name, id, "action"].join("/")
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
yao-0.21.0 lib/yao/resources/action.rb
yao-0.20.0 lib/yao/resources/action.rb
yao-0.19.0 lib/yao/resources/action.rb
yao-0.18.0 lib/yao/resources/action.rb
yao-0.17.0 lib/yao/resources/action.rb
yao-0.16.0 lib/yao/resources/action.rb
yao-0.15.0 lib/yao/resources/action.rb
yao-0.14.0 lib/yao/resources/action.rb