Class: Phonegap::App

Inherits:
Object
  • Object
show all
Defined in:
lib/phonegap-api/app.rb

Instance Method Summary collapse

Constructor Details

#initialize(api_data) ⇒ App

Returns a new instance of App.



4
5
6
7
8
# File 'lib/phonegap-api/app.rb', line 4

def initialize(api_data)
  api_data.each do |k,v|
    instance_variable_set(("@"+k).to_sym,v)
  end
end

Instance Method Details

#to_jsonObject



10
11
12
13
14
15
# File 'lib/phonegap-api/app.rb', line 10

def to_json
  hash = {}
  instance_variables.each {|var| hash[var.to_s.delete("@")] = instance_variable_get(var) }
  hash = {"data" => hash}
  hash.to_json
end