lib/ncmb/client.rb in ncmb-ruby-client-0.1.3 vs lib/ncmb/client.rb in ncmb-ruby-client-0.1.4
- old
+ new
@@ -1,14 +1,16 @@
+# frozen_string_literal: true
+
class Time
def to_json(a)
v = self.getgm
"{\"__type\": \"Date\", \"iso\": \"#{v.iso8601(3)}\"}"
end
end
module NCMB
- DOMAIN = 'mb.api.cloud.nifty.com'
+ DOMAIN = 'mbaas.api.nifcloud.com'
API_VERSION = '2013-09-01'
@application_key = nil
@client_key = nil
@@client = nil
@@current_user = nil
@@ -113,18 +115,17 @@
signature_base = []
signature_base << method.upcase
signature_base << @domain
signature_base << path
signature_base << params.collect{|k,v| "#{k}=#{v}"}.join("&")
- signature = Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha256'), @client_key, signature_base.join("\n"))).strip()
+ Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha256'), @client_key, signature_base.join("\n"))).strip()
end
def make_boundary(boundary, queries)
post_body = []
post_body << "--#{boundary}"
post_body << "Content-Disposition: form-data; name=\"file\"; filename=\"#{queries[:fileName]}\""
post_body << "Content-Type: #{queries['mime-type'.to_sym]}"
- post_body << ""
post_body << queries[:file].read
post_body << ""
post_body << "--#{boundary}"
post_body << "Content-Disposition: form-data; name=\"acl\""
post_body << ""