Class: Facturama::Services::HttpService
- Inherits:
-
Object
- Object
- Facturama::Services::HttpService
- Defined in:
- lib/facturama/services/http_service.rb
Direct Known Subclasses
Instance Method Summary collapse
- #delete(args = "") ⇒ Object
- #get(args = '') ⇒ Object
-
#initialize(connection_info, uri_resource) ⇒ HttpService
constructor
A new instance of HttpService.
- #post(message, args = "") ⇒ Object
- #put(message, args = "") ⇒ Object
Constructor Details
#initialize(connection_info, uri_resource) ⇒ HttpService
Returns a new instance of HttpService.
11 12 13 14 |
# File 'lib/facturama/services/http_service.rb', line 11 def initialize(connection_info, uri_resource ) @connection_info = connection_info @uri_resource = uri_resource end |
Instance Method Details
#delete(args = "") ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/facturama/services/http_service.rb', line 74 def delete(args = "") res=RestClient::Request.new( :method => :delete, :url => url(args), :user => @connection_info.facturama_user, :password => @connection_info.facturama_password , :headers => {:accept => :json, :content_type => :json } ) executor(res) end |
#get(args = '') ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/facturama/services/http_service.rb', line 18 def get(args='') res=RestClient::Request.new( :method => :get, :url => url(args), :user => @connection_info.facturama_user, :password => @connection_info.facturama_password , :headers => {:accept => :json, :content_type => :json, :user_agent => '', } ) executor(res) end |
#post(message, args = "") ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/facturama/services/http_service.rb', line 36 def post(, args = "") json =.to_json res= RestClient::Request.new( :method => :post, :url => url(args), :user => @connection_info.facturama_user, :password => @connection_info.facturama_password, :payload => json, :headers => { :content_type => :json } ) executor(res) end |
#put(message, args = "") ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/facturama/services/http_service.rb', line 55 def put(, args = "") json =.to_json res= RestClient::Request.new( :method => :put, :url => url(args), :user => @connection_info.facturama_user, :password => @connection_info.facturama_password , :payload => json, :headers => {:accept => :json, :content_type => :json} ) executor(res) end |