Module: Airbnb::Service::Hongbao::Api::HelloResponseSmartclientModule::GenerateInstanceMethods
- Defined in:
- lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb
Constant Summary collapse
- JSON_NAME_OVERRIDES =
{ }.freeze
Instance Method Summary collapse
- #message ⇒ Object
-
#to_hash(options = nil) ⇒ Object
(also: #to_h)
options: case_from_idl: use the exact case from IDL file to when generating the hash key.
- #to_json(options = nil) ⇒ Object
Instance Method Details
#message ⇒ Object
153 |
# File 'lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb', line 153 def ; @message; end |
#to_hash(options = nil) ⇒ Object Also known as: to_h
options:
case_from_idl: use the exact case from IDL file to when generating the hash key. Default is false.
ignore_nil_field: do not generate key in the hash, if the value is nil. Useful for inspect or data transport. Default is false.
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 |
# File 'lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb', line 162 def to_hash( = nil) res = {} ||= {} case_from_idl = .nil? ? false : [:case_from_idl] ignore_nil_field = .nil? ? false : [:ignore_nil_field] if case_from_idl if !(ignore_nil_field && .nil?) _json_key_name = JSON_NAME_OVERRIDES.key?(:message) ? JSON_NAME_OVERRIDES[:message] : :message res[_json_key_name] = end else # enforcing to use snake case if !(ignore_nil_field && .nil?) _json_key_name = JSON_NAME_OVERRIDES.key?(:message) ? JSON_NAME_OVERRIDES[:message] : :message res[_json_key_name] = end end res end |
#to_json(options = nil) ⇒ Object
155 156 157 |
# File 'lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb', line 155 def to_json( = nil) JSON.generate(to_hash()) end |