Module: Airbnb::Service::Hongbao::Api::HongbaoGetCouponMessagesResponseSmartclientModule::GenerateInstanceMethods
- Defined in:
- lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb
Constant Summary collapse
- JSON_NAME_OVERRIDES =
{ }.freeze
Instance Method Summary collapse
- #cta_link ⇒ Object
- #state ⇒ 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
#cta_link ⇒ Object
2275 |
# File 'lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb', line 2275 def cta_link; @ctaLink; end |
#state ⇒ Object
2274 |
# File 'lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb', line 2274 def state; @state; end |
#to_hash(options = nil) ⇒ Object Also known as: to_h
options:
case_from_idl: use the exact case from IDL file to when 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.
2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 |
# File 'lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb', line 2284 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 && state.nil?) _json_key_name = JSON_NAME_OVERRIDES.key?(:state) ? JSON_NAME_OVERRIDES[:state] : :state res[_json_key_name] = state end if !(ignore_nil_field && cta_link.nil?) _json_key_name = JSON_NAME_OVERRIDES.key?(:ctaLink) ? JSON_NAME_OVERRIDES[:ctaLink] : :ctaLink res[_json_key_name] = cta_link end else # enforcing to use snake case if !(ignore_nil_field && state.nil?) _json_key_name = JSON_NAME_OVERRIDES.key?(:state) ? JSON_NAME_OVERRIDES[:state] : :state res[_json_key_name] = state end if !(ignore_nil_field && cta_link.nil?) _json_key_name = JSON_NAME_OVERRIDES.key?(:ctaLink) ? JSON_NAME_OVERRIDES[:ctaLink] : :cta_link res[_json_key_name] = cta_link end end res end |
#to_json(options = nil) ⇒ Object
2277 2278 2279 |
# File 'lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb', line 2277 def to_json( = nil) JSON.generate(to_hash()) end |