Class: GAShikomi::Command

Inherits:
Thor
  • Object
show all
Defined in:
lib/ga_shikomi/command.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Command

Returns a new instance of Command.



11
12
13
14
15
16
17
18
19
# File 'lib/ga_shikomi/command.rb', line 11

def initialize(*args)
  super

  if args.last[:current_command].name != 'help'
    store = (!options.nil? && options['credential-store']) || File.join(Dir.pwd, '.ga-cli-credential')
    @api    = Api.new(store)
    @config = Config.new(options['config_file']).config if options['config_file']
  end
end

Instance Attribute Details

#apiObject (readonly)

Returns the value of attribute api.



20
21
22
# File 'lib/ga_shikomi/command.rb', line 20

def api
  @api
end

#configObject (readonly)

Returns the value of attribute config.



20
21
22
# File 'lib/ga_shikomi/command.rb', line 20

def config
  @config
end

Instance Method Details

#accountsObject



32
33
34
# File 'lib/ga_shikomi/command.rb', line 32

def accounts
  Renderer.new(Subcommand::Accounts.new(api).list, options).render_accounts
end

#dimensionsObject



78
79
80
# File 'lib/ga_shikomi/command.rb', line 78

def dimensions
  Renderer.new(Subcommand::Metadata.new(api, options).dimensions, options).
end

#filtersObject



58
59
60
# File 'lib/ga_shikomi/command.rb', line 58

def filters
  Renderer.new(Subcommand::Filters.new(api, options).list, options).render_filters
end

#gaObject



27
28
29
# File 'lib/ga_shikomi/command.rb', line 27

def ga
  Renderer.new(Subcommand::Ga.new(api, options).get(config), options).render_ga
end

#goalsObject



66
67
68
# File 'lib/ga_shikomi/command.rb', line 66

def goals
  Renderer.new(Subcommand::Goals.new(api, options).list, options).render_goals
end

#metricsObject



72
73
74
# File 'lib/ga_shikomi/command.rb', line 72

def metrics
  Renderer.new(Subcommand::Metadata.new(api, options).metrics, options).
end

#profilesObject



52
53
54
# File 'lib/ga_shikomi/command.rb', line 52

def profiles
  Renderer.new(Subcommand::Profiles.new(api, options).list, options).render_profiles
end

#propertiesObject



38
39
40
# File 'lib/ga_shikomi/command.rb', line 38

def properties
  Renderer.new(Subcommand::Webproperties.new(api, options).list, options).render_properties
end

#propertyObject



45
46
47
# File 'lib/ga_shikomi/command.rb', line 45

def property
  Renderer.new(Subcommand::Webproperties.new(api, options).get, options).render_properties
end

#segmentsObject



83
84
85
# File 'lib/ga_shikomi/command.rb', line 83

def segments
  Renderer.new(Subcommand::Segments.new(api).list, options).render_segments
end