Class: PhonegapBuild::ResourceCollection
- Inherits:
-
Object
- Object
- PhonegapBuild::ResourceCollection
show all
- Defined in:
- lib/phonegap_build.rb
Instance Method Summary
collapse
Constructor Details
#initialize(client, res, singular, xkey = nil) ⇒ ResourceCollection
Returns a new instance of ResourceCollection.
49
50
51
52
53
54
|
# File 'lib/phonegap_build.rb', line 49
def initialize(client, res, singular, xkey = nil)
@client = client
@res = res
@singular = singular
@key = xkey
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *arguments, &block) ⇒ Object
60
61
62
63
64
65
66
67
|
# File 'lib/phonegap_build.rb', line 60
def method_missing(method, *arguments, &block)
puts "MM_RC: #{method}" if ENV['DEBUG']
if [:android, :ios].include?(method.to_sym)
ResourceCollection.new(@client, @res[method], false, 'keys')
else
all.send(method, *arguments, &block)
end
end
|
Instance Method Details
#all ⇒ Object
69
70
71
72
|
# File 'lib/phonegap_build.rb', line 69
def all
return @client.parse(@res.get)[@key] if !@singular
return @client.parse(@res.get) if @singular
end
|
#create(options) ⇒ Object
56
57
58
|
# File 'lib/phonegap_build.rb', line 56
def create(options)
@client.parse(@res.post(options))
end
|
#find(id, options = {}) ⇒ Object
74
75
76
|
# File 'lib/phonegap_build.rb', line 74
def find(id, options = {})
Resource.new(@client, @res[id])
end
|