lib/resources/domain.rb in mxhero-api-0.1.30 vs lib/resources/domain.rb in mxhero-api-0.1.31

- old
+ new

@@ -1,20 +1,22 @@ module MxHero::API class Domain < Resource attributes :domain, :server, :creation_date, :update_date, - :aliases, :features, :cos, :cos_last_change + :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' @@ -28,9 +30,14 @@ 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'