Advertisement
Guest User

Ruby code review exercise | Summer '16

a guest
Dec 18th, 2015
1,651
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.98 KB | None | 0 0
  1. class ShopifyAPIClient
  2.   attr_reader :shop_id
  3.   SECRET_API_KEY = "asdasdasQWRESFSDFVSDFASDFSADFASDF123123ASDASD$%$%"
  4.    
  5.   def set_shop_id(shop_Id)
  6.     @shop_id = shop_Id
  7.   end
  8.  
  9.   def orders
  10.     params = Hash.new
  11.     params[:basic_auth] = {username: SECRET_API_KEY, password: ''}
  12.     orders_json = some_http_library.get("https://www.shopify.this.is.a.sample.com/#{shop_id}/orders", params)
  13.     return JSON.parse(orders_json)
  14.   end
  15.  
  16.   def products
  17.     params = Hash.new
  18.     params[:basic_auth] = {username: SECRET_API_KEY, password: ''}
  19.     products_json = some_http_library.get("https://www.shopify.this.is.a.sample.com/#{shop_id}/products", params)
  20.     return JSON.parse(products_json)
  21.   end
  22.  
  23.   def product(id)
  24.     params = Hash.new
  25.     params[:basic_auth] = {username: SECRET_API_KEY, password: ''}
  26.     product_json = some_http_library.get("https://www.shopify.this.is.a.sample.com/#{shop_id}/products/#{id}", params)
  27.     return JSON.parse(product_json)
  28.   end
  29. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement