Module: ShutterstockRuby::Connections

Included in:
Images, Videos
Defined in:
lib/shutterstock-ruby/connections.rb

Instance Method Summary collapse

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, options = {})
  ensure_credentials!

  options = { accept: :json }.merge(options)
  options[:params] = params unless params.nil?

  RestClient.get(build_url(path), add_bearer(options))
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, options = {})
  ensure_credentials!

  options[:params] = params unless params.nil?
  options[:content_type] = "application/json"

  RestClient.post(build_url(path), body, add_bearer(options))
end