Class: Coinmarketcal::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/coinmarketcal/event.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ Event

Returns a new instance of Event.



7
8
9
10
11
# File 'lib/coinmarketcal/event.rb', line 7

def initialize(attrs = {})
  attrs.each do |k, v|
    self.instance_variable_set("@#{k}", v)
  end
end

Instance Attribute Details

#can_occur_beforeObject (readonly)

Returns the value of attribute can_occur_before.



3
4
5
# File 'lib/coinmarketcal/event.rb', line 3

def can_occur_before
  @can_occur_before
end

#categoriesObject (readonly)

Returns the value of attribute categories.



3
4
5
# File 'lib/coinmarketcal/event.rb', line 3

def categories
  @categories
end

#coinsObject (readonly)

Returns the value of attribute coins.



3
4
5
# File 'lib/coinmarketcal/event.rb', line 3

def coins
  @coins
end

#created_dateObject (readonly)

Returns the value of attribute created_date.



3
4
5
# File 'lib/coinmarketcal/event.rb', line 3

def created_date
  @created_date
end

#date_eventObject (readonly)

Returns the value of attribute date_event.



3
4
5
# File 'lib/coinmarketcal/event.rb', line 3

def date_event
  @date_event
end

#descriptionObject (readonly)

Returns the value of attribute description.



3
4
5
# File 'lib/coinmarketcal/event.rb', line 3

def description
  @description
end

#idObject (readonly)

Returns the value of attribute id.



3
4
5
# File 'lib/coinmarketcal/event.rb', line 3

def id
  @id
end

#is_hotObject (readonly)

Returns the value of attribute is_hot.



3
4
5
# File 'lib/coinmarketcal/event.rb', line 3

def is_hot
  @is_hot
end

#percentageObject (readonly)

Returns the value of attribute percentage.



3
4
5
# File 'lib/coinmarketcal/event.rb', line 3

def percentage
  @percentage
end

#positive_vote_countObject (readonly)

Returns the value of attribute positive_vote_count.



3
4
5
# File 'lib/coinmarketcal/event.rb', line 3

def positive_vote_count
  @positive_vote_count
end

#proofObject (readonly)

Returns the value of attribute proof.



3
4
5
# File 'lib/coinmarketcal/event.rb', line 3

def proof
  @proof
end

#sourceObject (readonly)

Returns the value of attribute source.



3
4
5
# File 'lib/coinmarketcal/event.rb', line 3

def source
  @source
end

#tip_addressObject (readonly)

Returns the value of attribute tip_address.



3
4
5
# File 'lib/coinmarketcal/event.rb', line 3

def tip_address
  @tip_address
end

#tip_symbolObject (readonly)

Returns the value of attribute tip_symbol.



3
4
5
# File 'lib/coinmarketcal/event.rb', line 3

def tip_symbol
  @tip_symbol
end

#titleObject (readonly)

Returns the value of attribute title.



3
4
5
# File 'lib/coinmarketcal/event.rb', line 3

def title
  @title
end

#twitter_accountObject (readonly)

Returns the value of attribute twitter_account.



3
4
5
# File 'lib/coinmarketcal/event.rb', line 3

def 
  @twitter_account
end

#vote_countObject (readonly)

Returns the value of attribute vote_count.



3
4
5
# File 'lib/coinmarketcal/event.rb', line 3

def vote_count
  @vote_count
end

Class Method Details

.all(attrs = {}) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/coinmarketcal/event.rb', line 13

def self.all(attrs = {})
  search_hash = {
      page: (attrs['page'] || 1),
      max: attrs['max'],
      dateRangeStart: attrs['date_range_start'],
      dateRangeEnd: attrs['date_range_end'],
      coins: attrs['coins'],
      categories: attrs['categories'],
      sortBy: attrs['sort_by'],
      showOnly: attrs['show_only'],
      showMetadata: attrs['show_metadata']
  }
  client.get('v1/events', compact(search_hash)).map { |data| new(data) }
end