Class: Asdawqw::Authorization
- Defined in:
- lib/asdawqw/models/authorization.rb
Overview
Authorization (Login) response
Instance Attribute Summary collapse
-
#code ⇒ String
Response code.
-
#currency ⇒ String
Account currency.
-
#error_message ⇒ List of String
Error Message(s) in Array format.
-
#is_error ⇒ Boolean
Is request success or not.
-
#message ⇒ String
Message.
-
#name ⇒ String
Account name.
-
#organization_id ⇒ Integer
Organization id - PMS ID.
-
#party_id ⇒ Integer
Deprecated field.
-
#supplier_id ⇒ Integer
Supplier ID (Property Manager ID - or PMS ID - depend on account on which you are logged in).
-
#token ⇒ String
Generated token for authorization.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
Instance Method Summary collapse
-
#initialize(token = nil, message = nil, is_error = nil, error_message = nil, organization_id = nil, supplier_id = nil, party_id = nil, name = nil, currency = nil, code = nil) ⇒ Authorization
constructor
A new instance of Authorization.
Methods inherited from BaseModel
Constructor Details
#initialize(token = nil, message = nil, is_error = nil, error_message = nil, organization_id = nil, supplier_id = nil, party_id = nil, name = nil, currency = nil, code = nil) ⇒ Authorization
Returns a new instance of Authorization.
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/asdawqw/models/authorization.rb', line 68 def initialize(token = nil, = nil, is_error = nil, = nil, organization_id = nil, supplier_id = nil, party_id = nil, name = nil, currency = nil, code = nil) @token = token @message = @is_error = is_error @error_message = @code = code @organization_id = organization_id @supplier_id = supplier_id @party_id = party_id @name = name @currency = currency end |
Instance Attribute Details
#code ⇒ String
Response code
28 29 30 |
# File 'lib/asdawqw/models/authorization.rb', line 28 def code @code end |
#currency ⇒ String
Account currency
50 51 52 |
# File 'lib/asdawqw/models/authorization.rb', line 50 def currency @currency end |
#error_message ⇒ List of String
Error Message(s) in Array format
24 25 26 |
# File 'lib/asdawqw/models/authorization.rb', line 24 def @error_message end |
#is_error ⇒ Boolean
Is request success or not
20 21 22 |
# File 'lib/asdawqw/models/authorization.rb', line 20 def is_error @is_error end |
#message ⇒ String
Message
16 17 18 |
# File 'lib/asdawqw/models/authorization.rb', line 16 def @message end |
#name ⇒ String
Account name
46 47 48 |
# File 'lib/asdawqw/models/authorization.rb', line 46 def name @name end |
#organization_id ⇒ Integer
Organization id - PMS ID
32 33 34 |
# File 'lib/asdawqw/models/authorization.rb', line 32 def organization_id @organization_id end |
#party_id ⇒ Integer
Deprecated field. It will be removed in version 3.3. Please use supplierId field instead
42 43 44 |
# File 'lib/asdawqw/models/authorization.rb', line 42 def party_id @party_id end |
#supplier_id ⇒ Integer
Supplier ID (Property Manager ID - or PMS ID - depend on account on which you are logged in)
37 38 39 |
# File 'lib/asdawqw/models/authorization.rb', line 37 def supplier_id @supplier_id end |
#token ⇒ String
Generated token for authorization. It must be used in every request to API as param jwt. Token is valid for 1h
12 13 14 |
# File 'lib/asdawqw/models/authorization.rb', line 12 def token @token end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/asdawqw/models/authorization.rb', line 91 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. token = hash['token'] = hash['message'] is_error = hash['is_error'] = hash['errorMessage'] organization_id = hash['organizationId'] supplier_id = hash['supplierId'] party_id = hash['partyId'] name = hash['name'] currency = hash['currency'] code = hash['code'] # Create object from extracted values. Authorization.new(token, , is_error, , organization_id, supplier_id, party_id, name, currency, code) end |
.names ⇒ Object
A mapping from model property names to API property names.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/asdawqw/models/authorization.rb', line 53 def self.names @_hash = {} if @_hash.nil? @_hash['token'] = 'token' @_hash['message'] = 'message' @_hash['is_error'] = 'is_error' @_hash['error_message'] = 'errorMessage' @_hash['code'] = 'code' @_hash['organization_id'] = 'organizationId' @_hash['supplier_id'] = 'supplierId' @_hash['party_id'] = 'partyId' @_hash['name'] = 'name' @_hash['currency'] = 'currency' @_hash end |