Sha256: f247f7b03010fd7ea10cf246897438a1e48a293085311768a5a7dcb475ca13bf
Contents?: true
Size: 908 Bytes
Versions: 2
Compression:
Stored size: 908 Bytes
Contents
module Copy module Request class Info attr_accessor :http_method, :api_url, :data, :subdomain, :session, :base_path 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 = API_BASE_PATH @session = options[:session] end def url url = "/#{base_path}/#{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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
copy-ruby-0.0.2 | lib/copy/request/info.rb |
copy-ruby-0.0.1 | lib/copy/request/info.rb |