Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

syntax updates for ruby 1.8.7

  • Loading branch information...
commit d1798fdcce1650f529a11310ee4772a868845deb 1 parent 0625235
@rossta authored
Showing with 12 additions and 6 deletions.
  1. +8 −6 lib/trello/client.rb
  2. +4 −0 lib/trello/configuration.rb
View
14 lib/trello/client.rb
@@ -4,8 +4,8 @@ module Trello
class Client
include Authorization
- delegate *Configuration::CONFIGURABLE_ATTRIBUTES, to: :configuration
- delegate :credentials, to: :configuration
+ delegate *Configuration.configurable_attributes << { :to => :configuration }
+ delegate :credentials, :to => :configuration
def initialize(attrs = {})
self.configuration.attributes = attrs
@@ -42,15 +42,16 @@ def delete(path)
#
def find(path, id)
response = get("/#{path.to_s.pluralize}/#{id}")
- class_from_path(path).parse(response) do |data|
+ trello_class = class_from_path(path)
+ trello_class.parse response do |data|
data.client = self
end
end
# Finds given resource by path with params
- def find_many(klass, path, params = {})
+ def find_many(trello_class, path, params = {})
response = get(path, params)
- klass.parse_many(response) do |data|
+ trello_class.parse_many response do |data|
data.client = self
end
end
@@ -64,7 +65,8 @@ def find_many(klass, path, params = {})
# client.create(Board, options)
#
def create(path, options)
- class_from_path(path).save(options) do |data|
+ trello_class = class_from_path(path)
+ trello_class.save options do |data|
data.client = self
end
end
View
4 lib/trello/configuration.rb
@@ -13,6 +13,10 @@ class Configuration
attr_accessor *CONFIGURABLE_ATTRIBUTES
+ def self.configurable_attributes
+ CONFIGURABLE_ATTRIBUTES
+ end
+
def initialize(attrs = {})
self.attributes = attrs
end
Please sign in to comment.
Something went wrong with that request. Please try again.