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.



143
144
145
146
147
148
# File 'lib/typecast/models.rb', line 143

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_limitObject (readonly)

Returns the value of attribute concurrency_limit.



130
131
132
# File 'lib/typecast/models.rb', line 130

def concurrency_limit
  @concurrency_limit
end

#planObject (readonly)

Returns the value of attribute plan.



130
131
132
# File 'lib/typecast/models.rb', line 130

def plan
  @plan
end

#plan_creditsObject (readonly)

Returns the value of attribute plan_credits.



130
131
132
# File 'lib/typecast/models.rb', line 130

def plan_credits
  @plan_credits
end

#used_creditsObject (readonly)

Returns the value of attribute used_credits.



130
131
132
# File 'lib/typecast/models.rb', line 130

def used_credits
  @used_credits
end

Class Method Details

.from_h(hash) ⇒ Object



132
133
134
135
136
137
138
139
140
141
# File 'lib/typecast/models.rb', line 132

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