Skip to content

Instantly share code, notes, and snippets.

@esmevane
Created November 21, 2012 21:03
Show Gist options
  • Save esmevane/4127703 to your computer and use it in GitHub Desktop.
Save esmevane/4127703 to your computer and use it in GitHub Desktop.
[Ruby / Rails] LinkshareFeed class suggestion
class LinkshareFeed
def initialize order
@order = order
@items = order.line_items
end
def sku_list
"#{@items.map(&:sku).join('|')}|Discount"
end
def parameters
{
sku_list: sku_list
}
end
end
class Order < ActiveRecord::Base
def linkshare_feed
@linkshare_feed ||= LinkshareFeed.new self
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment