Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save stephenprater/2b8f7aa868159ac502b52d8f409549bd to your computer and use it in GitHub Desktop.
Save stephenprater/2b8f7aa868159ac502b52d8f409549bd to your computer and use it in GitHub Desktop.
desc "run feed"
task :mr => :environment do
include HTTParty
url = 'https://api.commissionfactory.com/V1/Affiliate/Merchants?apiKey=fakekey&status=Joined'
response = HTTParty.get(url).parsed_response.to_h
v = Vendor.find_or_create_by(
name: response['Name'],
)
v.update_attributes(
Category: item['Category'],
TargetUrl: item['TargetUrl'],
Summary: item['Summary'],
TrackingUrl: item['TrackingUrl'],
AvatarUrl: item['AvatarUrl'])
)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment