Class: Rlaunchpadlib::Client

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/rlaunchpadlib/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeClient

Returns a new instance of Client.



11
12
13
14
# File 'lib/rlaunchpadlib/client.rb', line 11

def initialize()
    @base_uri = "https://api.launchpad.net"
    @api_version = "1.0"
end

Instance Attribute Details

#api_versionObject

Returns the value of attribute api_version.



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

def api_version
  @api_version
end

#base_uriObject

Returns the value of attribute base_uri.



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

def base_uri
  @base_uri
end

Instance Method Details

#get(scope, operation = "") ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/rlaunchpadlib/client.rb', line 16

def get(scope, operation="")
    if operation.empty?
        result = self.class.get "#{@base_uri}/#{@api_version}/#{scope}"
        result.to_hash()
    else
        result = self.class.get "#{@base_uri}/#{@api_version}/#{scope}/?ws.op=#{operation}"
        result.to_hash()
    end
end