Class: ModulePos::Fiscalization::Client
- Inherits:
-
Object
- Object
- ModulePos::Fiscalization::Client
- Defined in:
- lib/module_pos/fiscalization/client.rb
Overview
Http client for Module POS api
Defined Under Namespace
Modules: Scopes
Constant Summary collapse
- ASSOCIATE_PATH =
"api/fn/v1/associate"
- STATUS_PATH =
"api/fn/v1/status"
- CREATE_DOC_PATH =
"/api/fn/v2/doc"
- DOC_PATH =
"/api/fn/v1/doc"
Instance Method Summary collapse
-
#associate(uid) ⇒ ModulePos::V1::Client::Scopes::Associate
Return associate scope, for actions to associate recourse.
-
#docs ⇒ ModulePos::V1::Client::Scopes::Docs
Return associate scope, for actions to doc.
-
#status ⇒ Hash
Request POS status, return { status: “READY|ASSOCIATED|FAILED”, date_time: <DateTime> }.
Instance Method Details
#associate(uid) ⇒ ModulePos::V1::Client::Scopes::Associate
Return associate scope, for actions to associate recourse
90 91 92 |
# File 'lib/module_pos/fiscalization/client.rb', line 90 def associate(uid) Scopes::Associate.new("#{ASSOCIATE_PATH}/#{uid}", http) end |
#docs ⇒ ModulePos::V1::Client::Scopes::Docs
Return associate scope, for actions to doc
96 97 98 |
# File 'lib/module_pos/fiscalization/client.rb', line 96 def docs Scopes::Docs.new(DOC_PATH, http, username: username, pass: pass) end |
#status ⇒ Hash
Request POS status, return
{ status: "READY|ASSOCIATED|FAILED", date_time: <DateTime> }
103 104 105 106 |
# File 'lib/module_pos/fiscalization/client.rb', line 103 def status res = http.call(username, pass) { |conn| conn.get(STATUS_PATH) } ModulePos::Fiscalization::Entities::PosStatus.new(res) end |