Class: Typedeploy::Kit
- Inherits:
-
Object
- Object
- Typedeploy::Kit
- Defined in:
- lib/typedeploy/kit.rb
Defined Under Namespace
Classes: Family
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#kid ⇒ Object
Returns the value of attribute kid.
Instance Method Summary collapse
- #create ⇒ Object
- #families ⇒ Object
-
#initialize(id, data) ⇒ Kit
constructor
A new instance of Kit.
- #publish ⇒ Object
- #to_params ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(id, data) ⇒ Kit
Returns a new instance of Kit.
6 7 8 9 10 |
# File 'lib/typedeploy/kit.rb', line 6 def initialize(id, data) @kid = id @data = data @api = Api.new end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
3 4 5 |
# File 'lib/typedeploy/kit.rb', line 3 def data @data end |
#kid ⇒ Object
Returns the value of attribute kid.
4 5 6 |
# File 'lib/typedeploy/kit.rb', line 4 def kid @kid end |
Instance Method Details
#create ⇒ Object
16 17 18 |
# File 'lib/typedeploy/kit.rb', line 16 def create @api.create(self) end |
#families ⇒ Object
39 40 41 |
# File 'lib/typedeploy/kit.rb', line 39 def families @data['families'].map { |f| Family.new(f) } end |
#publish ⇒ Object
12 13 14 |
# File 'lib/typedeploy/kit.rb', line 12 def publish @api.publish(@kid) end |
#to_params ⇒ Object
43 44 45 46 47 48 49 50 51 |
# File 'lib/typedeploy/kit.rb', line 43 def to_params params = {'domains' => @data['domains'].join(",")} ['name', 'badge', 'analytics'].each do |attr| params[attr] = @data[attr] end params end |
#to_s ⇒ Object
53 54 55 |
# File 'lib/typedeploy/kit.rb', line 53 def to_s "<Kit #{@data['name']}:#{to_params.inspect}>" end |