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
Returns a new instance of 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 @barcode_image_url = @coupon_code = coupon_code @description = description @end_timestamp = @image_url = image_url @max_use_count_per_ticket = max_use_count_per_ticket @start_timestamp = @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?
Returns URL of the barcode image associated with the coupon. Used for in-store redemption.
21 22 23 |
# File 'lib/line/bot/v2/messaging_api/model/coupon_create_request.rb', line 21 def @barcode_image_url end |
#coupon_code ⇒ String?
Returns Unique code to be presented by the user to redeem the coupon. Optional.
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?
Returns Detailed description of the coupon. Displayed to users.
27 28 29 |
# File 'lib/line/bot/v2/messaging_api/model/coupon_create_request.rb', line 27 def description @description end |
#end_timestamp ⇒ Integer
Returns Coupon expiration time (epoch seconds). Coupon cannot be used after this time.
30 31 32 |
# File 'lib/line/bot/v2/messaging_api/model/coupon_create_request.rb', line 30 def @end_timestamp end |
#image_url ⇒ String?
Returns URL of the main image representing the coupon. Displayed in the coupon list.
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
Returns Maximum number of times a single coupon ticket can be used. Use -1 to indicate no limit.
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
Returns Coupon start time (epoch seconds). Coupon can be used from this time.
39 40 41 |
# File 'lib/line/bot/v2/messaging_api/model/coupon_create_request.rb', line 39 def @start_timestamp end |
#timezone ⇒ String
Returns (‘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.
54 55 56 |
# File 'lib/line/bot/v2/messaging_api/model/coupon_create_request.rb', line 54 def timezone @timezone end |
#title ⇒ String
Returns Title of the coupon. Displayed in the coupon list.
42 43 44 |
# File 'lib/line/bot/v2/messaging_api/model/coupon_create_request.rb', line 42 def title @title end |
#usage_condition ⇒ String?
Returns Conditions for using the coupon. Shown to users.
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
Returns (‘UNLISTED’|‘PUBLIC’) Visibility of the coupon. Determines who can see or acquire the coupon.
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
Returns true if the objects are equal, false otherwise.
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
Returns Hash code of the object.
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 |