Sha256: df6fcf5f4c0a9f3e832173b5b7542cde44ac0e38b445de52e2178e8182621205
Contents?: true
Size: 832 Bytes
Versions: 3
Compression:
Stored size: 832 Bytes
Contents
require 'fluxx/resource' # Fluxx lightweight API wrapper module Fluxx # Core Fluxx API resource mappings. CORE_MODELS = { GrantRequest: 'grant_request', RequestReport: 'request_report', RequestOrganization: 'request_organization', RequestUser: 'request_user', RequestTransaction: 'request_transaction', Organization: 'organization', Program: 'program', SubProgram: 'sub_program', ModelDocument: 'model_document', User: 'user', GeoCountry: 'geo_country', GeoState: 'geo_state' } # Helper to define the mapped models # # @return [Class] def self.define_model(model_name, api_path) new_resource = Class.new(Resource) new_resource.path("/api/rest/v2/#{api_path}") const_set(model_name, new_resource) end CORE_MODELS.each { |k, v| define_model(k, v) } end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
fluxx-0.1.5 | lib/fluxx/resources.rb |
fluxx-0.1.4 | lib/fluxx/resources.rb |
fluxx-0.1.3 | lib/fluxx/resources.rb |