Sha256: 0c3e43662aa8fcaa7491903cc986818e40b5d3ab322c232c383d35b4f33a75cb
Contents?: true
Size: 1.4 KB
Versions: 3
Compression:
Stored size: 1.4 KB
Contents
module Moip::Assinaturas class Plan class << self def create(plan) response = Moip::Assinaturas::Client.create_plan(plan) hash = JSON.load(response.body).with_indifferent_access case response.code when 201 return { success: true, plan: hash } when 400 return { success: false, message: hash['message'], errors: hash['errors'] } else raise(WebServerResponseError, "Ocorreu um erro no retorno do webservice") end end def list response = Moip::Assinaturas::Client.list_plans hash = JSON.load(response.body).with_indifferent_access case response.code when 200 return { success: true, plans: hash[:plans] } else raise(WebServerResponseError, "Ocorreu um erro no retorno do webservice") end end def details(code) response = Moip::Assinaturas::Client.details_plan(code) hash = JSON.load(response.body).with_indifferent_access case response.code when 200 return { success: true, plan: hash } else raise(WebServerResponseError, "Ocorreu um erro no retorno do webservice") end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
moip-assinaturas-0.1.1 | lib/moip-assinaturas/plan.rb |
moip-assinaturas-0.1.0 | lib/moip-assinaturas/plan.rb |
moip-assinaturas-0.0.3 | lib/moip-assinaturas/plan.rb |