Class: RequestBase

Inherits:
Object
  • Object
show all
Defined in:
lib/RequestBase.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key, access_token) ⇒ RequestBase

Returns a new instance of RequestBase.



7
8
9
10
11
12
13
14
# File 'lib/RequestBase.rb', line 7

def initialize(api_key, access_token)
	
	#puts "here is my token #{access_token}" 		
	@http_helper = HttpHelper.new(api_key, access_token)						
	@query_params = Hash.new
	@headers = Hash.new

end

Instance Attribute Details

#headersObject

Returns the value of attribute headers.



5
6
7
# File 'lib/RequestBase.rb', line 5

def headers
  @headers
end

#http_helperObject

Returns the value of attribute http_helper.



5
6
7
# File 'lib/RequestBase.rb', line 5

def http_helper
  @http_helper
end

#query_paramsObject

Returns the value of attribute query_params.



5
6
7
# File 'lib/RequestBase.rb', line 5

def query_params
  @query_params
end

Instance Method Details

#with_accept_language(language) ⇒ Object



38
39
40
41
# File 'lib/RequestBase.rb', line 38

def with_accept_language(language)
	@headers["Accept-Language"] = language
	return self
end

#with_custom_header(key, value) ⇒ Object



44
45
46
47
# File 'lib/RequestBase.rb', line 44

def with_custom_header(key, value)
	@headers[key] = value
	return self
end

#with_custom_parameter(key, value) ⇒ Object



50
51
52
53
# File 'lib/RequestBase.rb', line 50

def with_custom_parameter(key, value)
	add_parameter(key, value)
	return self
end