Sha256: deaa204ab0ca634599cdb548ab8f5cd8c3a9ddc1875ac77fd286641542db990f

Contents?: true

Size: 1.02 KB

Versions: 4

Compression:

Stored size: 1.02 KB

Contents

module Yotpo
  module Purchase
    def create_new_purchase(params)
      request = {
          utoken: params[:utoken],
          email: params[:email],
          customer_name: params[:customer_name],
          order_id: params[:order_id],
          platform: params[:platform],
          products: params[:products]
      }
      app_key = params[:app_key]
      post("/apps/#{app_key}/purchases", request)
    end

    def create_new_purchases(params)
      request = {
          utoken: params[:utoken],
          orders: params[:orders]
      }
      app_key = params[:app_key]
      post("/apps/#{app_key}/purchases/mass_create", request)
    end

    def get_purchases(params)
      request ={
          utoken: params[:utoken],
          since_id: params[:since_id],
          since_date: params[:since_date],
          page: params[:page] || 1,
          count: params[:count] || 10
      }
      request.delete_if{|key, value| value.nil? }
      app_key = params[:app_key]
      get("/apps/#{app_key}/purchases", request)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
yotpo-0.0.6 lib/yotpo/api/purchase.rb
yotpo-0.0.5 lib/yotpo/api/purchase.rb
yotpo-0.0.3 lib/yotpo/api/purchase.rb
yotpo-0.0.2 lib/yotpo/api/purchase.rb