Sha256: fad8f4d6ff2427582940f24647a39e739e19283bee410bca794eb87007e0829f
Contents?: true
Size: 965 Bytes
Versions: 12
Compression:
Stored size: 965 Bytes
Contents
module Bitstamp class Collection attr_accessor :access_token, :module, :name, :model, :path def initialize(api_prefix="/api") self.access_token = Bitstamp.key self.module = self.class.to_s.singularize.underscore self.name = self.module.split('/').last self.model = self.module.camelize.constantize self.path = "#{api_prefix}/#{self.name.pluralize}" end def all(options = {}) Bitstamp::Helper.parse_objects! Bitstamp::Net::get(self.path).body_str, self.model end def create(options = {}) Bitstamp::Helper.parse_object! Bitstamp::Net::post(self.path, options).body_str, self.model end def find(id, options = {}) Bitstamp::Helper.parse_object! Bitstamp::Net::get("#{self.path}/#{id}").body_str, self.model end def update(id, options = {}) Bitstamp::Helper.parse_object! Bitstamp::Net::patch("#{self.path}/#{id}", options).body_str, self.model end end end
Version data entries
12 entries across 12 versions & 4 rubygems