Class: Sqwiggle::Api::Service

Inherits:
Object
  • Object
show all
Defined in:
lib/sqwiggle/api/service.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass, client) ⇒ Service

Returns a new instance of Service.


7
8
9
# File 'lib/sqwiggle/api/service.rb', line 7

def initialize(klass, client)
  @klass, @client = klass, client
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.


5
6
7
# File 'lib/sqwiggle/api/service.rb', line 5

def client
  @client
end

#klassObject (readonly)

Returns the value of attribute klass.


5
6
7
# File 'lib/sqwiggle/api/service.rb', line 5

def klass
  @klass
end

Instance Method Details

#allObject


11
12
13
# File 'lib/sqwiggle/api/service.rb', line 11

def all
  klass.all client
end

#find(id) ⇒ Object


15
16
17
# File 'lib/sqwiggle/api/service.rb', line 15

def find(id)
  klass.find id, client
end

#new(params = {}) ⇒ Object


19
20
21
# File 'lib/sqwiggle/api/service.rb', line 19

def new(params={})
  klass.new ({client:client}.merge(params))
end