Module: Open311::Client::Service
- Included in:
- Open311::Client
- Defined in:
- lib/open311/client/service.rb
Instance Method Summary collapse
-
#get_service_request(id, options = {}) ⇒ Object
Hash.
-
#post_service_request(options = {}) ⇒ Object
Hash.
-
#request_id_from_token(token_id, options = {}) ⇒ Object
Array.
-
#service_definition(id, options = {}) ⇒ Object
Hash.
-
#service_list(options = {}) ⇒ Array
Provide a list of acceptable 311 service request types and their associated service codes.
- #service_requests(options = {}) ⇒ Array
Instance Method Details
#get_service_request(id, options = {}) ⇒ Object
Returns Hash.
73 74 75 76 77 78 79 |
# File 'lib/open311/client/service.rb', line 73 def get_service_request(id, = {}) () response = get("requests/#{id}", ) unpack_if_xml(response) do response['service_requests']['request'] end end |
#post_service_request(options = {}) ⇒ Object
Returns Hash.
58 59 60 61 62 63 64 |
# File 'lib/open311/client/service.rb', line 58 def post_service_request( = {}) (, api_key: api_key) response = post('requests', ) unpack_if_xml(response) do response['service_requests']['request'] end end |
#request_id_from_token(token_id, options = {}) ⇒ Object
Returns Array.
88 89 90 91 92 93 94 |
# File 'lib/open311/client/service.rb', line 88 def request_id_from_token(token_id, = {}) () response = get("tokens/#{token_id}", ) unpack_if_xml(response) do response['service_requests']['request'] end end |
#service_definition(id, options = {}) ⇒ Object
Returns Hash.
29 30 31 32 33 34 35 |
# File 'lib/open311/client/service.rb', line 29 def service_definition(id, = {}) () response = get("services/#{id}", ) unpack_if_xml(response) do response['service_definition'] end end |
#service_list(options = {}) ⇒ Array
Provide a list of acceptable 311 service request types and their associated service codes
13 14 15 16 17 18 19 |
# File 'lib/open311/client/service.rb', line 13 def service_list( = {}) () response = get('services', ) unpack_if_xml(response) do response['services']['service'] end end |
#service_requests(options = {}) ⇒ Array
43 44 45 46 47 48 49 50 |
# File 'lib/open311/client/service.rb', line 43 def service_requests( = {}) () response = get('requests', ) unpack_if_xml(response) do return [] unless response.service_requests.respond_to? :request response['service_requests']['request'] end end |