class SportsSouth::Brand
Constants
- API_URL
Public Class Methods
all(options = {})
click to toggle source
# File lib/sports_south/brand.rb, line 12 def self.all(options = {}) requires!(options, :username, :password) new(options).all end
new(options = {})
click to toggle source
# File lib/sports_south/brand.rb, line 6 def initialize(options = {}) requires!(options, :username, :password) @options = options end
Public Instance Methods
all()
click to toggle source
# File lib/sports_south/brand.rb, line 18 def all http, request = get_http_and_request(API_URL, '/BrandUpdate') request.set_form_data(form_params(@options)) response = http.request(request) xml_doc = Nokogiri::XML(sanitize_response(response)) raise SportsSouth::NotAuthenticated if not_authenticated?(xml_doc) xml_doc.css('Table').map { |brand| map_hash(brand) } end
Protected Instance Methods
map_hash(node)
click to toggle source
# File lib/sports_south/brand.rb, line 32 def map_hash(node) { brand_id: content_for(node, 'BRDNO'), name: content_for(node, 'BRDNM'), url: content_for(node, 'BRDURL'), item_count: content_for(node, 'ITCOUNT') } end