Sha256: 6509716f223f3ef8e5a8e6b7940e5eb9e7cf4c24709c488e541b4680003ac692

Contents?: true

Size: 386 Bytes

Versions: 9

Compression:

Stored size: 386 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
      res.body ? return_resource(resource_from_json(res.body)) : nil
    end

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
yao-0.7.0 lib/yao/resources/action.rb
yao-0.6.3 lib/yao/resources/action.rb
yao-0.6.2 lib/yao/resources/action.rb
yao-0.6.1 lib/yao/resources/action.rb
yao-0.6.0 lib/yao/resources/action.rb
yao-0.5.0 lib/yao/resources/action.rb
yao-0.4.3 lib/yao/resources/action.rb
yao-0.4.2 lib/yao/resources/action.rb
yao-0.4.1 lib/yao/resources/action.rb