Class: Nurego::Organization

Inherits:
APIResource show all
Includes:
APIOperations::List, APIOperations::Update
Defined in:
lib/nurego/organization.rb

Instance Attribute Summary

Attributes inherited from NuregoObject

#api_key

Class Method Summary collapse

Instance Method Summary collapse

Methods included from APIOperations::Update

#save, #serialize_params

Methods included from APIOperations::List

included

Methods inherited from APIResource

class_name, #refresh, retrieve, url, #url

Methods inherited from NuregoObject

#[], #[]=, #as_json, construct_from, #each, #initialize, #inspect, #keys, #refresh_from, #to_hash, #to_json, #to_s, #values

Constructor Details

This class inherits a constructor from Nurego::NuregoObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Nurego::NuregoObject

Class Method Details

.entitlements(params = {}, api_key = nil) ⇒ Object



18
19
20
# File 'lib/nurego/organization.rb', line 18

def self.entitlements(params = {}, api_key = nil)
  Entitlement.all({:organization => params[:customer_id], :feature_id => params[:feature_id] }, api_key)
end

Instance Method Details

#billsObject



14
15
16
# File 'lib/nurego/organization.rb', line 14

def bills
  Bill.all({ :organization => id }, @api_key)[:bills]
end

#cancel(params = {}, api_key = nil) ⇒ Object



31
32
33
34
# File 'lib/nurego/organization.rb', line 31

def cancel(params = {}, api_key = nil)
  response, api_key = Nurego.request(:post, url + '/cancel', api_key, params)
  Util.convert_to_nurego_object(response, api_key)
end

#entitlements(feature_id = nil) ⇒ Object



22
23
24
# File 'lib/nurego/organization.rb', line 22

def entitlements(feature_id = nil)
  Entitlement.all({:organization => id, :feature_id => feature_id, :provider_name => 'internal' }, @api_key)
end

#instancesObject



6
7
8
# File 'lib/nurego/organization.rb', line 6

def instances
  Instance.all({:organization => id }, @api_key)
end

#paymentmethodObject



10
11
12
# File 'lib/nurego/organization.rb', line 10

def paymentmethod
  PaymentMethod.all({:organization => id}, @api_key)
end

#plan(params = {}, api_key = nil) ⇒ Object



26
27
28
29
# File 'lib/nurego/organization.rb', line 26

def plan(params = {}, api_key = nil)
  response, api_key = Nurego.request(:get, url + '/plan', api_key, params)
  Util.convert_to_nurego_object(response, api_key)
end