Class: ZapiPackageCategories
- Inherits:
-
Object
- Object
- ZapiPackageCategories
- Defined in:
- lib/zapi_package_categories.rb
Instance Attribute Summary collapse
-
#generate_xml ⇒ Object
readonly
Returns the value of attribute generate_xml.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#session ⇒ Object
readonly
Returns the value of attribute session.
-
#zapi ⇒ Object
readonly
Returns the value of attribute zapi.
Instance Method Summary collapse
- #index(user_id: session.user_id, api_token: session.api_token) ⇒ Object
-
#initialize(session:, zapi: nil, xml_generator: nil) ⇒ ZapiPackageCategories
constructor
A new instance of ZapiPackageCategories.
- #to_a ⇒ Object
Constructor Details
#initialize(session:, zapi: nil, xml_generator: nil) ⇒ ZapiPackageCategories
Returns a new instance of ZapiPackageCategories.
5 6 7 8 9 |
# File 'lib/zapi_package_categories.rb', line 5 def initialize session:, zapi: nil, xml_generator: nil @zapi = zapi || Zapi.new() @generate_xml = xml_generator || ZapiXML.new(session: session) @session = session end |
Instance Attribute Details
#generate_xml ⇒ Object (readonly)
Returns the value of attribute generate_xml.
3 4 5 |
# File 'lib/zapi_package_categories.rb', line 3 def generate_xml @generate_xml end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
3 4 5 |
# File 'lib/zapi_package_categories.rb', line 3 def response @response end |
#session ⇒ Object (readonly)
Returns the value of attribute session.
3 4 5 |
# File 'lib/zapi_package_categories.rb', line 3 def session @session end |
#zapi ⇒ Object (readonly)
Returns the value of attribute zapi.
3 4 5 |
# File 'lib/zapi_package_categories.rb', line 3 def zapi @zapi end |
Instance Method Details
#index(user_id: session.user_id, api_token: session.api_token) ⇒ Object
11 12 13 14 |
# File 'lib/zapi_package_categories.rb', line 11 def index user_id: session.user_id, api_token: session.api_token categories_xml = generate_xml.get_package_categories @response = zapi.request(xml: categories_xml) end |
#to_a ⇒ Object
16 17 18 19 |
# File 'lib/zapi_package_categories.rb', line 16 def to_a # convert received categoires to enumberable array end |