Sha256: de0f66fff0a20f21bd1b0fda4f58f1ddb0a4eb39a3b0bf4326bc605d953868d0

Contents?: true

Size: 1.33 KB

Versions: 14

Compression:

Stored size: 1.33 KB

Contents

module SynapsePayments
  class Transactions

    def initialize(client, user_id, node_id, oauth_key, fingerprint)
      @client = client
      @user_id = user_id
      @node_id = node_id
      @oauth_key = oauth_key
      @fingerprint = fingerprint
    end

    def all
      @client.get(path: "/users/#{@user_id}/nodes/#{@node_id}/trans", oauth_key: @oauth_key, fingerprint: @fingerprint)
    end

    def create(node_id:, node_type:, amount:, currency:, ip_address:, **args)
      data = {
        to: {
          type: node_type,
          id: node_id
        },
        amount: {
          amount: amount,
          currency: currency
        },
        extra: {
          ip: ip_address
        }.merge(args)
      }

      @client.post(path: "/users/#{@user_id}/nodes/#{@node_id}/trans", oauth_key: @oauth_key, fingerprint: @fingerprint, json: data)
    end

    def delete(id)
      @client.delete(path: "/users/#{@user_id}/nodes/#{@node_id}/trans/#{id}", oauth_key: @oauth_key, fingerprint: @fingerprint)
    end

    def find(id)
      @client.get(path: "/users/#{@user_id}/nodes/#{@node_id}/trans/#{id}", oauth_key: @oauth_key, fingerprint: @fingerprint)
    end

    def update(id, data)
      @client.patch(path: "/users/#{@user_id}/nodes/#{@node_id}/trans/#{id}", oauth_key: @oauth_key, fingerprint: @fingerprint, json: data)
    end

  end

end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
synapse_payments-0.8.1 lib/synapse_payments/transactions.rb
synapse_payments-0.8.0 lib/synapse_payments/transactions.rb
synapse_payments-0.7.0 lib/synapse_payments/transactions.rb
synapse_payments-0.6.4 lib/synapse_payments/transactions.rb
synapse_payments-0.6.3 lib/synapse_payments/transactions.rb
synapse_payments-0.6.2 lib/synapse_payments/transactions.rb
synapse_payments-0.6.1 lib/synapse_payments/transactions.rb
synapse_payments-0.6.0 lib/synapse_payments/transactions.rb
synapse_payments-0.5.0 lib/synapse_payments/transactions.rb
synapse_payments-0.4.0 lib/synapse_payments/transactions.rb
synapse_payments-0.3.1 lib/synapse_payments/transactions.rb
synapse_payments-0.3.0 lib/synapse_payments/transactions.rb
synapse_payments-0.2.1 lib/synapse_payments/transactions.rb
synapse_payments-0.2.0 lib/synapse_payments/transactions.rb