class Coinmarketcal::Event
Attributes
can_occur_before[R]
categories[R]
coins[R]
created_date[R]
date_event[R]
description[R]
id[R]
is_hot[R]
percentage[R]
positive_vote_count[R]
proof[R]
source[R]
tip_address[R]
tip_symbol[R]
title[R]
twitter_account[R]
vote_count[R]
Public Class Methods
all(attrs = {})
click to toggle source
# File lib/coinmarketcal/event.rb, line 17 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
new(attrs = {})
click to toggle source
# File lib/coinmarketcal/event.rb, line 8 def initialize(attrs = {}) attrs.each do |k, v| next if ['created_date', 'date_event'].include?(k.to_s) self.instance_variable_set("@#{k}", v) end @created_date = Time.iso8601(attrs['created_date']) @date_event = Time.iso8601(attrs['date_event']) end
Private Class Methods
client()
click to toggle source
# File lib/coinmarketcal/event.rb, line 34 def self.client @client ||= Coinmarketcal.client end
compact(hash)
click to toggle source
# File lib/coinmarketcal/event.rb, line 38 def self.compact(hash) hash.select { |_, value| !value.nil? } end