Module: Orkut::Client::Base

Included in:
Albums, Comments, Mediaitems, Messages, People, Timelines, Videos
Defined in:
lib/orkut/client/base.rb

Constant Summary collapse

DEFAULT_COUNT =
40
DEFAULT_DATETIME_FORMAT =
'%Y-%m-%dT%H:%M:%SZ'
DEFAULT_LANGUAGE =
'pt_BR'

Instance Method Summary collapse

Instance Method Details

#default_headersObject



15
16
17
18
19
20
# File 'lib/orkut/client/base.rb', line 15

def default_headers
  return {
    Orkut::Constants::InternalConstants::CONTENT_TYPE => Orkut::Constants::InternalConstants::JSON_CONTENT_TYPE,
    Orkut::Constants::InternalConstants::ORKUT_CLIENT_LIB_HEADER => Orkut::Version.to_s
  }
end

#format_datetime(datetime) ⇒ Object



28
29
30
31
32
33
34
35
36
# File 'lib/orkut/client/base.rb', line 28

def format_datetime datetime
  if datetime.kind_of?(Time)
    return datetime.utc.strftime(DEFAULT_DATETIME_FORMAT)
  elsif datetime.kind_of?(String)
    return Time.at(datetime).utc.strftime(DEFAULT_DATETIME_FORMAT)
  else
    raise(Orkut::Error, 'Invalid datetime')
  end
end

#get_refresh_tokenObject



38
39
40
# File 'lib/orkut/client/base.rb', line 38

def get_refresh_token
  get_refresh_access_token
end

#request_idObject



22
23
24
25
26
# File 'lib/orkut/client/base.rb', line 22

def request_id
  @request_id = 0
  @request_id += 1
  @request_id
end