Class: RequestBase
- Inherits:
-
Object
- Object
- RequestBase
- Defined in:
- lib/RequestBase.rb
Direct Known Subclasses
CustomRequest, DownloadImages, DownloadVideos, Images, SearchImages, SearchImagesCreative, SearchImagesEditorial, SearchVideos, SearchVideosCreative, SearchVideosEditorial, Videos
Instance Attribute Summary collapse
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#http_helper ⇒ Object
Returns the value of attribute http_helper.
-
#query_params ⇒ Object
Returns the value of attribute query_params.
Instance Method Summary collapse
-
#initialize(api_key, access_token) ⇒ RequestBase
constructor
A new instance of RequestBase.
- #with_accept_language(language) ⇒ Object
- #with_custom_header(key, value) ⇒ Object
- #with_custom_parameter(key, value) ⇒ Object
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
#headers ⇒ Object
Returns the value of attribute headers.
5 6 7 |
# File 'lib/RequestBase.rb', line 5 def headers @headers end |
#http_helper ⇒ Object
Returns the value of attribute http_helper.
5 6 7 |
# File 'lib/RequestBase.rb', line 5 def http_helper @http_helper end |
#query_params ⇒ Object
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 |