Sha256: 3733889e211a0e69b504f412648a0851b1e55cb091e4e96475bf50790bc042d0
Contents?: true
Size: 835 Bytes
Versions: 4
Compression:
Stored size: 835 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::Errors.build res end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
moysklad-0.1.4 | lib/moysklad/client.rb |
moysklad-0.1.3 | lib/moysklad/client.rb |
moysklad-0.1.2 | lib/moysklad/client.rb |
moysklad-0.1.1 | lib/moysklad/client.rb |