Sha256: 84ff54682c24eb3a170d372b41abe261d635aeb9c9a15d703ef92486cb2dc391

Contents?: true

Size: 803 Bytes

Versions: 2

Compression:

Stored size: 803 Bytes

Contents

module BridgeClient
  class SendPaymentRequest < BaseRequest

    BODY_ATTRS = %i[
      source
      destination
      amount
      asset_code
      asset_issuer
      memo_type
      memo
    ]
    attribute :source, String
    attribute :destination, String
    attribute :amount, Float
    attribute :asset_code, String
    attribute :asset_issuer, String
    attribute :memo_type, String
    attribute :memo, String
    attribute :body, Hash, lazy: true, default: :default_body

    private

    def path
      "/payment"
    end

    def headers
      {"Content-Type" => "application/x-www-form-urlencoded"}
    end

    def default_action
      :post
    end

    def default_body
      BODY_ATTRS.each_with_object({}) do |attr, hash|
        hash[attr] = send(attr)
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bridge_client-0.4.0 lib/bridge_client/requests/send_payment_request.rb
bridge_client-0.3.0 lib/bridge_client/requests/send_payment_request.rb