Module: SeeClickFix::Client::Issues

Included in:
SeeClickFix::Client
Defined in:
lib/seeclickfix/client/issues.rb

Instance Method Summary collapse

Instance Method Details

#create_issue(summary, lat, lng, options = {}) ⇒ Array<Hashie::Mash>

Use this query to get details on a single issue. There may be more information in this query than the issue listing query.

For each service request question provide the following parameters.

Examples:

SeeClickFix.issue_details("1050")
SeeClickFix.create_details("foo","41.3103725899427", "-72.9241595114853") http://seeclickfix.com/api/issues.xml

Parameters:

  • summary (String)

    Summary of the problem

  • lat (String)

    Latitude of the issue.

  • lng (String)

    Longitude of the issue.

  • api_key (String)

    Api key

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • issue (description)

    [String] Longer text describing the problem.

  • issue (address)

    [String] Text representation of the location of the issue.

  • issue (reporter_email)

    [String] Email of the person reporting the issue.

  • issue (reporter_display)

    [String] Text display of the person reporting the issue.

  • issue (issue_image_attributes)

    [uploaded_data] [String] Attach an image to the issue. Form data must be sent as "multipart/form-data".

  • issue (request_type_id)

    [String] If submitting to a service request, specify the service request ID here. By adding this attribute, additional validations are required, including: 1. Making sure the service request can be within the given boundaries. 2. Making sure all of the required additional questions are completed.

  • issue (request_type_answers_attributes)

    [][request_type_question_primary_key] [String] Primary key of the service request question.

  • issue (request_type_answers_attributes)

    [][answer] [String] Answer to the service request question.

Returns:

  • (Array<Hashie::Mash>)
  • (Array<Hashie::Mash>)

See Also:



77
78
79
# File 'lib/seeclickfix/client/issues.rb', line 77

def create_issue(summary, lat, lng, options={})
  post("api/issues.json?issue[summary]=#{summary}&issue[lat]=#{lat}&issue[lng]=#{lng}")
end

#issue_details(issue, options = {}) ⇒ Array<Hashie::Mash>

Use this query to get details on a single issue. There may be more information in this query than the issue listing query.

Examples:

SeeClickFix.issue_details("1050")

Parameters:

  • issue (String)

    The issue number for the query

  • options (Hash) (defaults to: {})

    A customizable set of options.

Returns:

  • (Array<Hashie::Mash>)

See Also:



48
49
50
# File 'lib/seeclickfix/client/issues.rb', line 48

def issue_details(issue, options={})
  get("api/issues/#{issue}.json", options)
end

#list_issues(location, options = {}) ⇒ Array<Hashie::Mash>

Returns a list of issues for the location Data is returned in chunks of num_results. You can increment the page parameter to get the next group of results. If page exceeds the total number of pages the result will be an empty array

Examples:

SeeClickFix.list_issues("San Francisco")

Parameters:

  • location (String)

    Geocodable street address. e.g. zipcode, city, state or 123 state st. new haven, ct.

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • zoom (String)

    Integer level from 0 to 19 based on google maps.

  • lat (String)

    Lattitude

  • lon (String)

    Longitude

  • lat_min (String)

    Minimum lattitude

  • lon_min (String)

    Minimum longitude

  • lat_max (String)

    Maximum lattitude

  • lon_max (String)

    Maximum longitude

  • status (String)

    Open Set equal to "true" to see open issues. If status is not set the API returns Open, Closed, and Acknowledged issues.

  • status (String)

    Closed Set equal to "true" to see closed issues. If status is not set the API returns Open, Closed, and Acknowledged issues.

  • status (String)

    Acknowledged Set equal to "true" to see acknowledged issues. If status is not set the API returns Open, Closed, and Acknowledged issues.

  • status (String)

    Archived Set equal to "true" to see archived issues. If status is not set the API returns Open, Closed, and Acknowledged issues.

  • start (String)

    The number of hours ago the oldest issue can be. Partial hours can be in decimal format, for example 0.25 shows reports in the last 15min.

  • end (String)

    The number of hours ago the youngest issue can be.

  • num_results (Integer)

    The maximum number of results to return (default 10, maximum 1000).

  • page (Integer)

    If the number of results exceeds num_results, page can increment the range.

  • search (String)

    A query string to limit the results by.

  • sort (String)

    A parameter to sort the results by. Possible values include: issues.updated_at - Date last updated

  • Issues.created_at (String)

    Date Created

  • Issues.rating (String)

    Issue Rating

  • Issues.hot (String)

    Issue Hotness

  • direction (String)

    Sort direction. Possible values include: ASC - Ascending

  • DESC (String)

    Descending.

  • request_tags (String)

    Limit results to issues with service request tags. Service request tags are automatically added to issues when issues are reported to a specific service request. Multiple request tags can be found using the form "request_type_[request_type_id],request_type_[request_type_id],request_type_[request_type_id]".

Returns:

  • (Array<Hashie::Mash>)

See Also:



36
37
38
# File 'lib/seeclickfix/client/issues.rb', line 36

def list_issues(location, options={})
  get("api/issues.json?at=#{location}", options)
end