Sha256: 17e6a4f7c4d17cb6a3d0a61f9a70e6710e3a27b0f1918a80ee228c64a7bd98ef
Contents?: true
Size: 1.73 KB
Versions: 16
Compression:
Stored size: 1.73 KB
Contents
# Class ReferenceClient represents server request of reference API (provides a # mechanism for accessing the standard "reference information" used by the # 3taps system, including locations, categories, and sources). # # Its methods are used to query API with appropriate requests: # client = ReferenceClient.new # client.get_categories # => returns array of Category objects # client.get_category(code) # => returns Category object # client.get_locations # => returns array of Location objects # client.get_sources # => returns array of Source objects class ReferenceClient < Client # Method +get_categories+ returns the 3taps categories. # # Example: # # client = ReferenceClient.new # client.get_categories # => Array of Category # def get_categories response = execute_get("/reference/category") File.new("newfile", "w+") << response Category.from_array(decode(response)) end # Method +get_category+ returns a single category by passing in the category code. # Takes value of code objects as +String+ parameter. # # Example: # # client.get_category('NYC') # => Categoty # def get_category(code) response = execute_get("/reference/category/" + code) Category.from_hash(decode(response)[0]) end # Method +get_locations+ returns the 3taps locations. # # Example: # # client.get_locations # => Array of Location # def get_locations response = execute_get("/reference/location") Location.from_array(decode(response)) end # Method +get_sources+ returns the 3taps sources. # # Example: # # client.get_sources # => Array of Source # def get_sources response = execute_get("/reference/source") Source.from_array(decode(response)) end end
Version data entries
16 entries across 16 versions & 1 rubygems