Class: Line::Bot::V2::MessagingApi::Membership
- Inherits:
-
Object
- Object
- Line::Bot::V2::MessagingApi::Membership
- Defined in:
- lib/line/bot/v2/messaging_api/model/membership.rb
Instance Attribute Summary collapse
-
#benefits ⇒ Array[String]
List of membership plan perks.
-
#currency ⇒ String
(‘JPY’|‘TWD’|‘THB’) The currency of membership.price.
-
#description ⇒ String
Membership plan description.
-
#is_in_app_purchase ⇒ Boolean
Payment method for users who subscribe to a membership plan.
-
#is_published ⇒ Boolean
Membership plan status.
-
#member_count ⇒ Integer
Number of members subscribed to the membership plan.
-
#member_limit ⇒ Integer
The upper limit of members who can subscribe.
-
#membership_id ⇒ Integer
Membership plan ID.
-
#price ⇒ Float
Monthly fee for membership plan.
-
#title ⇒ String
Membership plan name.
Class Method Summary collapse
-
.create(args) ⇒ Line::Bot::V2::MessagingApi::Membership
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(membership_id:, title:, description:, benefits:, price:, currency:, member_count:, member_limit:, is_in_app_purchase:, is_published:, **dynamic_attributes) ⇒ Membership
constructor
A new instance of Membership.
Constructor Details
#initialize(membership_id:, title:, description:, benefits:, price:, currency:, member_count:, member_limit:, is_in_app_purchase:, is_published:, **dynamic_attributes) ⇒ Membership
Returns a new instance of Membership.
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/line/bot/v2/messaging_api/model/membership.rb', line 56 def initialize( membership_id:, title:, description:, benefits:, price:, currency:, member_count:, member_limit:, is_in_app_purchase:, is_published:, **dynamic_attributes ) @membership_id = membership_id @title = title @description = description @benefits = benefits @price = price @currency = currency @member_count = member_count @member_limit = member_limit @is_in_app_purchase = is_in_app_purchase @is_published = is_published 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
#benefits ⇒ Array[String]
Returns List of membership plan perks.
26 27 28 |
# File 'lib/line/bot/v2/messaging_api/model/membership.rb', line 26 def benefits @benefits end |
#currency ⇒ String
Returns (‘JPY’|‘TWD’|‘THB’) The currency of membership.price.
32 33 34 |
# File 'lib/line/bot/v2/messaging_api/model/membership.rb', line 32 def currency @currency end |
#description ⇒ String
Returns Membership plan description.
23 24 25 |
# File 'lib/line/bot/v2/messaging_api/model/membership.rb', line 23 def description @description end |
#is_in_app_purchase ⇒ Boolean
Returns Payment method for users who subscribe to a membership plan.
41 42 43 |
# File 'lib/line/bot/v2/messaging_api/model/membership.rb', line 41 def is_in_app_purchase @is_in_app_purchase end |
#is_published ⇒ Boolean
Returns Membership plan status.
44 45 46 |
# File 'lib/line/bot/v2/messaging_api/model/membership.rb', line 44 def is_published @is_published end |
#member_count ⇒ Integer
Returns Number of members subscribed to the membership plan.
35 36 37 |
# File 'lib/line/bot/v2/messaging_api/model/membership.rb', line 35 def member_count @member_count end |
#member_limit ⇒ Integer
Returns The upper limit of members who can subscribe. If no upper limit is set, it will be null.
38 39 40 |
# File 'lib/line/bot/v2/messaging_api/model/membership.rb', line 38 def member_limit @member_limit end |
#membership_id ⇒ Integer
Returns Membership plan ID.
17 18 19 |
# File 'lib/line/bot/v2/messaging_api/model/membership.rb', line 17 def membership_id @membership_id end |
#price ⇒ Float
Returns Monthly fee for membership plan. (e.g. 1500.00).
29 30 31 |
# File 'lib/line/bot/v2/messaging_api/model/membership.rb', line 29 def price @price end |
#title ⇒ String
Returns Membership plan name.
20 21 22 |
# File 'lib/line/bot/v2/messaging_api/model/membership.rb', line 20 def title @title end |
Class Method Details
.create(args) ⇒ Line::Bot::V2::MessagingApi::Membership
Create an instance of the class from a hash
97 98 99 100 |
# File 'lib/line/bot/v2/messaging_api/model/membership.rb', line 97 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.
104 105 106 107 108 109 110 |
# File 'lib/line/bot/v2/messaging_api/model/membership.rb', line 104 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.
113 114 115 |
# File 'lib/line/bot/v2/messaging_api/model/membership.rb', line 113 def hash [self.class, *instance_variables.map { |var| instance_variable_get(var) }].hash end |