Sha256: aee5bb7207ba1b670c279aca28cd75296d5c0fb036336e2cce832dc1dc9e7ae0
Contents?: true
Size: 1.32 KB
Versions: 1
Compression:
Stored size: 1.32 KB
Contents
module StratumnSdk class Application include Request extend Request attr_accessor :url, :id, :name, :agent_info def self.load(application_name, application_location = nil) url = application_location || StratumnSdk.config[:application_url].gsub('%s', application_name) attributes = get(url) self.new(url, attributes['id'], attributes['name'], attributes['agentInfo']) end def initialize(url, id, name, agent_info) self.url = url self.id = id self.name = name self.agent_info = agent_info end def create_map(*args) result = post(url + '/maps', json: args) raise result['meta']['errorMessage'] if result['meta']['errorMessage'] Link.new(self, result) end def get_link(link_hash) result = get(url + '/links/' + link_hash) Link.new(self, result) end def get_map(map_id, tags = []) query = tags.empty? ? '' : "?tags=#{tags.join('&tags=')}" result = get(url + '/maps/' + map_id + query) result.map do |link| Link.new(self, link) end end def get_branches(link_hash, tags = []) query = tags.empty? ? '' : "?tags=#{tags.join('&tags=')}" result = get(url + '/branches/' + link_hash + query) result.map do |link| Link.new(self, link) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
stratumn_sdk-0.0.1 | lib/stratumn_sdk/application.rb |