Class: Asana::Resource
- Inherits:
-
ActiveResource::Base
- Object
- ActiveResource::Base
- Asana::Resource
show all
- Defined in:
- lib/asana/resource.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.collection_path(prefix_options = {}, query_options = nil) ⇒ Object
31
32
33
|
# File 'lib/asana/resource.rb', line 31
def collection_path(prefix_options = {}, query_options = nil)
remove_json_extension super
end
|
.custom_method_collection_url(method_name, options = {}) ⇒ Object
override to remove .json extension in the URL
19
20
21
|
# File 'lib/asana/resource.rb', line 19
def custom_method_collection_url(method_name, options = {})
remove_json_extension super
end
|
.element_path(id, prefix_options = {}, query_options = nil) ⇒ Object
23
24
25
|
# File 'lib/asana/resource.rb', line 23
def element_path(id, prefix_options = {}, query_options = nil)
remove_json_extension super
end
|
.new_element_path(prefix_options = {}) ⇒ Object
27
28
29
|
# File 'lib/asana/resource.rb', line 27
def new_element_path(prefix_options = {})
remove_json_extension super
end
|
.remove_json_extension(url) ⇒ Object
14
15
16
|
# File 'lib/asana/resource.rb', line 14
def remove_json_extension(url)
url.gsub(/\.json/,'')
end
|
.singleton_path(prefix_options = {}, query_options = nil) ⇒ Object
35
36
37
|
# File 'lib/asana/resource.rb', line 35
def singleton_path(prefix_options = {}, query_options = nil)
remove_json_extension super
end
|
Instance Method Details
#method_not_allowed ⇒ Object
3
4
5
|
# File 'lib/asana/resource.rb', line 3
def method_not_allowed
raise ActiveResource::MethodNotAllowed.new(__method__)
end
|
#reload ⇒ Object
8
9
10
|
# File 'lib/asana/resource.rb', line 8
def reload
self.class.find id
end
|
#to_json(options = {}) ⇒ Object
Asana wants it to be nested under data
41
42
43
44
45
|
# File 'lib/asana/resource.rb', line 41
def to_json(options={})
ret = super({ :root => 'data' }.merge(options))
puts "CONVERTING: #{options} TO: #{ret}"
ret
end
|