Sha256: 0db4e7283ef4cf7453a505f977c5352ed6505ba9c8e45b387c525dee5645e363

Contents?: true

Size: 850 Bytes

Versions: 8

Compression:

Stored size: 850 Bytes

Contents

module Cobrato
  module Resources
    class Charge < Base
      crud :all

      def receive(id, params)
        http.post("#{resource_base_path}/#{id}/receive", { body: params }) do |response|
          respond_with_entity(response)
        end
      end

      def undo_receive(id)
        http.post("#{resource_base_path}/#{id}/undo_receive") do |response|
          respond_with_entity(response)
        end
      end

      def deliver_billet(id, emails=nil)
        body = {to: emails}
        http.post("#{resource_base_path}/#{id}/deliver_billet", { body: body }) do |response|
          response.code == 200
        end
      end

      def billet(id)
        http.get("#{resource_base_path}/#{id}/billet") do |response|
          respond_with_openstruct response
        end
      end

      notify :receive, :undo_receive
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
cobrato-client-0.3.0 lib/cobrato/resources/charge.rb
cobrato-client-0.3.0.rc1 lib/cobrato/resources/charge.rb
cobrato-client-0.2.11 lib/cobrato/resources/charge.rb
cobrato-client-0.2.10 lib/cobrato/resources/charge.rb
cobrato-client-0.2.9 lib/cobrato/resources/charge.rb
cobrato-client-0.2.8 lib/cobrato/resources/charge.rb
cobrato-client-0.2.7 lib/cobrato/resources/charge.rb
cobrato-client-0.2.6 lib/cobrato/resources/charge.rb