Sha256: 1a52a049b2e2f0e3d6dea4ebc2e9151abef18d4b58f80f1f03019a77230c4305

Contents?: true

Size: 826 Bytes

Versions: 18

Compression:

Stored size: 826 Bytes

Contents

module Bitstamp
  class Model
    attr_accessor :error, :message

    if ActiveModel::VERSION::MAJOR <= 3
      include ActiveModel::Validations
      include ActiveModel::Conversion
      extend ActiveModel::Naming

      def initialize(attributes = {})
        self.attributes = attributes
      end
    else
      include ActiveModel::Model
    end

    # Set the attributes based on the given hash
    def attributes=(attributes = {})
      attributes.each do |name, value|
        begin
          send("#{name}=", value)
        rescue NoMethodError => e
          puts "Unable to assign #{name}. No such method."
        end
      end
    end

    # Returns a hash with the current instance variables
    def attributes
      Hash[instance_variables.map { |name| [name, instance_variable_get(name)] }]
    end
  end
end

Version data entries

18 entries across 18 versions & 5 rubygems

Version Path
bitstamp-2-0.7.1 lib/bitstamp/model.rb
bitstamp-2-0.7.0 lib/bitstamp/model.rb
bitstamp-2-0.6.0 lib/bitstamp/model.rb
bitstamp-2-0.5.0 lib/bitstamp/model.rb
bitstamp-2-0.4.4 lib/bitstamp/model.rb
bitstamp-2-0.4.2 lib/bitstamp/model.rb
bitstamp-2-0.4.1 lib/bitstamp/model.rb
bitstamp-rbtc-arbitrage-0.4.0 lib/bitstamp/model.rb
rbtc_arbitrage-2.3.0 bitstamp/lib/bitstamp/model.rb
rbtc_arbitrage-2.2.1 bitstamp/lib/bitstamp/model.rb
rbtc_arbitrage-2.2.0 bitstamp/lib/bitstamp/model.rb
rbtc_arbitrage-2.1.2 bitstamp/lib/bitstamp/model.rb
rbtc_arbitrage-2.1.1 bitstamp/lib/bitstamp/model.rb
rbtc_arbitrage-2.1.0 bitstamp/lib/bitstamp/model.rb
cgore-bitstamp-0.3.1 lib/bitstamp/model.rb
bitstamp-0.3.0 lib/bitstamp/model.rb
bitstamp-0.2.8 lib/bitstamp/model.rb
bitstamp-0.2.7 lib/bitstamp/model.rb