Class: Leadtune::Rest

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

Overview

:nodoc:all

Constant Summary collapse

PROSPECTS_PATH =
"/prospects"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Rest

Returns a new instance of Rest.



16
17
18
19
20
# File 'lib/leadtune/rest.rb', line 16

def initialize(config)
  @config = config
  @post_data = nil
  @response = {}
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



14
15
16
# File 'lib/leadtune/rest.rb', line 14

def response
  @response
end

Instance Method Details

#delete(post_data) ⇒ Object



43
44
45
46
47
48
# File 'lib/leadtune/rest.rb', line 43

def delete(post_data)
  @post_data = post_data
  curl = build_curl_easy_object_delete
  curl.http("DELETE")
  parse_response(curl.body_str) unless curl.body_str.empty?
end

#get(post_data) ⇒ Object



22
23
24
25
26
27
# File 'lib/leadtune/rest.rb', line 22

def get(post_data)
  @post_data = post_data
  curl = build_curl_easy_object_get
  curl.http("GET")
  parse_response(curl.body_str)
end

#post(post_data) ⇒ Object



29
30
31
32
33
34
# File 'lib/leadtune/rest.rb', line 29

def post(post_data)
  @post_data = post_data
  curl = build_curl_easy_object_post
  curl.http("POST")
  parse_response(curl.body_str)
end

#put(post_data) ⇒ Object



36
37
38
39
40
41
# File 'lib/leadtune/rest.rb', line 36

def put(post_data)
  @post_data = post_data
  curl = build_curl_easy_object_put
  curl.http("PUT")
  parse_response(curl.body_str)
end