Sha256: 8574fb501641d586871b6f71113ceabd31698524f99e2c1090754479020e32c2

Contents?: true

Size: 760 Bytes

Versions: 2

Compression:

Stored size: 760 Bytes

Contents

module BridgeClient
  class SendPaymentRequest < BaseRequest

    BODY_ATTRS = %i[
      destination
      amount
      asset_code
      asset_issuer
      memo_type
      memo
    ]
    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.2.0 lib/bridge_client/requests/send_payment_request.rb
bridge_client-0.1.0 lib/bridge_client/requests/send_payment_request.rb