Class: Streak::Box

Inherits:
StreakObject show all
Defined in:
lib/streak/box.rb

Class Method Summary collapse

Methods inherited from StreakObject

attributes, construct_from, convert_to_streak_object, #initialize, #method_missing, relations

Constructor Details

This class inherits a constructor from Streak::StreakObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Streak::StreakObject

Class Method Details

.all(pipeline_key = nil, params = {}) ⇒ Object



3
4
5
6
7
# File 'lib/streak/box.rb', line 3

def self.all(pipeline_key=nil, params={})
  path = pipeline_key ? "/pipelines/#{pipeline_key}/boxes" : "/boxes"
  res = Streak.request(:get, path, params)
  convert_to_streak_object(res, Box)
end

.create(pipeline_key, params = {}) ⇒ Object



14
15
16
17
# File 'lib/streak/box.rb', line 14

def self.create(pipeline_key, params={})
  res = Streak.request(:put, "/pipelines/#{pipeline_key}/boxes", params)
  convert_to_streak_object(res, Box)
end

.find(key) ⇒ Object



9
10
11
12
# File 'lib/streak/box.rb', line 9

def self.find(key)
  res = Streak.request(:get, "/boxes/#{key}")
  convert_to_streak_object(res, Box)
end

.update(key, params) ⇒ Object



19
20
21
22
# File 'lib/streak/box.rb', line 19

def self.update(key, params)
  res = Streak.request(:post, "/boxes/#{key}", MultiJson.dump(params))
  convert_to_streak_object(res, Box)
end