Sha256: 3fe972ee7f5344bad7092854d7b557d838b8fbd3efb100c8a1ba4f1f8b51bab1
Contents?: true
Size: 834 Bytes
Versions: 1
Compression:
Stored size: 834 Bytes
Contents
require_relative 'client/errors' class Moysklad::Client URL = 'https://online.moysklad.ru' def initialize login: nil, password: nil @client = Faraday.new URL @client.basic_auth login, password end def get path, params={} logger.debug "Client: GET #{path} #{params}" validate client.get path, params end def put path, data logger.debug "Client: PUT #{path}" result = client.put do |req| req.url path req.headers['Content-Type'] = 'application/xml' req.headers['Accept'] = '*/*' req.body = data end validate result end def delete path validate client.delete path end private attr_reader :client def logger Moysklad.logger end def validate res return res.body if res.status == 200 Moysklad::Client::Error.build res end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
moysklad-0.0.2 | lib/moysklad/client.rb |