Class: Dish::Shot

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/dish/shot.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id) ⇒ Shot

Returns a new instance of Shot.



8
9
10
# File 'lib/dish/shot.rb', line 8

def initialize(id)
  self.id = id
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



16
17
18
# File 'lib/dish/shot.rb', line 16

def method_missing(name, *args, &block)
  profile.has_key?(id.to_s) ? profile[id.to_s] : super
end

Instance Attribute Details

#idObject

Returns the value of attribute id.



4
5
6
# File 'lib/dish/shot.rb', line 4

def id
  @id
end

Instance Method Details

#profile(force = false) ⇒ Object



12
13
14
# File 'lib/dish/shot.rb', line 12

def profile(force = false)
  force ? @profile = get_profile : @profile ||= get_profile
end