Class: Cenit::API::Namespace

Inherits:
Object
  • Object
show all
Includes:
HttpDataRequester, UrlSlug
Defined in:
lib/cenit/api/namespace.rb

Instance Attribute Summary

Attributes included from UrlSlug

#parent, #slug

Instance Method Summary collapse

Methods included from HttpDataRequester

#do_data_request, #do_request

Methods included from HttpQuery

#query

Methods included from UrlSlug

#initialize, #url

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(symbol, *args) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/cenit/api/namespace.rb', line 13

def method_missing(symbol, *args)
  if args.length < 2
    dt = DataType.new(symbol, self)
    if args.length == 1
      Record.new(args[0], dt)
    else
      dt
    end
  else
    super
  end
end

Instance Method Details

#push(data, options = {}) ⇒ Object



8
9
10
11
# File 'lib/cenit/api/namespace.rb', line 8

def push(data, options = {})
  options[:url] = "#{url}/push"
  do_data_request(:post, data, options)
end