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.



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

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

Instance Attribute Details

#apikeyObject

Returns the value of attribute apikey.



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

def apikey
  @apikey
end

#usernameObject

Returns the value of attribute username.



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

def username
  @username
end

Instance Method Details

#project(url) ⇒ Object



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

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