Class: Launchrock::Site
- Inherits:
-
Connection
- Object
- Connection
- Launchrock::Site
- Defined in:
- lib/launchrock/models/site.rb
Instance Attribute Summary collapse
-
#access_token ⇒ Object
Returns the value of attribute access_token.
-
#client ⇒ Object
Returns the value of attribute client.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
Class Method Summary collapse
-
.all(client) ⇒ Object
WARNING: undocumented API.
-
.by_name(client, name) ⇒ Object
WARNING: undocumented API.
Instance Method Summary collapse
-
#initialize(client, id, name) ⇒ Site
constructor
A new instance of Site.
-
#users ⇒ Object
WARNING: undocumented API.
Methods inherited from Connection
Constructor Details
#initialize(client, id, name) ⇒ Site
Returns a new instance of Site.
5 6 7 |
# File 'lib/launchrock/models/site.rb', line 5 def initialize(client, id, name) self.client, self.id, self.name = client, id, name end |
Instance Attribute Details
#access_token ⇒ Object
Returns the value of attribute access_token.
3 4 5 |
# File 'lib/launchrock/models/site.rb', line 3 def access_token @access_token end |
#client ⇒ Object
Returns the value of attribute client.
3 4 5 |
# File 'lib/launchrock/models/site.rb', line 3 def client @client end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/launchrock/models/site.rb', line 3 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/launchrock/models/site.rb', line 3 def name @name end |
Class Method Details
.all(client) ⇒ Object
WARNING: undocumented API
10 11 12 13 14 15 16 |
# File 'lib/launchrock/models/site.rb', line 10 def self.all(client) attributes = perform_post("/v1/getPlatformUserSites", {:user_id => client.client_id })['platform_user_sites'] attributes.map(&:symbolize_keys).map do |attrs| Site.new(client, attrs[:SID], attrs[:siteName]) end end |
.by_name(client, name) ⇒ Object
WARNING: undocumented API
19 20 21 22 23 |
# File 'lib/launchrock/models/site.rb', line 19 def self.by_name(client, name) all(client).find do |site| site.name == name end end |
Instance Method Details
#users ⇒ Object
WARNING: undocumented API
34 35 36 37 38 39 |
# File 'lib/launchrock/models/site.rb', line 34 def users resp = HTTParty.get(users_url) raise Launchrock::Connection::ApiError, "An error occurred while fetching the list" unless resp.success? CSV.parse(resp.body, :headers => true, :header_converters => :launchrock) end |