Sha256: 901eda7877e7d29d5faec0eaac8178949305d1dd8d8fb5943257162ffd6b2ce9
Contents?: true
Size: 609 Bytes
Versions: 2
Compression:
Stored size: 609 Bytes
Contents
module Moysklad class Universe def class_by_resource resource "Moysklad::Resources::#{resource.to_s.singularize.capitalize}".constantize end def initialize client: nil raise "Должен быть client[Moysklad::Client]" unless client.is_a? Moysklad::Client @client = client @resources={} end Moysklad::Resources.resources.each do |resource_klass| define_method resource_klass.pluralized_type do @resources[resource_klass.type] ||= resource_klass.indexed( client: client ) end end private attr_reader :client end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
moysklad-0.1.2 | lib/moysklad/universe.rb |
moysklad-0.1.1 | lib/moysklad/universe.rb |