module Slack

Copyright © 2015 Gustavo Bazan MIT License

The module that contains everything Slack-related:

Copyright © 2015 Gustavo Bazan MIT License

Copyright © 2015 Gustavo Bazan MIT License

Copyright © 2015 Gustavo Bazan MIT License

Copyright © 2015 Gustavo Bazan MIT License

Copyright © 2015 Gustavo Bazan MIT License

Copyright © 2015 Gustavo Bazan MIT License

Copyright © 2015 Gustavo Bazan MIT License

Copyright © 2015 Gustavo Bazan MIT License

Copyright © 2015 Gustavo Bazan MIT License

Copyright © 2015 Gustavo Bazan MIT License

Copyright © 2015 Gustavo Bazan MIT License

Copyright © 2015 Gustavo Bazan MIT License

Copyright © 2015 Gustavo Bazan MIT License

Copyright © 2015 Gustavo Bazan MIT License

Constants

VERSION

The current version of the wrapper.

WEB_SERVER

Slack url

Public Class Methods

parse_response(response, raw = false) click to toggle source

Parse response. You probably shouldn't be calling this directly. This takes responses from the server and parses them. It also checks for errors and raises exceptions with the appropriate messages.

@param [Net::HTTPResponse] response @param [Boolean] raw if return raw data @raise [SlackError] @raise [SlackAuthError]

# File lib/slack-api-wrapper.rb, line 30
def self.parse_response(response, raw = false)
  if response.is_a?(Net::HTTPServerError)
    fail Slack::Error.new("Slack Server Error: #{response} - #{response.body}", response)
  end
  return response.body if raw
  d = JSON.parse(response.body)
  fail Slack::Error.new(d['error'], response) if d['error']
  return d
rescue JSON::ParserError
  raise Slack::Error.new("Unable to parse JSON response: #{response.body}", response)
end