Class: DeployGate::API::V1::Users::Apps::CliWebsockets
- Inherits:
-
Object
- Object
- DeployGate::API::V1::Users::Apps::CliWebsockets
- Defined in:
- lib/deploygate/api/v1/users/apps/cli_websockets.rb
Constant Summary collapse
- ENDPOINT =
"/users/%s/platforms/%s/apps/%s/cli_websockets"
Class Method Summary collapse
- .create(token, name, package_name, distribution_key, platform = 'ios') ⇒ Object
- .heartbeat(token, name, package_name, distribution_key, push_token, platform = 'ios') ⇒ Object
Class Method Details
.create(token, name, package_name, distribution_key, platform = 'ios') ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/deploygate/api/v1/users/apps/cli_websockets.rb', line 6 def create(token, name, package_name, distribution_key, platform = 'ios') params = {distribution_access_key: distribution_key} unless distribution_key.nil? res = DeployGate::API::V1::Base.new(token).post(sprintf(ENDPOINT, name, platform, package_name), params || {}) results = { error: res['error'] } if results[:error] results.merge!( { message: res['message'] } ) else results.merge!( { push_token: res['results']['push_token'], webpush_server: res['results']['webpush_server'], action: res['results']['action'] } ) end results end |
.heartbeat(token, name, package_name, distribution_key, push_token, platform = 'ios') ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/deploygate/api/v1/users/apps/cli_websockets.rb', line 32 def heartbeat(token, name, package_name, distribution_key, push_token, platform = 'ios') params = {distribution_access_key: distribution_key} unless distribution_key.nil? res = DeployGate::API::V1::Base.new(token).get("#{sprintf(ENDPOINT, name, platform, package_name)}/#{push_token}/heartbeat", params || {}) { error: res['error'] } end |