Sha256: 4640d968529d975f5336172865531b27376496bfbddf86fab8dfb09d23c9b5e8
Contents?: true
Size: 890 Bytes
Versions: 1
Compression:
Stored size: 890 Bytes
Contents
module TexMindbody module Api class << self def issue path = "#{TexMindbody::Api.config.rest_api}/usertoken/issue" headers = { "Content-Type": 'application/json', "Api-Key": TexMindbody::Api.config.api_key, "SiteId": TexMindbody::Api.config.site_id } body = { "Username": TexMindbody::Api.config.username, "Password": TexMindbody::Api.config.password } response = HTTParty.post path, :headers => headers, :query => {}, :body => body.to_json raise IOError.new response if response.server_error? raise ArgumentError.new response unless response.success? raise RuntimeError.new response if response['AccessToken'].nil? TexMindbody::Api.config.auth_token = response['AccessToken'] end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tex_mindbody-api-0.1.0 | lib/tex_mindbody/api/endpoint/usertoken.rb |