Class: Billomat::Base

Inherits:
ActiveResource::Base
  • Object
show all
Defined in:
lib/billomat-rb.rb

Overview

possibly ResourceWithActiveArchived

Class Method Summary collapse

Class Method Details

.all(options = {}) ⇒ Object

Some common shortcuts from ActiveRecord



144
145
146
# File 'lib/billomat-rb.rb', line 144

def all(options={})
  find(:all,options)
end

.coll_p(prefix_options = {}, query_options = nil) ⇒ Object



131
132
133
# File 'lib/billomat-rb.rb', line 131

def coll_p(prefix_options = {}, query_options = nil)
  collection_path(prefix_options, query_options)
end

.collection_path(prefix_options = {}, query_options = nil) ⇒ Object



137
138
139
140
# File 'lib/billomat-rb.rb', line 137

def collection_path(prefix_options = {}, query_options = nil)
  prefix_options, query_options = split_options(prefix_options) if query_options.nil?
  "#{prefix(prefix_options)}#{collection_name}#{query_string(query_options)}"
end

.el_p(id, prefix_options = {}, query_options = nil) ⇒ Object



127
128
129
# File 'lib/billomat-rb.rb', line 127

def el_p(id,prefix_options = {}, query_options = nil)
  element_path(id,prefix_options, query_options)
end

.element_path(id, prefix_options = {}, query_options = nil) ⇒ Object



122
123
124
125
# File 'lib/billomat-rb.rb', line 122

def element_path(id, prefix_options = {}, query_options = nil)
  prefix_options, query_options = split_options(prefix_options) if query_options.nil?
  "#{prefix(prefix_options)}#{collection_name}/#{id}#{query_string(query_options)}"
end

.first(options = {}) ⇒ Object



148
149
150
# File 'lib/billomat-rb.rb', line 148

def first(options={})
  find_every(options).first
end

.inherited(base) ⇒ Object

TODO somehow use json www.billomat.com/de/api/grundlagen



110
111
112
113
114
115
116
117
118
119
120
# File 'lib/billomat-rb.rb', line 110

def inherited(base)
  unless base == Billomat::SingletonBase
    Billomat.resources << base
    class << base
      attr_accessor :site_format
    end
    base.site_format = '%s'
    base.timeout = 20
  end
  super
end

.last(options = {}) ⇒ Object



152
153
154
# File 'lib/billomat-rb.rb', line 152

def last(options={})
  find_every(options).last
end