Class: Line::Bot::V2::MessagingApi::CouponCreateRequest
- Inherits:
-
Object
- Object
- Line::Bot::V2::MessagingApi::CouponCreateRequest
- Defined in:
- lib/line/bot/v2/messaging_api/model/coupon_create_request.rb
Overview
Request object for creating a coupon. Contains all configurable coupon properties.
Instance Attribute Summary collapse
- #acquisition_condition ⇒ AcquisitionConditionRequest
-
#barcode_image_url ⇒ String?
URL of the barcode image associated with the coupon.
-
#coupon_code ⇒ String?
Unique code to be presented by the user to redeem the coupon.
-
#description ⇒ String?
Detailed description of the coupon.
-
#end_timestamp ⇒ Integer
Coupon expiration time (epoch seconds).
-
#image_url ⇒ String?
URL of the main image representing the coupon.
-
#max_use_count_per_ticket ⇒ Integer
Maximum number of times a single coupon ticket can be used.
- #reward ⇒ CouponRewardRequest?
-
#start_timestamp ⇒ Integer
Coupon start time (epoch seconds).
-
#timezone ⇒ String
(‘ETC_GMT_MINUS_12’|‘ETC_GMT_MINUS_11’|‘PACIFIC_HONOLULU’|‘AMERICA_ANCHORAGE’|‘AMERICA_LOS_ANGELES’|‘AMERICA_PHOENIX’|‘AMERICA_CHICAGO’|‘AMERICA_NEW_YORK’|‘AMERICA_CARACAS’|‘AMERICA_SANTIAGO’|‘AMERICA_ST_JOHNS’|‘AMERICA_SAO_PAULO’|‘ETC_GMT_MINUS_2’|‘ATLANTIC_CAPE_VERDE’|‘EUROPE_LONDON’|‘EUROPE_PARIS’|‘EUROPE_ISTANBUL’|‘EUROPE_MOSCOW’|‘ASIA_TEHRAN’|‘ASIA_TBILISI’|‘ASIA_KABUL’|‘ASIA_TASHKENT’|‘ASIA_COLOMBO’|‘ASIA_KATHMANDU’|‘ASIA_ALMATY’|‘ASIA_RANGOON’|‘ASIA_BANGKOK’|‘ASIA_TAIPEI’|‘ASIA_TOKYO’|‘AUSTRALIA_DARWIN’|‘AUSTRALIA_SYDNEY’|‘ASIA_VLADIVOSTOK’|‘ETC_GMT_PLUS_12’|‘PACIFIC_TONGATAPU’) Timezone for interpreting start and end timestamps.
-
#title ⇒ String
Title of the coupon.
-
#usage_condition ⇒ String?
Conditions for using the coupon.
-
#visibility ⇒ String
(‘UNLISTED’|‘PUBLIC’) Visibility of the coupon.
Class Method Summary collapse
-
.create(args) ⇒ Line::Bot::V2::MessagingApi::CouponCreateRequest
Create an instance of the class from a hash.
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
True if the objects are equal, false otherwise.
-
#hash ⇒ Integer
Hash code of the object.
-
#initialize(acquisition_condition:, barcode_image_url: nil, coupon_code: nil, description: nil, end_timestamp:, image_url: nil, max_use_count_per_ticket:, start_timestamp:, title:, usage_condition: nil, reward: nil, visibility:, timezone:, **dynamic_attributes) ⇒ CouponCreateRequest
constructor
A new instance of CouponCreateRequest.
Constructor Details
#initialize(acquisition_condition:, barcode_image_url: nil, coupon_code: nil, description: nil, end_timestamp:, image_url: nil, max_use_count_per_ticket:, start_timestamp:, title:, usage_condition: nil, reward: nil, visibility:, timezone:, **dynamic_attributes) ⇒ CouponCreateRequest
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/line/bot/v2/messaging_api/model/coupon_create_request.rb', line 69 def initialize( acquisition_condition:, barcode_image_url: nil, coupon_code: nil, description: nil, end_timestamp:, image_url: nil, max_use_count_per_ticket:, start_timestamp:, title:, usage_condition: nil, reward: nil, visibility:, timezone:, **dynamic_attributes ) @acquisition_condition = acquisition_condition.is_a?(Line::Bot::V2::MessagingApi::AcquisitionConditionRequest) ? acquisition_condition : Line::Bot::V2::MessagingApi::AcquisitionConditionRequest.create(**acquisition_condition) # steep:ignore = @coupon_code = coupon_code @description = description = @image_url = image_url @max_use_count_per_ticket = max_use_count_per_ticket = @title = title @usage_condition = usage_condition @reward = reward.is_a?(Line::Bot::V2::MessagingApi::CouponRewardRequest) || reward.nil? ? reward : Line::Bot::V2::MessagingApi::CouponRewardRequest.create(**reward) # steep:ignore @visibility = visibility @timezone = timezone dynamic_attributes.each do |key, value| self.class.attr_accessor key if value.is_a?(Hash) struct_klass = Struct.new(*value.keys.map(&:to_sym)) struct_values = value.map { |_k, v| v.is_a?(Hash) ? Line::Bot::V2::Utils.hash_to_struct(v) : v } instance_variable_set("@#{key}", struct_klass.new(*struct_values)) else instance_variable_set("@#{key}", value) end end end |
Instance Attribute Details
#acquisition_condition ⇒ AcquisitionConditionRequest
18 19 20 |
# File 'lib/line/bot/v2/messaging_api/model/coupon_create_request.rb', line 18 def acquisition_condition @acquisition_condition end |
#barcode_image_url ⇒ String?
21 22 23 |
# File 'lib/line/bot/v2/messaging_api/model/coupon_create_request.rb', line 21 def end |
#coupon_code ⇒ String?
24 25 26 |
# File 'lib/line/bot/v2/messaging_api/model/coupon_create_request.rb', line 24 def coupon_code @coupon_code end |
#description ⇒ String?
27 28 29 |
# File 'lib/line/bot/v2/messaging_api/model/coupon_create_request.rb', line 27 def description @description end |
#end_timestamp ⇒ Integer
30 31 32 |
# File 'lib/line/bot/v2/messaging_api/model/coupon_create_request.rb', line 30 def end |
#image_url ⇒ String?
33 34 35 |
# File 'lib/line/bot/v2/messaging_api/model/coupon_create_request.rb', line 33 def image_url @image_url end |
#max_use_count_per_ticket ⇒ Integer
36 37 38 |
# File 'lib/line/bot/v2/messaging_api/model/coupon_create_request.rb', line 36 def max_use_count_per_ticket @max_use_count_per_ticket end |
#reward ⇒ CouponRewardRequest?
48 49 50 |
# File 'lib/line/bot/v2/messaging_api/model/coupon_create_request.rb', line 48 def reward @reward end |
#start_timestamp ⇒ Integer
39 40 41 |
# File 'lib/line/bot/v2/messaging_api/model/coupon_create_request.rb', line 39 def end |
#timezone ⇒ String
54 55 56 |
# File 'lib/line/bot/v2/messaging_api/model/coupon_create_request.rb', line 54 def timezone @timezone end |
#title ⇒ String
42 43 44 |
# File 'lib/line/bot/v2/messaging_api/model/coupon_create_request.rb', line 42 def title @title end |
#usage_condition ⇒ String?
45 46 47 |
# File 'lib/line/bot/v2/messaging_api/model/coupon_create_request.rb', line 45 def usage_condition @usage_condition end |
#visibility ⇒ String
51 52 53 |
# File 'lib/line/bot/v2/messaging_api/model/coupon_create_request.rb', line 51 def visibility @visibility end |
Class Method Details
.create(args) ⇒ Line::Bot::V2::MessagingApi::CouponCreateRequest
Create an instance of the class from a hash
116 117 118 119 |
# File 'lib/line/bot/v2/messaging_api/model/coupon_create_request.rb', line 116 def self.create(args) # steep:ignore symbolized_args = Line::Bot::V2::Utils.deep_symbolize(args) return new(**symbolized_args) # steep:ignore end |
Instance Method Details
#==(other) ⇒ Boolean
123 124 125 126 127 128 129 |
# File 'lib/line/bot/v2/messaging_api/model/coupon_create_request.rb', line 123 def ==(other) return false unless self.class == other.class instance_variables.all? do |var| instance_variable_get(var) == other.instance_variable_get(var) end end |
#hash ⇒ Integer
132 133 134 |
# File 'lib/line/bot/v2/messaging_api/model/coupon_create_request.rb', line 132 def hash [self.class, *instance_variables.map { |var| instance_variable_get(var) }].hash end |