Class: Licensario::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/licensario/base.rb

Direct Known Subclasses

License, LicensedFeature, LicensedResource, User

Constant Summary collapse

@@api =
nil
@@date_format =
"%Y%m%d%H%M%S"

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Base

Returns a new instance of Base.



12
13
14
15
16
17
# File 'lib/licensario/base.rb', line 12

def initialize(attributes = {})
  @attributes = attributes
  @attributes.each do |k,v|
    self.send(k.to_s + '=',v)
  end
end

Class Method Details

.apiObject



29
30
31
# File 'lib/licensario/base.rb', line 29

def self.api
  @@api
end

.date_formatObject



33
34
35
# File 'lib/licensario/base.rb', line 33

def self.date_format
  @@date_format
end

.establish_connection(options = {}) ⇒ Object

Establish a common connection for all Licensario operations



20
21
22
23
24
25
26
27
# File 'lib/licensario/base.rb', line 20

def self.establish_connection(options = {})
  @options = {
    base_url: 'users.licensario.com',
    use_ssl: true,
    debug: false
  }.merge(options)
  @@api = Licensario::API.new(@options[:key], @options[:secret], @options[:base_url], @options[:use_ssl], @options[:debug])
end