Class: Weeblycloud::Plan

Inherits:
CloudResource show all
Defined in:
lib/weeblycloud/plan.rb

Instance Attribute Summary

Attributes inherited from CloudResource

#properties

Instance Method Summary collapse

Methods inherited from CloudResource

#[], #get_property, #to_s

Constructor Details

#initialize(plan_id, data = nil) ⇒ Plan

Returns a new instance of Plan.



7
8
9
10
11
# File 'lib/weeblycloud/plan.rb', line 7

def initialize(plan_id, data = nil)
  @plan_id = plan_id.to_i
  @endpoint = "plan/#{@plan_id}"
  super(data)
end

Instance Method Details

#getObject

Makes an API call to get the resource



14
15
16
17
18
# File 'lib/weeblycloud/plan.rb', line 14

def get
  response = @client.get(@endpoint)
  plan = response.json["plans"]
  @properties = plan[plan.keys.first]
end

#idObject

Returns the plan_id



21
22
23
# File 'lib/weeblycloud/plan.rb', line 21

def id
  @plan_id
end