Skip to content

Instantly share code, notes, and snippets.

View dannymcc's full-sized avatar

Danny McClelland dannymcc

View GitHub Profile
Possible Models:
Healthplan
Claim
Conditions
Workflow:
1) Client creates a new healthplan where they are presented with a list of conditions. The user then ticks which conditions are excluded. They then save the healthplan record.
payments GET /payments(.:format) payments#index
POST /payments(.:format) payments#create
new_payment GET /payments/new(.:format) payments#new
edit_payment GET /payments/:id/edit(.:format) payments#edit
payment GET /payments/:id(.:format) payments#show
PUT /payments/:id(.:format) payments#update
DELETE /payments/:id(.:format) payments#destroy
claims GET /claims(.:format) claims#index
POST /claims(.:format) claims#create
new_claim GET /claims/new(.:format) claims#new
Danny M. I can find the first subscription using the API, and I can list all of the subscriptions in my local table.
11:20 AM
Danny M. What I can't do is list all of the local subscriptions and get the missing information from the API.
My subscription table has resource_id which I would like to then lookup the amount and interval details etc.
Tim R. Liviu - The customer does make an account, but ti's only a very quick process at the end of setting up the payment
You should be able to do GoCardless::Subscription.find(subscription_record.resource_id)
where subscription_record is an item from the table
Liviu P. ok, thanks Tim
Danny M. I'm a little confused as to where that should be? In my subscriptions controller?
I don't seem to be able to find any records unless I set the merchant ID in the controller
def deploy_receive
if request.get?
render :text => "hello"
elsif request.post?
deploy_payload = JSON.parse(params[:payload])
Activity.create(:action => 'deployed a change', :details => "deploy_payload['identifier'] and deploy_payload['name']", :user_id => '1')
render :text => "success"
else
render :text => "error"
end
def deploy_receive
if request.get?
render :text => "hello"
elsif request.post?
deploy_payload = JSON.parse(params[:payload])
Activity.create(:action => 'deployed a change', :details => deploy_payload['identifier'], :user_id => '1')
render :text => "success"
else
render :text => "error"
end
Parameters: {"payload"=>"{\"date\":\"Mon, 29 Oct 2012 15:09:31 +0000\",\"from\":\"root <[email protected]>\",\"identifier\":6056760,\"message_id\":\"[email protected]\",\"from_name\":\"root\",\"from_address\":\"[email protected]\",\"to\":\"[email protected]\",\"delivered_to\":\"[email protected]\",\"address_identifier\":null,\"cc\":null,\"subject\":\"Incoming fax\",\"in_reply_to\":null,\"references\":null,\"plain_body\":\"A fax has arrived from 01257232632. It is attached.\",\"html_body\":null,\"rule\":\"[email protected]\",\"priority\":3,\"attachments\":[[\"11-1351523332.47071.tiff\",\"image/tiff\",34372,\"http://api.deliverhq.com/api/incoming/attachment/7gdd71wo75/6056760/0\"]],\"spam_status\":0}", "signature"=>"hVWY3u98xklZGvD3/U0RKA/CAhJqcLnjzIGLLk67JiOYMPCNMcRPh8r/Ybpo\n2T0wdh6aOGFctEfbrbhZqgCrn/li5/6LIiOjn3E52YNUCwDNuKWPtcK1Xl6K\nh86Q59mgCxRIfHxqoxAOd+5QizJDgCRLtFiK1WL3c9VPP0uzgWk=\n"}
Activity.create(
hash = JSON.parse(params[:payload])
:action => "deployed the intranet",
:details => params["identifier"],
:user_id => "1",
)
@dannymcc
dannymcc / actvities_controller.rb
Created October 26, 2012 18:32
Activities Controller
def deploy_receive
@activity = Activity.new
if @activity.save
render json: @activity
else
@activity = "error"
render json: @activity
end
end
respond_to do |format|
format.html # index.html.erb
format.json { render :json => @faults.limit(5).to_json(:except => [ :created_at, :updated_at, :id]) }
end
@dannymcc
dannymcc / Error
Created September 30, 2012 19:47
Calls Mailer
Call Load (0.3ms) SELECT `calls`.* FROM `calls` LIMIT 1
ActionView::Template::Error: undefined method `each' for nil:NilClass