Sha256: 1ccd1b4bd329c04ef903947105c3bc09e87bfb4ce7343389d28e0168890f6558

Contents?: true

Size: 705 Bytes

Versions: 5

Compression:

Stored size: 705 Bytes

Contents

module Economic
  class PricingRepo < Economic::ProductRepo
    def self.currency_specific_sales_prices_for(product_or_product_number)
      id = product_or_product_number.product_number if product_or_product_number.respond_to? :product_number
      id ||= product_or_product_number

      id = Economic::BaseRepo.id_to_url_formatted_id(id)
      end_point = [superclass.endpoint_url, id, "pricing", "currency-specific-sales-prices"].join("/")
      response = send_request(method: :get, url: end_point)
      entry_hash = JSON.parse(response.body)
      pricings = []

      entry_hash["collection"].each do |pricing|
        pricings.push Pricing.new(pricing)
      end
      pricings
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
economic-rest-0.6.4 lib/economic/pricing_repo.rb
economic-rest-0.6.3 lib/economic/pricing_repo.rb
economic-rest-0.6.2 lib/economic/pricing_repo.rb
economic-rest-0.6.1 lib/economic/pricing_repo.rb
economic-rest-0.6.0 lib/economic/pricing_repo.rb