Sha256: 5fbf6c4255dc9f6cf06e7d3bdeac947b532ecffae8265190ba34e0a49f277b3b
Contents?: true
Size: 438 Bytes
Versions: 5
Compression:
Stored size: 438 Bytes
Contents
class Cart < ActiveRecord::Base include DiscoApp::Concerns::Synchronises belongs_to :shop, class_name: 'DiscoApp::Shop' SHOPIFY_API_CLASS = ShopifyAPI::Cart before_save :set_token def self.synchronise_by(shop, data) { token: data[:token] } end def total_price data[:line_items].map { |line_item| line_item[:line_price].to_f }.sum end private def set_token self.token = data[:token] end end
Version data entries
5 entries across 5 versions & 1 rubygems