Class: OandaAPI::Resource::Labs::SpreadHistory

Inherits:
OandaAPI::ResourceBase show all
Defined in:
lib/oanda_api/resource/labs/spread_history.rb

Overview

Spread value object. See the Oanda Developer Guide for information about Spreads.

Defined Under Namespace

Classes: Tuple

Constant Summary

Constants inherited from OandaAPI::ResourceBase

OandaAPI::ResourceBase::NOT_PLURALIZED

Instance Attribute Summary collapse

Attributes inherited from OandaAPI::ResourceBase

#location

Instance Method Summary collapse

Methods inherited from OandaAPI::ResourceBase

class_from_symbol, labs_resource?, pluralize, #to_json

Constructor Details

#initialize(attributes = {}) ⇒ SpreadHistory

Returns a new instance of SpreadHistory.



16
17
18
19
20
21
22
# File 'lib/oanda_api/resource/labs/spread_history.rb', line 16

def initialize(attributes = {})
  attribs = attributes.dup
  self.averages = attribs.delete(:avg) || []
  self.maximums = attribs.delete(:max) || []
  self.minimums = attribs.delete(:min) || []
  super attribs
end

Instance Attribute Details

#avgObject Also known as: averages

Returns the value of attribute avg.



8
9
10
# File 'lib/oanda_api/resource/labs/spread_history.rb', line 8

def avg
  @avg
end

#maxObject Also known as: maximums

Returns the value of attribute max.



8
9
10
# File 'lib/oanda_api/resource/labs/spread_history.rb', line 8

def max
  @max
end

#minObject Also known as: minimums

Returns the value of attribute min.



8
9
10
# File 'lib/oanda_api/resource/labs/spread_history.rb', line 8

def min
  @min
end

Instance Method Details

#averages=(array = []) ⇒ Object



24
25
26
27
# File 'lib/oanda_api/resource/labs/spread_history.rb', line 24

def averages=(array=[])
  @avg = []
  array.each { |elements| @avg << Tuple.new(*elements) }
end

#maximums=(array = []) ⇒ Object



29
30
31
32
# File 'lib/oanda_api/resource/labs/spread_history.rb', line 29

def maximums=(array=[])
  @max = []
  array.each { |elements| @max << Tuple.new(*elements) }
end

#minimums=(array = []) ⇒ Object



34
35
36
37
# File 'lib/oanda_api/resource/labs/spread_history.rb', line 34

def minimums=(array=[])
  @min = []
  array.each { |elements| @min << Tuple.new(*elements) }
end