lib/qismo/client.rb in qismo-0.14.0 vs lib/qismo/client.rb in qismo-0.15.0
- old
+ new
@@ -1,8 +1,10 @@
# frozen_string_literal: true
module Qismo
+ # Qismo ruby client
+ #
class Client
include Qismo::Api
# @return [String, NilClass]
DEFAULT_APP_ID = ENV["QISCUS_APP_ID"]
@@ -42,11 +44,10 @@
#
# @param path [String]
# @param body [Hash]
# @return [Qismo::ObjectifiedHash]
def post(path, body = {})
- puts body.to_json
request(:post, path, json: body.compact)
end
# Send HTTP request with post method to upload file
#
@@ -84,13 +85,10 @@
# @param json [Hash]
# @return [Qismo::ObjectifiedHash]
def request(method, path, options = {})
res = connection.request(method, @url + path, options.compact)
- # require "byebug"
- # byebug
-
if res.status.success?
begin
return JSON.parse(res.to_s, object_class: Qismo::ObjectifiedHash)
rescue JSON::ParserError
return res.to_s
@@ -168,9 +166,12 @@
}
"#{format[:lib_name]}/#{format[:lib_version]} (#{format[:platform]}; #{format[:lang]}; v#{format[:lang_version]}) app_id:#{@app_id}"
end
+ # Default broadcast name for using in send broadcast api
+ #
+ # @return [String]
def default_broadcast_name
Time.current.strftime("%d/%m/%Y, %H:%I %z")
end
end
end