Class: PhonegapBuild::Resource

Inherits:
Object
  • Object
show all
Defined in:
lib/phonegap_build.rb

Instance Method Summary collapse

Constructor Details

#initialize(client, res) ⇒ Resource

Returns a new instance of Resource.



80
81
82
83
# File 'lib/phonegap_build.rb', line 80

def initialize(client, res)
  @client = client
  @res = res
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *arguments, &block) ⇒ Object



85
86
87
88
89
90
# File 'lib/phonegap_build.rb', line 85

def method_missing(method, *arguments, &block)
  puts "MM_R: #{method}" if ENV['DEBUG']
  if !@client.action(@res, method, arguments.first)
    @client.parse(@res.get()).send(method, *arguments, &block).get()
  end
end

Instance Method Details

#destroyObject



92
93
94
# File 'lib/phonegap_build.rb', line 92

def destroy
  @client.parse(@res.delete)
end

#to_sObject



101
102
103
# File 'lib/phonegap_build.rb', line 101

def to_s
  @client.parse(@res.get())
end

#update(options) ⇒ Object



96
97
98
99
# File 'lib/phonegap_build.rb', line 96

def update(options)
  puts @res if ENV['DEBUG']
  @client.parse(@res.put data: options)
end