Sha256: 5030ac4e803b005dc3ac778b68715e50e84e9e4e15b604e573439e06d1cb610e

Contents?: true

Size: 737 Bytes

Versions: 1

Compression:

Stored size: 737 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) if self.respond_to?("#{k}=")
      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

1 entries across 1 versions & 1 rubygems

Version Path
google_analytics_v4_api-0.0.9 lib/google_analytics_v4_api/account.rb