Class: Alpaca::News::Api::Models::News

Inherits:
Object
  • Object
show all
Defined in:
lib/alpaca/news/api/models/news.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ News

Create new News object

Parameters:

  • attributes (Hash) (defaults to: {})


78
79
80
81
82
83
84
85
# File 'lib/alpaca/news/api/models/news.rb', line 78

def initialize(attributes = {})
  @attributes = ActiveSupport::HashWithIndifferentAccess.new(attributes)
  @attributes.each do |key, value|
    method(:"#{key}=").call(value)
  end
  @created_at = Time.parse(@created_at) if @created_at.is_a?(String)
  @updated_at = Time.parse(@updated_at) if @updated_at.is_a?(String)
end

Instance Attribute Details

#authorString

News author

Returns:

  • (String)


24
25
26
# File 'lib/alpaca/news/api/models/news.rb', line 24

def author
  @author
end

#contentString

News content

Returns:

  • (String)


54
55
56
# File 'lib/alpaca/news/api/models/news.rb', line 54

def content
  @content
end

#created_atString

News created_at timestamp (RFC 3339)

Returns:

  • (String)


30
31
32
# File 'lib/alpaca/news/api/models/news.rb', line 30

def created_at
  @created_at
end

#headlineString

News headline

Returns:

  • (String)


18
19
20
# File 'lib/alpaca/news/api/models/news.rb', line 18

def headline
  @headline
end

#idString

News object ID

Returns:

  • (String)


12
13
14
# File 'lib/alpaca/news/api/models/news.rb', line 12

def id
  @id
end

#imagesArray

News images

Returns:

  • (Array)


60
61
62
# File 'lib/alpaca/news/api/models/news.rb', line 60

def images
  @images
end

#sourceString

News source

Returns:

  • (String)


72
73
74
# File 'lib/alpaca/news/api/models/news.rb', line 72

def source
  @source
end

#summaryString

News summary

Returns:

  • (String)


42
43
44
# File 'lib/alpaca/news/api/models/news.rb', line 42

def summary
  @summary
end

#symbolsArray

News symbols

Returns:

  • (Array)


66
67
68
# File 'lib/alpaca/news/api/models/news.rb', line 66

def symbols
  @symbols
end

#updated_atString

News updated_at timestamp (RFC 3339)

Returns:

  • (String)


36
37
38
# File 'lib/alpaca/news/api/models/news.rb', line 36

def updated_at
  @updated_at
end

#urlString

News URL

Returns:

  • (String)


48
49
50
# File 'lib/alpaca/news/api/models/news.rb', line 48

def url
  @url
end