class Server

This class handel the server requests

Public Class Methods

create(gem, deps) click to toggle source

$URI = 'localhost:3000'

# File lib/syslibgem/server.rb, line 12
def self.create(gem, deps)
  json = { gem_name: gem, os_name: find_os, deps: deps }
  HTTParty.post(
    $URI + '/api/v1/deps',
    body: json.to_json,
    headers:  { 'Content-Type' => 'application/json',
                'Accept' => 'application/json' }
  )
end
find_os() click to toggle source
# File lib/syslibgem/server.rb, line 27
def self.find_os
  if OS.mac?
    'mac'
  elsif OS.linux?
    'lunix'
  else
    'unknown'
  end
end
load(gems) click to toggle source
# File lib/syslibgem/server.rb, line 22
def self.load(gems)
  json = { gems: gems, os_name: find_os }
  HTTParty.get($URI + '/api/v1/deps', query: json)
end