Sha256: 47565f03473917e449cd036ed5799093cb023cc8436a70b22bedcad78f036d28

Contents?: true

Size: 369 Bytes

Versions: 22

Compression:

Stored size: 369 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(resource_from_json(res.body))
    end

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

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
yao-0.2.2 lib/yao/resources/action.rb
yao-0.2.1 lib/yao/resources/action.rb