Class: GMoney::Portfolio

Inherits:
Object
  • Object
show all
Defined in:
lib/gmoney/portfolio.rb

Defined Under Namespace

Classes: PortfolioDeleteError, PortfolioRequestError

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cost_basisObject (readonly)

Returns the value of attribute cost_basis.



8
9
10
# File 'lib/gmoney/portfolio.rb', line 8

def cost_basis
  @cost_basis
end

#currency_codeObject

Returns the value of attribute currency_code.



6
7
8
# File 'lib/gmoney/portfolio.rb', line 6

def currency_code
  @currency_code
end

#days_gainObject (readonly)

Returns the value of attribute days_gain.



8
9
10
# File 'lib/gmoney/portfolio.rb', line 8

def days_gain
  @days_gain
end

Returns the value of attribute feed_link.



8
9
10
# File 'lib/gmoney/portfolio.rb', line 8

def feed_link
  @feed_link
end

#gainObject (readonly)

Returns the value of attribute gain.



8
9
10
# File 'lib/gmoney/portfolio.rb', line 8

def gain
  @gain
end

#gain_percentageObject (readonly)

Returns the value of attribute gain_percentage.



8
9
10
# File 'lib/gmoney/portfolio.rb', line 8

def gain_percentage
  @gain_percentage
end

#idObject (readonly)

Returns the value of attribute id.



8
9
10
# File 'lib/gmoney/portfolio.rb', line 8

def id
  @id
end

#market_valueObject (readonly)

Returns the value of attribute market_value.



8
9
10
# File 'lib/gmoney/portfolio.rb', line 8

def market_value
  @market_value
end

#return1wObject (readonly)

Returns the value of attribute return1w.



8
9
10
# File 'lib/gmoney/portfolio.rb', line 8

def return1w
  @return1w
end

#return1yObject (readonly)

Returns the value of attribute return1y.



8
9
10
# File 'lib/gmoney/portfolio.rb', line 8

def return1y
  @return1y
end

#return3mObject (readonly)

Returns the value of attribute return3m.



8
9
10
# File 'lib/gmoney/portfolio.rb', line 8

def return3m
  @return3m
end

#return3yObject (readonly)

Returns the value of attribute return3y.



8
9
10
# File 'lib/gmoney/portfolio.rb', line 8

def return3y
  @return3y
end

#return4wObject (readonly)

Returns the value of attribute return4w.



8
9
10
# File 'lib/gmoney/portfolio.rb', line 8

def return4w
  @return4w
end

#return5yObject (readonly)

Returns the value of attribute return5y.



8
9
10
# File 'lib/gmoney/portfolio.rb', line 8

def return5y
  @return5y
end

#return_overallObject (readonly)

Returns the value of attribute return_overall.



8
9
10
# File 'lib/gmoney/portfolio.rb', line 8

def return_overall
  @return_overall
end

#return_ytdObject (readonly)

Returns the value of attribute return_ytd.



8
9
10
# File 'lib/gmoney/portfolio.rb', line 8

def return_ytd
  @return_ytd
end

#titleObject

Returns the value of attribute title.



6
7
8
# File 'lib/gmoney/portfolio.rb', line 6

def title
  @title
end

#updatedObject (readonly)

Returns the value of attribute updated.



8
9
10
# File 'lib/gmoney/portfolio.rb', line 8

def updated
  @updated
end

Class Method Details

.all(options = {}) ⇒ Object



12
13
14
# File 'lib/gmoney/portfolio.rb', line 12

def self.all(options = {})
  retreive_portfolios(:all, options)
end

.delete(id) ⇒ Object



30
31
32
# File 'lib/gmoney/portfolio.rb', line 30

def self.delete(id)
  delete_portfolio(id)
end

.find(id, options = {}) ⇒ Object



16
17
18
# File 'lib/gmoney/portfolio.rb', line 16

def self.find(id, options = {})
  retreive_portfolios(id, options)
end

Instance Method Details

#deleteObject



34
35
36
37
# File 'lib/gmoney/portfolio.rb', line 34

def delete
  Portfolio.delete(@id.portfolio_feed_id)
  freeze
end

#positions(options = {}) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/gmoney/portfolio.rb', line 20

def positions(options = {})
  if options[:refresh]
    @positions = Position.find(@id.portfolio_feed_id, options)
  else
    @positions ||= Position.find(@id.portfolio_feed_id, options)
  end
  
  @positions.is_a?(Array) ? @positions : [@positions]
end