Class: Ulule

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(username, apikey) ⇒ Ulule

Returns a new instance of Ulule.



11
12
13
# File 'lib/ulule.rb', line 11

def initialize(username, apikey)
  @username, @apikey = username, apikey
end

Instance Attribute Details

#apikeyObject

Returns the value of attribute apikey.



9
10
11
# File 'lib/ulule.rb', line 9

def apikey
  @apikey
end

#usernameObject

Returns the value of attribute username.



8
9
10
# File 'lib/ulule.rb', line 8

def username
  @username
end

Instance Method Details

#project(url) ⇒ Object

Raises:



15
16
17
18
19
20
# File 'lib/ulule.rb', line 15

def project url
  raise UluleError, "Wrong url" if (name = url.match(/.*\/(.*)\/$/)).nil?
  output = send_request name[1]
  raise UluleError "Wrong username/apikey or url" if output.empty?
  JSON.parse output
end