Class: DellinInfo::API::Client
- Inherits:
-
BaseApi
- Object
- BaseApi
- DellinInfo::API::Client
- Defined in:
- lib/dellininfo/client.rb
Instance Method Summary collapse
-
#auth(options = {}) ⇒ Object
в проекте используется только публичные API, поэтому данный метод в годе больше не затронут, но оставлен для возможности расширить функционал.
- #request(op, params = {}) ⇒ Object
Instance Method Details
#auth(options = {}) ⇒ Object
в проекте используется только публичные API, поэтому данный метод в годе больше не затронут, но оставлен для возможности расширить функционал
10 11 12 13 14 15 16 |
# File 'lib/dellininfo/client.rb', line 10 def auth( = {}) response = HTTParty.post('https://api.dellin.ru/v1/customers/login.json', :body => {:login => [:username], :password => [:password], :appKey => @app_key}.to_json, :headers => {'Content-Type' => 'application/json'}) print response response['sessionID'] end |
#request(op, params = {}) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/dellininfo/client.rb', line 18 def request(op, params = {}) params[:appKey] = @app_key response = HTTParty.post("https://api.dellin.ru/v1/#{op}.json", :body => params.to_json, :headers => {'Content-Type' => 'application/json'}) response end |