Class: Hsp::Marketplace

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

Constant Summary collapse

DEFAULT_REST_URL =
'https://marketplace-server.hspconsortium.org'.freeze
DEFAULT_WEBSOCKET_URL =
'wss://marketplace-server.hspconsortium.org/websocket'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(rest_url = DEFAULT_REST_URL, websocket_url = DEFAULT_WEBSOCKET_URL) ⇒ Marketplace

Returns a new instance of Marketplace.



8
9
10
11
# File 'lib/hsp/marketplace.rb', line 8

def initialize(rest_url = DEFAULT_REST_URL, websocket_url = DEFAULT_WEBSOCKET_URL)
    self.rest_url = rest_url
    self.websocket_url = websocket_url
end

Instance Attribute Details

#rest_urlObject

Returns the value of attribute rest_url.



5
6
7
# File 'lib/hsp/marketplace.rb', line 5

def rest_url
  @rest_url
end

#websocket_urlObject

Returns the value of attribute websocket_url.



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

def websocket_url
  @websocket_url
end

Instance Method Details

#builds_url(service_id, build_id = nil) ⇒ Object



17
18
19
# File 'lib/hsp/marketplace.rb', line 17

def builds_url(service_id, build_id = nil)
    services_url(service_id) + '/builds' + (build_id.nil? ? '' : "/#{build_id}")
end

#platforms_url(user_id, platform_id = nil) ⇒ Object



25
26
27
# File 'lib/hsp/marketplace.rb', line 25

def platforms_url(user_id, platform_id = nil)
    users_url(user_id) + '/platforms' + (platform_id.nil? ? '' : "/#{platform_id}")
end

#services_url(id = nil) ⇒ Object



13
14
15
# File 'lib/hsp/marketplace.rb', line 13

def services_url(id = nil)
    rest_url + '/services' + (id.nil? ? '' : "/#{id}")
end

#users_url(id = nil) ⇒ Object



21
22
23
# File 'lib/hsp/marketplace.rb', line 21

def users_url(id = nil)
    rest_url + '/users' + (id.nil? ? '' : "/#{id}")
end