Sha256: f260ae7bc514b6d94b2d6d0cf85ed1ecc8dd125c6777ac48d9221cef43ed01bc

Contents?: true

Size: 708 Bytes

Versions: 2

Compression:

Stored size: 708 Bytes

Contents

# frozen_string_literal: true

require 'json'

module GoogleAnalyticsV4Api
  class Account
    attr_accessor :name, :createTime, :updateTime, :displayName, :regionCode

    def initialize(client, attributes = {})
      @client = client
      attributes.each do |k, v|
        self.send("#{k}=", v)
      end
    end

    def properties
      @client.properties(name)
    end

    def property(property_name)
      @client.property(property_name)
    end

    def self.parse_list(client, body)
      parsed_body = JSON.parse(body)
      return [] if parsed_body["accounts"].nil?

      parsed_body["accounts"].map do |attrs|
        GoogleAnalyticsV4Api::Account.new(client, attrs)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
google_analytics_v4_api-0.0.8 lib/google_analytics_v4_api/account.rb
google_analytics_v4_api-0.0.7 lib/google_analytics_v4_api/account.rb