Sha256: 02345396229ed31fb2e376ea98aa3d92209b3aeb3b554a5774e6785118bbd448
Contents?: true
Size: 1.35 KB
Versions: 1
Compression:
Stored size: 1.35 KB
Contents
module Bushido class Data #:nodoc: extend Hooks class << self def attach(*models) # Total no-op, we just need to load the classes in order to # register the hooks, and this does that. end def bushido_data(model, model_data) puts "prepping publish data..." data = {} data[:key] = Bushido::Platform.key data["data"] = model_data puts data.inspect data["data"]["ido_model"] = model puts "Publishing Ido model" puts data.to_json puts Bushido::Platform.publish_url return data end def publish(model, model_data, verb=:post) puts "in the Data::Publish method" # POST to /apps/:id/bus data = bushido_data(model, model_data) puts "got the data" url = Bushido::Platform.publish_url puts "url: #{url} , verb #{verb}" if verb == :delete verb = :put url += "/#{data['data']['ido_id']}" end puts "Publishing to: #{url}" # TODO: Catch non-200 response code response = JSON.parse(RestClient.send(verb, url, data.to_json, :content_type => :json, :accept => :json)) if response['ido_id'].nil? or response['ido_version'].nil? return false end return response end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bushido-0.0.30 | lib/bushido/data.rb |