class Object

Public Instance Methods

authenticate(email, password) click to toggle source
# File bin/yassh, line 53
def authenticate(email, password)
  $api["/auth"].post({username: email, password: password}.to_json).json
end
commit_revision(domain, revision, token) click to toggle source
# File bin/yassh, line 49
def commit_revision(domain, revision, token)
  $api["/sites/#{domain}/revisions/#{revision}/commit"].post("", {Authorization: "Bearer #{token}"}).json
end
create_revision(domain, token) click to toggle source
# File bin/yassh, line 41
def create_revision(domain, token)
  $api["/sites/#{domain}/revisions"].post("", {Authorization: "Bearer #{token}"}).json["revision"]["number"]
end
create_site(domain, token) click to toggle source
# File bin/yassh, line 37
def create_site(domain, token)
  $api['/sites'].post({ domain: domain }.to_json, {Authorization: "Bearer #{token}"}).json
end
load_default_domain() click to toggle source
# File bin/yassh, line 23
def load_default_domain
  File.read("CNAME").strip.split.first
rescue
  nil
end
load_default_token() click to toggle source
# File bin/yassh, line 29
def load_default_token
  dir_path = File.join(ENV["HOME"], ".config/yassh/")
  path = File.join(dir_path, "access_token")
  File.read(path).strip.split.first
rescue
  nil
end
post_file(domain, revision, metadata, token) click to toggle source
# File bin/yassh, line 45
def post_file(domain, revision, metadata, token)
  $api["/sites/#{domain}/revisions/#{revision}/files"].post(metadata.to_json, {Authorization: "Bearer #{token}"}).json
end
signup(email, password) click to toggle source
# File bin/yassh, line 57
def signup(email, password)
  $api["/accounts"].post({email: email, password: password}.to_json).json
end