Class: SportsSouth::Category
- Inherits:
-
Base
- Object
- Base
- SportsSouth::Category
show all
- Defined in:
- lib/sports_south/category.rb
Constant Summary
collapse
- API_URL =
'http://webservices.theshootingwarehouse.com/smart/inventory.asmx'
Constants inherited
from Base
Base::CONTENT_TYPE, Base::TIMEOUT, Base::USER_AGENT
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(options = {}) ⇒ Category
6
7
8
9
10
|
# File 'lib/sports_south/category.rb', line 6
def initialize(options = {})
requires!(options, :username, :password)
@options = options
end
|
Class Method Details
.all(options = {}) ⇒ Object
12
13
14
15
16
|
# File 'lib/sports_south/category.rb', line 12
def self.all(options = {})
requires!(options, :username, :password)
new(options).all
end
|
Instance Method Details
#all ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/sports_south/category.rb', line 18
def all
http, request = get_http_and_request(API_URL, '/CategoryUpdate')
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 { |category| map_hash(category) }
end
|