Class: PhonegapBuild::Client

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

Instance Method Summary collapse

Constructor Details

#initialize(username, password) ⇒ Client

Returns a new instance of Client.



12
13
14
# File 'lib/phonegap_build.rb', line 12

def initialize(username, password)
  @client = RestClient::Resource.new API_BASE, username, password
end

Instance Method Details

#action(res, name, more = nil) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/phonegap_build.rb', line 32

def action(res, name, more = nil)
  available = { build: :post, unlock: :post }
  method = available[name.to_sym]
  puts res[name] if ENV['DEBUG']
  if method
    res = res[name]
    res = res[more] if more
    puts "#{method.upcase} #{res}" if ENV['DEBUG']
    res.send(method, data: {})
    true
  else
    false
  end
end

#appsObject



20
21
22
# File 'lib/phonegap_build.rb', line 20

def apps
  ResourceCollection.new(self, @client['apps'], false, 'apps')
end

#keysObject



24
25
26
# File 'lib/phonegap_build.rb', line 24

def keys
  ResourceCollection.new(self, @client['keys'], false, 'keys')
end

#meObject



16
17
18
# File 'lib/phonegap_build.rb', line 16

def me
  Resource.new(self, @client['me'])
end

#parse(text) ⇒ Object



28
29
30
# File 'lib/phonegap_build.rb', line 28

def parse(text)
  JSON.parse(text, object_class: OpenStruct, array_class: Array)
end