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.
74 75 76 77 78 79 80 |
# File 'lib/open311/client/service.rb', line 74 def get_service_request(id, ={}) .merge!(:jurisdiction_id => jurisdiction) response = get("requests/#{id}", ) unpack_if_xml(response) do response['service_requests']['request'] end end |
#post_service_request(options = {}) ⇒ Object
Returns Hash.
59 60 61 62 63 64 65 |
# File 'lib/open311/client/service.rb', line 59 def post_service_request(={}) .merge!(:jurisdiction_id => jurisdiction, :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.
89 90 91 92 93 94 95 |
# File 'lib/open311/client/service.rb', line 89 def request_id_from_token(token_id, = {}) .merge!(:jurisdiction_id => jurisdiction) 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, ={}) .merge!(:jurisdiction_id => jurisdiction) 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(={}) .merge!(:jurisdiction_id => jurisdiction) 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 51 |
# File 'lib/open311/client/service.rb', line 43 def service_requests(={}) .merge!(:jurisdiction_id => jurisdiction) response = get("requests", ) unpack_if_xml(response) do response.service_requests.request.map do |request| response['service_requests']['request'] end end end |