Module: PhoneGap::Build

Defined in:
lib/phone_gap/build.rb,
lib/phone_gap/build/app.rb,
lib/phone_gap/build/base.rb,
lib/phone_gap/build/error.rb,
lib/phone_gap/build/version.rb,
lib/phone_gap/build/creatable.rb,
lib/phone_gap/build/api_request.rb,
lib/phone_gap/build/app_factory.rb,
lib/phone_gap/build/credentials.rb,
lib/phone_gap/build/rest_resource.rb,
lib/phone_gap/build/package_downloader.rb

Defined Under Namespace

Modules: Creatable Classes: ApiRequest, App, AppFactory, Base, BuildError, Credentials, Error, PackageDownloader, RestResource

Constant Summary collapse

VERSION =
'0.7.0'

Class Method Summary collapse

Class Method Details

.appsObject



21
22
23
24
25
26
27
28
29
# File 'lib/phone_gap/build.rb', line 21

def self.apps
  if credentials?
    http_response = HTTParty.get("https://build.phonegap.com/api/v1/apps?auth_token=#{@credentials.token}")
    parsed_response = JSON.parse(http_response.body)
    AppFactory.create_many(parsed_response)
  else
    Error.new(message: 'Api credentials not found. Set them or add thmem to config/phonegap.yml')
  end
end

.credentials(credentials) ⇒ Object



17
18
19
# File 'lib/phone_gap/build.rb', line 17

def self.credentials(credentials)
  @credentials = Credentials.instance.set(credentials)
end

.credentials?Boolean

Returns:

  • (Boolean)


31
32
33
34
35
36
37
# File 'lib/phone_gap/build.rb', line 31

def self.credentials?
  if @credentials && @credentials.token
    true
  else
    Credentials.instance.load
  end
end