Class: ScriptedClient::Pitch

Inherits:
Resource
  • Object
show all
Defined in:
lib/scripted_client/pitch.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

define_filter_methods, site

Class Method Details

.find(*arguments) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/scripted_client/pitch.rb', line 3

def self.find(*arguments)
  if arguments.first.kind_of?(String)
    options = arguments[1]
    unless options.kind_of?(Hash) &&
      options[:params].kind_of?(Hash) &&
      options[:params].key?(:pitchset_id)
      fail "You must pass both a pitchset_id and an id to #{ name }#find. For example: \n
        #{ name }.find('#{ arguments.first }', params: { pitchset_id: 'abc123' }) \n\n\n"
    end
  end
  super
end

.setup_prefixObject



16
17
18
# File 'lib/scripted_client/pitch.rb', line 16

def self.setup_prefix
  self.prefix = "#{ prefix }pitchsets/:pitchset_id/"
end

Instance Method Details

#accept(feedback = nil) ⇒ Object



20
21
22
23
# File 'lib/scripted_client/pitch.rb', line 20

def accept(feedback = nil)
  set_pitchset_prefix
  post(:accept, {}, { feedback: feedback }.to_json)
end

#reject(feedback = nil) ⇒ Object



25
26
27
28
# File 'lib/scripted_client/pitch.rb', line 25

def reject(feedback = nil)
  set_pitchset_prefix
  post(:reject, {}, { feedback: feedback }.to_json)
end