Module: ShutterstockRuby::Connections
Instance Method Summary collapse
- #get(path, params = nil, options = {}) ⇒ Object
- #post(path, body, params = nil, options = {}) ⇒ Object
Instance Method Details
#get(path, params = nil, options = {}) ⇒ Object
3 4 5 6 7 8 9 10 |
# File 'lib/shutterstock-ruby/connections.rb', line 3 def get(path, params = nil, = {}) ensure_credentials! = { accept: :json }.merge() [:params] = params unless params.nil? RestClient.get(build_url(path), add_bearer()) end |
#post(path, body, params = nil, options = {}) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/shutterstock-ruby/connections.rb', line 12 def post(path, body, params = nil, = {}) ensure_credentials! [:params] = params unless params.nil? [:content_type] = "application/json" RestClient.post(build_url(path), body, add_bearer()) end |