Retrieving WebProperty for a given profile/view
Closed this issue · 13 comments
Given a view/profile there doesn't seem to be a way to get the corresponding web property name.
There's Legato::Management::WebProperty.for_account
, which looks like it returns all the web properties for an account.
But what if you just want the single WebProperty associated to a profile?
Currently, the methods all function by filtering down the tree from user to accounts to properties to profiles/views. I can quickly add methods to go back up the tree if you're in need of them.
Just so we're clear, you want to be able to go profile.web_property
to get the property that a particular profile "belongs to"?
Right. The use case is that I'd like to mimic GA's current hierarchical view, given a profile:
I'd like to be able to write something like
profile = ...
descriptive_name = "#{profile.account.name} / #{profile.web_property.name} / #{profile.name}"
It would also work if there were class methods that instantiated the appropriate object given an id, e.g., WebProperty.find(id)
.
👍 I'll knock that out on the train before I get to Portland. Gimme a little bit.
Welp. I have a working branch to get the web property for a profile. But, when I try to get the account for a web property or profile, GA 404s.
Even when I attempt to request the selfLink
from an account directly, same thing. 😢
Oh, the API only allows list
. Sigh.
WebProperty and View permit get
along with most other REST/CRUD behaviors. Account can only be listed.
Soooo, for account I guess all I can do is fetch all accounts for the user and detect on the account id from the child (property or profile).
@fj mind looking over that PR?
I guess the reason I never added the support was that it required re-fetching a list of all accounts.
Actually that's probably sufficient. I already have the account
object so I can just use that.
I can't seem to cut a gem from the train :-(
Is the version bumped? I don't think Rubygems lets you push the same version twice.
It was an openssl problem with an old version of ruby on my machine. Derp.
Released 0.4.0.