Class: Sently::Sender
- Inherits:
-
Object
- Object
- Sently::Sender
- Defined in:
- lib/sently/sender.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#http_open_timeout ⇒ Object
readonly
Returns the value of attribute http_open_timeout.
-
#http_read_timeout ⇒ Object
readonly
Returns the value of attribute http_read_timeout.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#protocol ⇒ Object
readonly
Returns the value of attribute protocol.
-
#secure ⇒ Object
readonly
Returns the value of attribute secure.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
-
#get(uri, additional_headers = {}) ⇒ Object
response = http.post(data) end.
-
#initialize(options = {}) ⇒ Sender
constructor
A new instance of Sender.
Constructor Details
#initialize(options = {}) ⇒ Sender
Returns a new instance of Sender.
5 6 7 8 9 |
# File 'lib/sently/sender.rb', line 5 def initialize( = {}) [:protocol, :host, :port, :secure, :http_open_timeout, :http_read_timeout, :username, :password].each do |option| instance_variable_set("@#{option}", [option]) end end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
3 4 5 |
# File 'lib/sently/sender.rb', line 3 def host @host end |
#http_open_timeout ⇒ Object (readonly)
Returns the value of attribute http_open_timeout.
3 4 5 |
# File 'lib/sently/sender.rb', line 3 def http_open_timeout @http_open_timeout end |
#http_read_timeout ⇒ Object (readonly)
Returns the value of attribute http_read_timeout.
3 4 5 |
# File 'lib/sently/sender.rb', line 3 def http_read_timeout @http_read_timeout end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
3 4 5 |
# File 'lib/sently/sender.rb', line 3 def password @password end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
3 4 5 |
# File 'lib/sently/sender.rb', line 3 def port @port end |
#protocol ⇒ Object (readonly)
Returns the value of attribute protocol.
3 4 5 |
# File 'lib/sently/sender.rb', line 3 def protocol @protocol end |
#secure ⇒ Object (readonly)
Returns the value of attribute secure.
3 4 5 |
# File 'lib/sently/sender.rb', line 3 def secure @secure end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
3 4 5 |
# File 'lib/sently/sender.rb', line 3 def username @username end |
Instance Method Details
#get(uri, additional_headers = {}) ⇒ Object
response = http.post(data) end
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/sently/sender.rb', line 22 def get(uri, additional_headers = {}) http = RestClient::Resource.new( url(uri), :timeout => http_read_timeout, :open_timeout => http_open_timeout ) headers = { :username => username, :password => password } p = { :params => headers.merge(additional_headers) } response = http.get p end |