Class: Line::Bot::V2::MessagingApi::CouponResponse
- Inherits:
-
Object
- Object
- Line::Bot::V2::MessagingApi::CouponResponse
- Defined in:
- lib/line/bot/v2/messaging_api/model/coupon_response.rb
Overview
Detailed information about a coupon, including all properties and current status.
Instance Attribute Summary collapse
- #acquisition_condition ⇒ AcquisitionConditionResponse?
-
#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.
-
#coupon_id ⇒ String?
Unique identifier of the coupon.
-
#created_timestamp ⇒ Integer?
Created timestamp (seconds) of 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_acquire_count ⇒ Integer?
Maximum number of coupons that can be issued in total.
-
#max_ticket_per_user ⇒ Integer?
Maximum number of coupon tickets a single user can acquire.
-
#max_use_count_per_ticket ⇒ Integer?
Maximum number of times a single coupon ticket can be used.
- #reward ⇒ CouponRewardResponse?
-
#start_timestamp ⇒ Integer?
Coupon start time (epoch seconds).
-
#status ⇒ String?
(‘DRAFT’|‘RUNNING’|‘CLOSED’) Current status of the coupon.
-
#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’|‘PRIVATE’) Visibility of the coupon.
Class Method Summary collapse
-
.create(args) ⇒ Line::Bot::V2::MessagingApi::CouponResponse
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: nil, barcode_image_url: nil, coupon_code: nil, description: nil, end_timestamp: nil, image_url: nil, max_acquire_count: nil, max_use_count_per_ticket: nil, max_ticket_per_user: nil, start_timestamp: nil, title: nil, usage_condition: nil, reward: nil, visibility: nil, timezone: nil, coupon_id: nil, created_timestamp: nil, status: nil, **dynamic_attributes) ⇒ CouponResponse
constructor
A new instance of CouponResponse.
Constructor Details
#initialize(acquisition_condition: nil, barcode_image_url: nil, coupon_code: nil, description: nil, end_timestamp: nil, image_url: nil, max_acquire_count: nil, max_use_count_per_ticket: nil, max_ticket_per_user: nil, start_timestamp: nil, title: nil, usage_condition: nil, reward: nil, visibility: nil, timezone: nil, coupon_id: nil, created_timestamp: nil, status: nil, **dynamic_attributes) ⇒ CouponResponse
Returns a new instance of CouponResponse.
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/line/bot/v2/messaging_api/model/coupon_response.rb', line 89 def initialize( acquisition_condition: nil, barcode_image_url: nil, coupon_code: nil, description: nil, end_timestamp: nil, image_url: nil, max_acquire_count: nil, max_use_count_per_ticket: nil, max_ticket_per_user: nil, start_timestamp: nil, title: nil, usage_condition: nil, reward: nil, visibility: nil, timezone: nil, coupon_id: nil, created_timestamp: nil, status: nil, **dynamic_attributes ) @acquisition_condition = acquisition_condition.is_a?(Line::Bot::V2::MessagingApi::AcquisitionConditionResponse) || acquisition_condition.nil? ? acquisition_condition : Line::Bot::V2::MessagingApi::AcquisitionConditionResponse.create(**acquisition_condition) # steep:ignore @barcode_image_url = @coupon_code = coupon_code @description = description @end_timestamp = @image_url = image_url @max_acquire_count = max_acquire_count @max_use_count_per_ticket = max_use_count_per_ticket @max_ticket_per_user = max_ticket_per_user @start_timestamp = @title = title @usage_condition = usage_condition @reward = reward.is_a?(Line::Bot::V2::MessagingApi::CouponRewardResponse) || reward.nil? ? reward : Line::Bot::V2::MessagingApi::CouponRewardResponse.create(**reward) # steep:ignore @visibility = visibility @timezone = timezone @coupon_id = coupon_id @created_timestamp = @status = status 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 ⇒ AcquisitionConditionResponse?
18 19 20 |
# File 'lib/line/bot/v2/messaging_api/model/coupon_response.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_response.rb', line 21 def @barcode_image_url end |
#coupon_code ⇒ String?
Returns Unique code to be presented by the user to redeem the coupon.
24 25 26 |
# File 'lib/line/bot/v2/messaging_api/model/coupon_response.rb', line 24 def coupon_code @coupon_code end |
#coupon_id ⇒ String?
Returns Unique identifier of the coupon.
63 64 65 |
# File 'lib/line/bot/v2/messaging_api/model/coupon_response.rb', line 63 def coupon_id @coupon_id end |
#created_timestamp ⇒ Integer?
Returns Created timestamp (seconds) of the coupon.
66 67 68 |
# File 'lib/line/bot/v2/messaging_api/model/coupon_response.rb', line 66 def @created_timestamp end |
#description ⇒ String?
Returns Detailed description of the coupon. Displayed to users.
27 28 29 |
# File 'lib/line/bot/v2/messaging_api/model/coupon_response.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_response.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_response.rb', line 33 def image_url @image_url end |
#max_acquire_count ⇒ Integer?
Returns Maximum number of coupons that can be issued in total.
36 37 38 |
# File 'lib/line/bot/v2/messaging_api/model/coupon_response.rb', line 36 def max_acquire_count @max_acquire_count end |
#max_ticket_per_user ⇒ Integer?
Returns Maximum number of coupon tickets a single user can acquire.
42 43 44 |
# File 'lib/line/bot/v2/messaging_api/model/coupon_response.rb', line 42 def max_ticket_per_user @max_ticket_per_user end |
#max_use_count_per_ticket ⇒ Integer?
Returns Maximum number of times a single coupon ticket can be used.
39 40 41 |
# File 'lib/line/bot/v2/messaging_api/model/coupon_response.rb', line 39 def max_use_count_per_ticket @max_use_count_per_ticket end |
#reward ⇒ CouponRewardResponse?
54 55 56 |
# File 'lib/line/bot/v2/messaging_api/model/coupon_response.rb', line 54 def reward @reward end |
#start_timestamp ⇒ Integer?
Returns Coupon start time (epoch seconds). Coupon can be used from this time.
45 46 47 |
# File 'lib/line/bot/v2/messaging_api/model/coupon_response.rb', line 45 def @start_timestamp end |
#status ⇒ String?
Returns (‘DRAFT’|‘RUNNING’|‘CLOSED’) Current status of the coupon.
69 70 71 |
# File 'lib/line/bot/v2/messaging_api/model/coupon_response.rb', line 69 def status @status 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.
60 61 62 |
# File 'lib/line/bot/v2/messaging_api/model/coupon_response.rb', line 60 def timezone @timezone end |
#title ⇒ String?
Returns Title of the coupon. Displayed in the coupon list.
48 49 50 |
# File 'lib/line/bot/v2/messaging_api/model/coupon_response.rb', line 48 def title @title end |
#usage_condition ⇒ String?
Returns Conditions for using the coupon. Shown to users.
51 52 53 |
# File 'lib/line/bot/v2/messaging_api/model/coupon_response.rb', line 51 def usage_condition @usage_condition end |
#visibility ⇒ String?
Returns (‘UNLISTED’|‘PUBLIC’|‘PRIVATE’) Visibility of the coupon. Determines who can see or acquire the coupon.
57 58 59 |
# File 'lib/line/bot/v2/messaging_api/model/coupon_response.rb', line 57 def visibility @visibility end |
Class Method Details
.create(args) ⇒ Line::Bot::V2::MessagingApi::CouponResponse
Create an instance of the class from a hash
146 147 148 149 |
# File 'lib/line/bot/v2/messaging_api/model/coupon_response.rb', line 146 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.
153 154 155 156 157 158 159 |
# File 'lib/line/bot/v2/messaging_api/model/coupon_response.rb', line 153 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.
162 163 164 |
# File 'lib/line/bot/v2/messaging_api/model/coupon_response.rb', line 162 def hash [self.class, *instance_variables.map { |var| instance_variable_get(var) }].hash end |