Class: MachineShop::EndPoints

Inherits:
APIResource show all
Includes:
APIOperations::List
Defined in:
lib/machineshop/end_points.rb

Instance Attribute Summary

Attributes inherited from MachineShopObject

#auth_token

Class Method Summary collapse

Methods included from APIOperations::List

included

Methods inherited from APIResource

class_name, #refresh, retrieve, #url

Methods inherited from MachineShopObject

#[], #[]=, #as_json, construct_from, #each, #initialize, #inspect, #keys, #refresh_from, #to_hash, #to_json, #to_s, #values

Constructor Details

This class inherits a constructor from MachineShop::MachineShopObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class MachineShop::MachineShopObject

Class Method Details

.all(version = v0, namespace = "", auth_token) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/machineshop/end_points.rb', line 11

def self.all(version=v0,namespace="",auth_token)

  # ActiveRecord::Base.logger = Logger.new(STDOUT)

  endpoints = MachineShop.gem_get(url+"/#{version}/#{namespace}",auth_token)

  endpoints=endpoints.as_json
  endpoints = endpoints["#{version}"]["api"]

  if Util.db_connected?
    endpoints.each do |endpoint|
      apiend = ApiEndpoint.find_or_initialize_by(verb: endpoint['verb'], endpoint:endpoint['endpoint'], auth_token: auth_token)
      apiend.save

    end

  end
end

.urlObject

Specific API calls



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

def self.url()
  return "/gem/routes"
end