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

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

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



37
38
39
40
# File 'lib/nurego/organization.rb', line 37

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



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

def entitlements(feature_id = nil)
  Entitlement.all_by_organization(id, {:feature_id => feature_id}, @api_key)
end

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



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

def feature_data(params = {}, api_key = nil)
  response, api_key = Nurego.request(:get, url + "/feature_data", api_key, params)
  Util.convert_to_nurego_object(response, 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

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



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

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

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

:trial_days => total number of trial days

:trial_months => total number of trial months
exactly one of the trial_days | trial_months attributes should be passed.
:plan_id => "plan guid" | plan guid


49
50
51
52
# File 'lib/nurego/organization.rb', line 49

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

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



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

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