Class: Beanstalk::API::Changeset

Inherits:
Base
  • Object
show all
Defined in:
lib/beanstalkapp/changeset.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

add_prefix, setup

Class Method Details

.find_all_for_repository(repo_id) ⇒ Object



4
5
6
# File 'lib/beanstalkapp/changeset.rb', line 4

def self.find_all_for_repository(repo_id)
  get :repository, :repository_id => repo_id
end

.find_for_repository(id, repo_id) ⇒ Object



8
9
10
# File 'lib/beanstalkapp/changeset.rb', line 8

def self.find_for_repository(id, repo_id)
  find id, :params => { :repository_id => repo_id }
end

Instance Method Details

#load(attributes) ⇒ Object

ActiveResource 2.3.2 doesn’t support loading of nested arrays and symbols we submitted a patch to the Rails Core but it’s not committed yet rails.lighthouseapp.com/projects/8994/tickets/2394-support-for-loading-nested-arrays-in-activeresource

Raises:

  • (ArgumentError)


16
17
18
19
20
21
22
23
# File 'lib/beanstalkapp/changeset.rb', line 16

def load(attributes)
  raise ArgumentError, "expected an attributes Hash, got #{attributes.inspect}" unless attributes.is_a?(Hash)
  @prefix_options, attributes = split_options(attributes)
  attributes.each do |key, value|
    @attributes[key.to_s] = typecast_attribute_value(key, value)
  end
  self
end