Class: Sidemash::Sdk::StreamSquareService

Inherits:
Object
  • Object
show all
Defined in:
lib/sidemash/sdk/stream_square_service.rb

Instance Method Summary collapse

Constructor Details

#initialize(auth) ⇒ StreamSquareService

Returns a new instance of StreamSquareService.



22
23
24
25
# File 'lib/sidemash/sdk/stream_square_service.rb', line 22

def initialize(auth)
  @_type = 'StreamSquareService'
  @auth = auth
end

Instance Method Details

#create(form) ⇒ Object



27
28
29
30
# File 'lib/sidemash/sdk/stream_square_service.rb', line 27

def create(form)
  remote = Http.post('/' + Http.version + '/stream-squares', form.to_json, "", {}, @auth)
  StreamSquare.from_hash(remote)
end

#delete(id) ⇒ Object



48
49
50
# File 'lib/sidemash/sdk/stream_square_service.rb', line 48

def delete(id)
  Http.delete('/' + Http.version + '/stream-squares/' + id, nil, "", {}, @auth)
end

#get(id) ⇒ Object



32
33
34
35
# File 'lib/sidemash/sdk/stream_square_service.rb', line 32

def get(id)
  remote = Http.get('/' + Http.version + '/stream-squares/' + id, "", {}, @auth)
  StreamSquare.from_hash(remote)
end

#list(form = nil) ⇒ Object



37
38
39
40
41
# File 'lib/sidemash/sdk/stream_square_service.rb', line 37

def list(form = nil)
  qs = form.nil? ? ListForm.empty.to_query_string : form.to_query_string
  remote = Http.list('/' + Http.version + '/stream-squares', qs, {}, @auth)
  StreamSquareRestCollection.from_hash(remote)
end

#to_sObject



52
53
54
# File 'lib/sidemash/sdk/stream_square_service.rb', line 52

def to_s
  'StreamSquareService(auth=' + @auth.to_s + ')'
end

#update(form) ⇒ Object



43
44
45
46
# File 'lib/sidemash/sdk/stream_square_service.rb', line 43

def update(form)
  remote = Http.patch('/' + Http.version + '/stream-squares/' + form.id, form.to_json, "", {}, @auth)
  StreamSquare.from_hash(remote)
end