Class: Dropcam::Base

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

Direct Known Subclasses

Camera, Dropcam, Notification, Session, Setting

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cookiesObject

Returns the value of attribute cookies.



24
25
26
# File 'lib/dropcam/base.rb', line 24

def cookies
  @cookies
end

#session_tokenObject

Returns the value of attribute session_token.



24
25
26
# File 'lib/dropcam/base.rb', line 24

def session_token
  @session_token
end

Instance Method Details

#delete(path, parameters, cookies, use_nexus = false) ⇒ Object



94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/dropcam/base.rb', line 94

def delete(path, parameters,cookies, use_nexus=false)
  http = _dropcam_http(use_nexus)
        
  query_path = "#{path}"
  query_path = "#{path}?#{URI.encode_www_form(parameters)}" if parameters.length > 0
  request = Net::HTTP::Delete.new(query_path)      
  
  request.add_field("Cookie",cookies.join('; ')) if cookies
        
  response = http.request(request)
  return response
end

#get(path, parameters, cookies, use_nexus = false) ⇒ Object



81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/dropcam/base.rb', line 81

def get(path, parameters,cookies, use_nexus=false)
  http = _dropcam_http(use_nexus)
        
  query_path = "#{path}"
  query_path = "#{path}?#{URI.encode_www_form(parameters)}" if parameters.length > 0
  request = Net::HTTP::Get.new(query_path)      
  
  request.add_field("Cookie",cookies.join('; ')) if cookies
        
  response = http.request(request)
  return response
end

#post(path, parameters, cookies, use_nexus = false) ⇒ Object

videos.get # id = clip_id videos.download # id = clip_id videos.play # id = clip_idß



67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/dropcam/base.rb', line 67

def post(path, parameters, cookies, use_nexus=false)

  http = _dropcam_http(use_nexus)
  
  request = Net::HTTP::Post.new(path)
  request.set_form_data(parameters)
  
  request.add_field("Cookie",cookies.join('; ')) if cookies

  response = http.request(request)
  
  return response
end