Class: Sorenson::Services::Site

Inherits:
Base show all
Defined in:
lib/sorenson/services/site.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

delete_from, get_from, host, login_no_resource, parse_response, post_to, put_to, verify_account_settings

Constructor Details

#initialize(data) ⇒ Site

Returns a new instance of Site.



17
18
19
20
21
22
# File 'lib/sorenson/services/site.rb', line 17

def initialize(data)
  @name         = data['name']
  @account_id   = data['account_id']
  @id           = data['id']
  @description  = data['description']
end

Instance Attribute Details

#account_idObject

Returns the value of attribute account_id.



4
5
6
# File 'lib/sorenson/services/site.rb', line 4

def 
  @account_id
end

#descriptionObject

Returns the value of attribute description.



4
5
6
# File 'lib/sorenson/services/site.rb', line 4

def description
  @description
end

#idObject

Returns the value of attribute id.



4
5
6
# File 'lib/sorenson/services/site.rb', line 4

def id
  @id
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/sorenson/services/site.rb', line 4

def name
  @name
end

Class Method Details

.allObject



9
10
11
# File 'lib/sorenson/services/site.rb', line 9

def self.all
  get_from('/sites')
end

.create(name, options = {}) ⇒ Object



5
6
7
# File 'lib/sorenson/services/site.rb', line 5

def self.create(name, options = {})
  new(post_to('/sites', {:site => {:name => name}.merge(options)}))
end

.find_by_name(name) ⇒ Object



13
14
15
# File 'lib/sorenson/services/site.rb', line 13

def Site.find_by_name(name)
  new(get_from('/sites/find_by_name/', :name => name))
end