Class: Typecast::Models::SubscriptionResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/typecast/models.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(plan:, plan_credits:, used_credits:, concurrency_limit:) ⇒ SubscriptionResponse

Returns a new instance of SubscriptionResponse.



160
161
162
163
164
165
# File 'lib/typecast/models.rb', line 160

def initialize(plan:, plan_credits:, used_credits:, concurrency_limit:)
  @plan = plan
  @plan_credits = plan_credits
  @used_credits = used_credits
  @concurrency_limit = concurrency_limit
end

Instance Attribute Details

#concurrency_limit ⇒ Object (readonly)

Returns the value of attribute concurrency_limit.



147
148
149
# File 'lib/typecast/models.rb', line 147

def concurrency_limit
  @concurrency_limit
end

#plan ⇒ Object (readonly)

Returns the value of attribute plan.



147
148
149
# File 'lib/typecast/models.rb', line 147

def plan
  @plan
end

#plan_credits ⇒ Object (readonly)

Returns the value of attribute plan_credits.



147
148
149
# File 'lib/typecast/models.rb', line 147

def plan_credits
  @plan_credits
end

#used_credits ⇒ Object (readonly)

Returns the value of attribute used_credits.



147
148
149
# File 'lib/typecast/models.rb', line 147

def used_credits
  @used_credits
end

Class Method Details

.from_h(hash) ⇒ Object



149
150
151
152
153
154
155
156
157
158
# File 'lib/typecast/models.rb', line 149

def self.from_h(hash)
  credits = hash.fetch("credits", {})
  limits = hash.fetch("limits", {})
  new(
    plan: hash.fetch("plan", ""),
    plan_credits: credits.fetch("plan_credits", 0),
    used_credits: credits.fetch("used_credits", 0),
    concurrency_limit: limits.fetch("concurrency_limit", 0)
  )
end