Class: Streak::Field

Inherits:
StreakObject show all
Defined in:
lib/streak/field.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) ⇒ Object



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

def self.all(pipeline_key)
  res = Streak.request(:get, "/pipelines/#{pipeline_key}/fields")
  convert_to_streak_object(res, Field)
end

.create(pipeline_key, params) ⇒ Object



13
14
15
16
# File 'lib/streak/field.rb', line 13

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

.find(pipeline_key, field_key) ⇒ Object



8
9
10
11
# File 'lib/streak/field.rb', line 8

def self.find(pipeline_key, field_key)
  res = Streak.request(:get, "/pipelines/#{pipeline_key}/fields/#{field_key}")
  convert_to_streak_object(res, Field)
end

.update(pipeline_key, field_key, params = {}) ⇒ Object



18
19
20
21
# File 'lib/streak/field.rb', line 18

def self.update(pipeline_key, field_key, params={})
  res = Streak.request(:post, "/pipelines/#{pipeline_key}/fields/#{field_key}", MultiJson.dump(params))
  convert_to_streak_object(res, Field)
end