Class: Shutterstock::Request

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Request

Returns a new instance of Request.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/client/request.rb', line 12

def initialize(&block)
  @success_status = 200
  @send_authorization = true
  @content_type = 'application/json'

  # Handle both forms of config:
  # Request.new { |r| r.method=... }
  # Request.new { method=... }
  if block_given?
    if block.arity == 1
      yield self
    else
      instance_eval(&block)

    end
  end
end

Instance Attribute Details

#body=(value) ⇒ Object (writeonly)

:post, :get etc



4
5
6
# File 'lib/client/request.rb', line 4

def body=(value)
  @body = value
end

#content_type=(value) ⇒ Object (writeonly)

:post, :get etc



4
5
6
# File 'lib/client/request.rb', line 4

def content_type=(value)
  @content_type = value
end

#method=(value) ⇒ Object (writeonly)

:post, :get etc



4
5
6
# File 'lib/client/request.rb', line 4

def method=(value)
  @method = value
end

#params=(value) ⇒ Object (writeonly)

:post, :get etc



4
5
6
# File 'lib/client/request.rb', line 4

def params=(value)
  @params = value
end

#path=(value) ⇒ Object (writeonly)

:post, :get etc



4
5
6
# File 'lib/client/request.rb', line 4

def path=(value)
  @path = value
end

#send_authorization=(value) ⇒ Object (writeonly)

:post, :get etc



4
5
6
# File 'lib/client/request.rb', line 4

def send_authorization=(value)
  @send_authorization = value
end

#success_status=(value) ⇒ Object (writeonly)

:post, :get etc



4
5
6
# File 'lib/client/request.rb', line 4

def success_status=(value)
  @success_status = value
end