Sha256: 2e79c9be8f05309e712e394f78801aa204f3b9f131c1a677aa2e51f6ea0dbce6

Contents?: true

Size: 372 Bytes

Versions: 2

Compression:

Stored size: 372 Bytes

Contents

module Yao::Resources
  module Action
    def action(id, query)
      res = POST(action_path(id)) do |req|
        req.body = query.to_json
        req.headers['Content-Type'] = 'application/json'
      end
      return_resource(res.body[resource_name_in_json])
    end

    private
    def action_path(id)
      [resources_name, id, "action"].join("/")
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
yao-0.2.0 lib/yao/resources/action.rb
yao-0.2.0.rc1 lib/yao/resources/action.rb