Sha256: e895be817850c6b660b98f4f4f371ae61d1145ad56558613f601304a2c1b83b5
Contents?: true
Size: 975 Bytes
Versions: 6
Compression:
Stored size: 975 Bytes
Contents
module RedboothRuby module Request class Info attr_accessor :http_method, :api_url, :data, :subdomain, :session, :base_path, :options def initialize(http_method, subdomain, api_url, data, options = {}) @http_method = http_method @subdomain = subdomain || DOMAIN_BASE @api_url = api_url @data = data @base_path = RedboothRuby.configuration[:api_base_path] @session = options[:session] @options = options end def url url = "/#{api_url}" if has_id? url += "/#{data[:id]}" data.delete(:id) end url end def path_with_params(path, params) unless params.empty? encoded_params = URI.encode_www_form(params) [path, encoded_params].join('?') else path end end protected def has_id? !data[:id].nil? end end end end
Version data entries
6 entries across 6 versions & 1 rubygems