Sha256: d47a2b3d3edb88261a38d916f887c5e069c125674c630c80b51a2995b53fdbfd

Contents?: true

Size: 1006 Bytes

Versions: 1

Compression:

Stored size: 1006 Bytes

Contents

module Venmo
  module Sender

    def pay_by_email(email, amount, note)
      send_hash= common(amount,note, { :email => email})
      core_pay
    # -d email= \
    end

    def pay_by_user_id(user_id, amount, note
      send_hash= common(amount,note, {:user_id => user_id})
      core_pay
    # -d user_id= \
    end

    def pay_by_phone_number(phone_number, amount, note)
      send_hash = common(amount,note, {:phone_number=> phone_number})
      core_pay
    # -d phone= \
    end

    protected
    def common(amount, note, merge_in)
      {amount: amount,
        note: note}.merge(merge_in)
    end

    def core_pay
      base_url = "curl https://api.venmo.com/payments \ -d"
      to_send = base_url+send_hash.join('\ -d')
    end

    def send_hash=(update_hash)
      send_hash
      @send_hash.merge(update_hash)
    end

    def send_hash
      @send_hash ||= {access_token: Venmo::Config.access_token,
                      audience: (Venmo::Config.privacy || "private")}
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
venmo-0.1.1 lib/venmo/sender.rb