Module: Airbnb::Service::Hongbao::Api::HongbaoCampaignDataResponseSmartclientModule::GenerateInstanceMethods
- Defined in:
- lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb
Constant Summary collapse
- JSON_NAME_OVERRIDES =
{ }.freeze
Instance Method Summary collapse
- #campaign_data ⇒ 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
#campaign_data ⇒ Object
1676 |
# File 'lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb', line 1676 def campaign_data; @campaignData; 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.
1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 |
# File 'lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb', line 1685 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 && campaign_data.nil?) _json_key_name = JSON_NAME_OVERRIDES.key?(:campaignData) ? JSON_NAME_OVERRIDES[:campaignData] : :campaignData res[_json_key_name] = campaign_data.nil? ? nil : campaign_data.to_hash() end else # enforcing to use snake case if !(ignore_nil_field && campaign_data.nil?) _json_key_name = JSON_NAME_OVERRIDES.key?(:campaignData) ? JSON_NAME_OVERRIDES[:campaignData] : :campaign_data res[_json_key_name] = campaign_data.nil? ? nil : campaign_data.to_hash() end end res end |
#to_json(options = nil) ⇒ Object
1678 1679 1680 |
# File 'lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb', line 1678 def to_json( = nil) JSON.generate(to_hash()) end |