Module: Airbnb::Service::Hongbao::Api::HongbaoCouponStateRequestSmartclientModule::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_name ⇒ 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
- #user_id ⇒ Object
Instance Method Details
#campaign_name ⇒ Object
669 |
# File 'lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb', line 669 def campaign_name; @campaignName; 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.
678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 |
# File 'lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb', line 678 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 && user_id.nil?) _json_key_name = JSON_NAME_OVERRIDES.key?(:userId) ? JSON_NAME_OVERRIDES[:userId] : :userId res[_json_key_name] = user_id end if !(ignore_nil_field && campaign_name.nil?) _json_key_name = JSON_NAME_OVERRIDES.key?(:campaignName) ? JSON_NAME_OVERRIDES[:campaignName] : :campaignName res[_json_key_name] = campaign_name end else # enforcing to use snake case if !(ignore_nil_field && user_id.nil?) _json_key_name = JSON_NAME_OVERRIDES.key?(:userId) ? JSON_NAME_OVERRIDES[:userId] : :user_id res[_json_key_name] = user_id end if !(ignore_nil_field && campaign_name.nil?) _json_key_name = JSON_NAME_OVERRIDES.key?(:campaignName) ? JSON_NAME_OVERRIDES[:campaignName] : :campaign_name res[_json_key_name] = campaign_name end end res end |
#to_json(options = nil) ⇒ Object
671 672 673 |
# File 'lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb', line 671 def to_json( = nil) JSON.generate(to_hash()) end |
#user_id ⇒ Object
668 |
# File 'lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb', line 668 def user_id; @userId; end |