Class: Parse::Installation

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

Overview

Constant Summary collapse

UPDATABLE_FIELDS =
{
  badge: 'badge',
  channels: 'channels',
  time_zone: 'timeZone',
  device_type: 'deviceType',
  push_type: 'pushType',
  gcm_sender_id: 'GCMSenderId',
  device_token: 'deviceToken',
  channel_uris: 'channelUris',
  app_name: 'appName',
  app_version: 'appVersion',
  parse_version: 'parseVersion',
  app_identifier: 'appIdentifier'
}

Instance Attribute Summary collapse

Attributes inherited from Object

#class_name, #created_at, #parse_object_id, #updated_at

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Object

#array_add, #array_add_relation, #array_add_unique, #array_remove, #array_remove_relation, #decrement, #eql?, #hash, #increment, #inspect, #new?, #parse_delete, #pointer, #refresh, #safe_hash, #should_call_to_h?, #to_h, #to_json, #to_s, #update_attributes

Constructor Details

#initialize(parse_object_id, client = nil) ⇒ Installation

Returns a new instance of Installation.



28
29
30
31
# File 'lib/parse/installation.rb', line 28

def initialize(parse_object_id, client = nil)
  @parse_object_id = parse_object_id
  @client = client || Parse.client
end

Instance Attribute Details

#clientObject

Returns the value of attribute client.



11
12
13
# File 'lib/parse/installation.rb', line 11

def client
  @client
end

Class Method Details

.get(parse_object_id, parse_client = nil) ⇒ Object



33
34
35
36
# File 'lib/parse/installation.rb', line 33

def self.get(parse_object_id, parse_client = nil)
  parse_client ||= Parse.client
  new(parse_object_id, parse_client).get
end

Instance Method Details

#getObject



38
39
40
41
# File 'lib/parse/installation.rb', line 38

def get
  response = client.request(uri, :get, nil, nil)
  parse Parse.parse_json(nil, response) if response
end

#methodObject



61
62
63
# File 'lib/parse/installation.rb', line 61

def method
  @parse_object_id ? :put : :post
end

#rest_api_hashObject



57
58
59
# File 'lib/parse/installation.rb', line 57

def rest_api_hash
  self
end

#saveObject



53
54
55
# File 'lib/parse/installation.rb', line 53

def save
  client.request uri, method, to_json, nil
end

#uriObject



49
50
51
# File 'lib/parse/installation.rb', line 49

def uri
  Protocol.installation_uri @parse_object_id
end