Class: Curlify

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request, compressed: false, verify: true) ⇒ Curlify

Returns a new instance of Curlify.



8
9
10
11
12
# File 'lib/curlify.rb', line 8

def initialize(request, compressed: false, verify: true)
  @request = request
  @compressed = compressed
  @verify = verify
end

Instance Attribute Details

#compressedObject (readonly)

Returns the value of attribute compressed.



6
7
8
# File 'lib/curlify.rb', line 6

def compressed
  @compressed
end

#requestObject (readonly)

Returns the value of attribute request.



6
7
8
# File 'lib/curlify.rb', line 6

def request
  @request
end

#verifyObject (readonly)

Returns the value of attribute verify.



6
7
8
# File 'lib/curlify.rb', line 6

def verify
  @verify
end

Instance Method Details

#to_curlObject



14
15
16
17
18
19
# File 'lib/curlify.rb', line 14

def to_curl
  return "#{curl_request} --compressed" if compressed
  return "#{curl_request} --insecure" unless verify

  curl_request
end