Sha256: 6e4ba6b8567196d9479bcccc63c292b61fab48ce7594d8d24b97492d4c5829ff
Contents?: true
Size: 1.09 KB
Versions: 1
Compression:
Stored size: 1.09 KB
Contents
# frozen_string_literal: true module EatabitRails module REST class Uri def self.default_params { content_type: :json, accept: :json } end def initialize @sid = EatabitRails.configuration.sid @token = EatabitRails.configuration.token @protocol = EatabitRails::REST::Config::PROTOCOL @host = EatabitRails::REST::Config::HOST @version = EatabitRails.configuration.version || EatabitRails::REST::Config::VERSION end def base_uri [ @protocol, '://', @sid, ':', @token, '@', @host, '/', @version, '/account/', @sid ].join end def printer(id) [ base_uri, 'printers', id ].join('/') end def job(printer_id, job_id = nil) uri = [ printer(printer_id), 'jobs' ] uri.push(job_id) if job_id uri.join('/') end alias account base_uri end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
eatabit_rails-0.2.1 | lib/eatabit_rails/rest/uri.rb |