Sha256: 181562e900b4f0e4cc84ff6368e354c7a506369c5d8e5fa0aca2d55edde07deb
Contents?: true
Size: 1.37 KB
Versions: 2
Compression:
Stored size: 1.37 KB
Contents
module MxHero::API class Domain < Resource attributes :domain, :server, :creation_date, :update_date, :aliases, :features, :cos, :cos_last_change, :metadata attribute :creation_date, map: 'creationDate', date: true attribute :update_date, map: 'updateDate', date: true attribute :cos_last_change, map: 'cosLastChange', date: true attribute :metadata def initialize(data = {}) super(data) load_features(features) load_cos(cos) load_metadata end def change_to_trial if cos.type == 'free' cos.type = 'trial' end end private def load_cos(cos) @cos = Cos.new cos end def load_features(features) @features = features.map { |feature| Feature.new feature } end def load_metadata @metadata = JSON.parse(metadata) if metadata end end class Feature < Resource attribute :component, map: 'feature' attributes :created, :updated, :metadata attribute :max_rules_amount, map: 'maxRulesAmount' def initialize(data = {}) super(data) if max_rules_amount == 0 || max_rules_amount.nil? @max_rules_amount = Float::INFINITY end end def unlimited_use? max_rules_amount == Float::INFINITY end end class Cos < Resource attribute :type, map: 'cos' attribute :edition end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mxhero-api-0.1.32 | lib/resources/domain.rb |
mxhero-api-0.1.31 | lib/resources/domain.rb |