class TFSO::Product
Constants
- URL
Public Class Methods
new(auth)
click to toggle source
# File lib/tfso/product.rb, line 8 def initialize(auth) ensure_authenticated(auth) self.session_id = auth.session_id intialize_savon_client end
Public Instance Methods
find(search_params)
click to toggle source
# File lib/tfso/product.rb, line 14 def find(search_params) response = savon_client.call(:get_products, message: {searchParams: search_params, returnProperties: {string: ['Id', 'Name', 'Price'] } }, cookies: @cookies) result = response.body[:get_products_response][:get_products_result] if result if result[:product].class == Hash [result[:product]] else result[:product] end else [] end end
find_by_id(id)
click to toggle source
# File lib/tfso/product.rb, line 28 def find_by_id(id) if product = find(Id: id) product.first end end