Class: Snapfish::Base

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

Direct Known Subclasses

Album, AlbumCollection, Asset

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json = {}) ⇒ Base

Returns a new instance of Base.



5
6
7
# File 'lib/snapfish/base.rb', line 5

def initialize(json = {})
  @json = json
end

Instance Attribute Details

#jsonObject (readonly)

Returns the value of attribute json.



3
4
5
# File 'lib/snapfish/base.rb', line 3

def json
  @json
end

Class Method Details

.connectionObject



13
14
15
# File 'lib/snapfish/base.rb', line 13

def self.connection
  @@connection
end

.connection=(connection) ⇒ Object



9
10
11
# File 'lib/snapfish/base.rb', line 9

def self.connection=(connection)
  @@connection = connection
end

Instance Method Details

#created_atObject



17
18
19
20
21
22
# File 'lib/snapfish/base.rb', line 17

def created_at
  create_date = json['createDate']
  if create_date
    Time.at(create_date / 1000, create_date % 1000)
  end
end

#updated_atObject



24
25
26
27
28
29
# File 'lib/snapfish/base.rb', line 24

def updated_at
  update_date = json['updateDate']
  if update_date
    Time.at(update_date / 1000, update_date % 1000)
  end
end