Class: CloudRailSi::Services::Facebook

Inherits:
Object
  • Object
show all
Defined in:
lib/cloudrail_si/services/Facebook.rb

Constant Summary collapse

SERVICE_CODE =
{
  
    "init" => [
      [ "set", "$P0.boundary", "Amgrmg43ghg3g39glv0k2ldk"]
      
    ],
  
    "AdvancedRequestSupporter:advancedRequest" => [
      [ "create", "$L0", "Object"],
      [ "create", "$L0.url", "String"],
      [ "if!=than", "$P2.appendBaseUrl", 0, 1],
      [ "set", "$L0.url", "https://graph.facebook.com"],
      [ "string.concat", "$L0.url", "$L0.url", "$P2.url"],
      [ "set", "$L0.requestHeaders", "$P2.headers"],
      [ "set", "$L0.method", "$P2.method"],
      [ "set", "$L0.requestBody", "$P2.body"],
      [ "if!=than", "$P2.appendAuthorization", 0, 2],
      [ "callFunc", "checkAuthentication", "$P0"],
      [ "string.concat", "$L0.requestHeaders.Authorization", "Bearer ", "$S0.accessToken"],
      [ "http.requestCall", "$L1", "$L0"],
      [ "if!=than", "$P2.checkErrors", 0, 1],
      [ "callFunc", "validateResponse", "$P0", "$L1"],
      [ "create", "$P1", "AdvancedRequestResponse"],
      [ "set", "$P1.status", "$L1.code"],
      [ "set", "$P1.headers", "$L1.responseHeaders"],
      [ "set", "$P1.body", "$L1.responseBody"]
      
    ],
  
    "Social:postUpdate" => [
      [ "if==than", "$P1", nil, 2],
      [ "create", "$L0", "Error", "The content is not allowed to be null.", "IllegalArgument"],
      [ "throwError", "$L0"],
      [ "callFunc", "checkAuthentication", "$P0"],
      [ "create", "$L3", "String"],
      [ "string.urlEncode", "$L3", "$P1"],
      [ "create", "$L0", "Object"],
      [ "set", "$L0.method", "POST"],
      [ "create", "$L1", "String"],
      [ "string.concat", "$L1", "https://graph.facebook.com/v2.8/me/feed?message=", "$L3"],
      [ "set", "$L0.url", "$L1"],
      [ "create", "$L0.requestHeaders", "Object"],
      [ "string.concat", "$L0.requestHeaders.Authorization", "Bearer ", "$S0.accessToken"],
      [ "create", "$L2", "Object"],
      [ "http.requestCall", "$L2", "$L0"],
      [ "callFunc", "validateResponse", "$P0", "$L2"]
      
    ],
  
    "Social:postImage" => [
      [ "if==than", "$P1", nil, 2],
      [ "create", "$L0", "Error", "The message is not allowed to be null.", "IllegalArgument"],
      [ "throwError", "$L0"],
      [ "if==than", "$P2", nil, 2],
      [ "create", "$L0", "Error", "The image is not allowed to be null.", "IllegalArgument"],
      [ "throwError", "$L0"],
      [ "callFunc", "checkAuthentication", "$P0"],
      [ "create", "$L0", "Object"],
      [ "set", "$L0.method", "POST"],
      [ "set", "$L0.url", "https://graph.facebook.com/v2.8/me/photos"],
      [ "create", "$L0.requestHeaders", "Object"],
      [ "string.concat", "$L0.requestHeaders.Content-Type", "multipart/form-data; boundary=", "$P0.boundary"],
      [ "string.concat", "$L0.requestHeaders.Authorization", "Bearer ", "$S0.accessToken"],
      [ "string.concat", "$L1", "--", "$P0.boundary", "\r\n"],
      [ "string.concat", "$L1", "$L1", "Content-Disposition: form-data; name=\"caption\"\r\n\r\n"],
      [ "string.concat", "$L1", "$L1", "$P1", "\r\n"],
      [ "string.concat", "$L1", "$L1", "--", "$P0.boundary", "\r\n"],
      [ "string.concat", "$L1", "$L1", "Content-Disposition: form-data; name=\"source\"; filename=\"somename\"\r\n"],
      [ "string.concat", "$L1", "$L1", "Content-Transfer-Encoding: binary\r\n\r\n"],
      [ "stream.stringToStream", "$L1", "$L1"],
      [ "string.concat", "$L2", "\r\n--", "$P0.boundary", "--"],
      [ "stream.stringToStream", "$L2", "$L2"],
      [ "stream.makeJoinedStream", "$L0.requestBody", "$L1", "$P2", "$L2"],
      [ "http.requestCall", "$L4", "$L0"],
      [ "callFunc", "validateResponse", "$P0", "$L4"]
      
    ],
  
    "Social:postVideo" => [
      [ "if==than", "$P1", nil, 2],
      [ "create", "$L0", "Error", "The message is not allowed to be null.", "IllegalArgument"],
      [ "throwError", "$L0"],
      [ "if==than", "$P2", nil, 2],
      [ "create", "$L0", "Error", "The image is not allowed to be null.", "IllegalArgument"],
      [ "throwError", "$L0"],
      [ "callFunc", "checkAuthentication", "$P0"],
      [ "create", "$L0", "Object"],
      [ "set", "$L0.method", "POST"],
      [ "set", "$L0.url", "https://graph-video.facebook.com/v2.8/me/videos"],
      [ "string.indexOf", "$L20", "$P4", "/"],
      [ "math.add", "$L20", "$L20", 1],
      [ "string.substring", "$L21", "$P4", "$L20"],
      [ "create", "$L0.requestHeaders", "Object"],
      [ "string.concat", "$L0.requestHeaders.Content-Type", "multipart/form-data; boundary=", "$P0.boundary"],
      [ "string.concat", "$L0.requestHeaders.Authorization", "Bearer ", "$S0.accessToken"],
      [ "string.concat", "$L1", "--", "$P0.boundary", "\r\n"],
      [ "string.concat", "$L1", "$L1", "Content-Disposition: form-data; name=\"description\"\r\n\r\n"],
      [ "string.concat", "$L1", "$L1", "$P1", "\r\n"],
      [ "string.concat", "$L1", "$L1", "--", "$P0.boundary", "\r\n"],
      [ "string.concat", "$L1", "$L1", "Content-Disposition: form-data; name=\"source\"; filename=\"somename.", "$L21", "\"\r\n"],
      [ "string.concat", "$L1", "$L1", "Content-Transfer-Encoding: binary\r\n\r\n"],
      [ "stream.stringToStream", "$L1", "$L1"],
      [ "string.concat", "$L2", "\r\n--", "$P0.boundary", "--"],
      [ "stream.stringToStream", "$L2", "$L2"],
      [ "stream.makeJoinedStream", "$L0.requestBody", "$L1", "$P2", "$L2"],
      [ "http.requestCall", "$L4", "$L0"],
      [ "callFunc", "validateResponse", "$P0", "$L4"]
      
    ],
  
    "Social:getConnections" => [
      [ "callFunc", "checkAuthentication", "$P0"],
      [ "create", "$L0", "Object"],
      [ "set", "$L0.method", "GET"],
      [ "create", "$L1", "String"],
      [ "string.concat", "$L1", "https://graph.facebook.com/v2.8/me/friends"],
      [ "set", "$L0.url", "$L1"],
      [ "create", "$L0.requestHeaders", "Object"],
      [ "string.concat", "$L0.requestHeaders.Authorization", "Bearer ", "$S0.accessToken"],
      [ "create", "$L2", "Object"],
      [ "http.requestCall", "$L2", "$L0"],
      [ "callFunc", "validateResponse", "$P0", "$L2"],
      [ "create", "$L3", "String"],
      [ "stream.streamToString", "$L3", "$L2.responseBody"],
      [ "json.parse", "$L4", "$L3"],
      [ "create", "$L9", "Number"],
      [ "size", "$L9", "$L4.data"],
      [ "create", "$P1", "Array"],
      [ "if!=than", "$L9", 0, 11],
      [ "set", "$L5", "$L4.data.items"],
      [ "create", "$L6", "Number"],
      [ "size", "$L6", "$L5"],
      [ "create", "$L7", "Number", 0],
      [ "if<than", "$L7", "$L6", 6],
      [ "create", "$L8", "Object"],
      [ "get", "$L8", "$L5", "$L7"],
      [ "string.concat", "$L9", "facebook-", "$L8.id"],
      [ "push", "$P1", "$L9"],
      [ "math.add", "$L7", "$L7", 1],
      [ "jumpRel", -7]
      
    ],
  
    "Authenticating:login" => [
      [ "callFunc", "checkAuthentication", "$P0"]
      
    ],
  
    "Authenticating:logout" => [
      [ "set", "$P0.userInfo", nil],
      [ "if!=than", "$S0.accessToken", nil, 10],
      [ "create", "$L0", "Object"],
      [ "set", "$L0.method", "DELETE"],
      [ "create", "$L1", "String"],
      [ "string.concat", "$L1", "https://graph.facebook.com/v2.8/me/permissions"],
      [ "set", "$L0.url", "$L1"],
      [ "create", "$L0.requestHeaders", "Object"],
      [ "string.concat", "$L0.requestHeaders.Authorization", "Bearer ", "$S0.accessToken"],
      [ "create", "$L2", "Object"],
      [ "http.requestCall", "$L2", "$L0"],
      [ "callFunc", "validateResponse", "$P0", "$L2"]
      
    ],
  
    "Profile:getIdentifier" => [
      [ "callFunc", "checkUserInfo", "$P0"],
      [ "string.concat", "$P1", "facebook-", "$P0.userInfo.id"]
      
    ],
  
    "Profile:getFullName" => [
      [ "callFunc", "checkUserInfo", "$P0"],
      [ "if!=than", "$P0.userInfo.name", nil, 1],
      [ "set", "$P1", "$P0.userInfo.name"]
      
    ],
  
    "Profile:getEmail" => [
      [ "callFunc", "checkUserInfo", "$P0"],
      [ "if!=than", "$P0.userInfo.email", nil, 1],
      [ "set", "$P1", "$P0.userInfo.email"]
      
    ],
  
    "Profile:getGender" => [
      [ "callFunc", "checkUserInfo", "$P0"],
      [ "if!=than", "$P0.userInfo.gender", nil, 7],
      [ "if==than", "$P0.userInfo.gender", "male", 2],
      [ "set", "$P1", "$P0.userInfo.gender"],
      [ "return"],
      [ "if==than", "$P0.userInfo.gender", "female", 2],
      [ "set", "$P1", "$P0.userInfo.gender"],
      [ "return"],
      [ "set", "$P1", "other"]
      
    ],
  
    "Profile:getDescription" => [
      [ "callFunc", "checkUserInfo", "$P0"],
      [ "if!=than", "$P0.userInfo.about", nil, 1],
      [ "set", "$P1", "$P0.userInfo.about"]
      
    ],
  
    "Profile:getDateOfBirth" => [
      [ "callFunc", "checkUserInfo", "$P0"],
      [ "create", "$P1", "DateOfBirth"],
      [ "if!=than", "$P0.userInfo.birthday", nil, 10],
      [ "string.split", "$L0", "$P0.userInfo.birthday", "/"],
      [ "get", "$L1", "$L0", 0],
      [ "if!=than", "$L1", "00", 1],
      [ "math.add", "$P1.month", "$L1", 0],
      [ "get", "$L1", "$L0", 1],
      [ "if!=than", "$L1", "00", 1],
      [ "math.add", "$P1.day", "$L1", 0],
      [ "get", "$L1", "$L0", 2],
      [ "if!=than", "$L1", "0000", 1],
      [ "math.add", "$P1.year", "$L1", 0]
      
    ],
  
    "Profile:getLocale" => [
      [ "callFunc", "checkUserInfo", "$P0"],
      [ "if!=than", "$P0.userInfo.locale", nil, 3],
      [ "create", "$L1", "String"],
      [ "string.substring", "$L1", "$P0.userInfo.locale", 0, 2],
      [ "set", "$P1", "$L1"]
      
    ],
  
    "Profile:getPictureURL" => [
      [ "callFunc", "checkUserInfo", "$P0"],
      [ "if!=than", "$P0.userInfo.picture.data.url", nil, 1],
      [ "set", "$P1", "$P0.userInfo.picture.data.url"]
      
    ],
  
    "checkUserInfo" => [
      [ "create", "$L0", "Date"],
      [ "if!=than", "$P0.userInfo", nil, 2],
      [ "if>than", "$P0.expirationTime", "$L0", 1],
      [ "return"],
      [ "callFunc", "checkAuthentication", "$P0"],
      [ "create", "$L2", "Object"],
      [ "set", "$L2.url", "https://graph.facebook.com/v2.8/me?fields=locale,gender,name,birthday,email,about"],
      [ "create", "$L2.requestHeaders", "Object"],
      [ "string.concat", "$L2.requestHeaders.Authorization", "Bearer ", "$S0.accessToken"],
      [ "set", "$L2.method", "GET"],
      [ "http.requestCall", "$L3", "$L2"],
      [ "callFunc", "validateResponse", "$P0", "$L3"],
      [ "json.parse", "$P0.userInfo", "$L3.responseBody"],
      [ "create", "$L2", "Object"],
      [ "set", "$L2.url", "https://graph.facebook.com/v2.8/me/picture?fields=url&type=large&redirect=false"],
      [ "create", "$L2.requestHeaders", "Object"],
      [ "string.concat", "$L2.requestHeaders.Authorization", "Bearer ", "$S0.accessToken"],
      [ "set", "$L2.method", "GET"],
      [ "http.requestCall", "$L3", "$L2"],
      [ "callFunc", "validateResponse", "$P0", "$L3"],
      [ "json.parse", "$L4", "$L3.responseBody"],
      [ "set", "$P0.userInfo.picture", "$L4"],
      [ "create", "$P0.expirationTime", "Date"],
      [ "math.add", "$P0.expirationTime.time", "$P0.expirationTime.time", 60000]
      
    ],
  
    "checkAuthentication" => [
      [ "create", "$L0", "Date"],
      [ "if==than", "$S0.accessToken", nil, 2],
      [ "callFunc", "authenticate", "$P0"],
      [ "return"],
      [ "create", "$L1", "Date"],
      [ "set", "$L1.time", "$S0.expireIn"],
      [ "if<than", "$L1", "$L0", 1],
      [ "callFunc", "authenticate", "$P0"]
      
    ],
  
    "authenticate" => [
      [ "create", "$L0", "String"],
      [ "create", "$L1", "String"],
      [ "string.urlEncode", "$L3", "$P0.redirectUri"],
      [ "string.concat", "$L0", "https://www.facebook.com/dialog/oauth?response_type=code&client_id=", "$P0.clientID", "&redirect_uri=", "$L3", "&state=", "$P0.state", "&scope=public_profile%2Cemail%2Cuser_birthday%2Cuser_about_me%2Cpublish_actions%2Cuser_friends%2Cuser_photos"],
      [ "awaitCodeRedirect", "$L2", "$L0"],
      [ "string.concat", "$L1", "https://graph.facebook.com/v2.8/oauth/access_token?client_id=", "$P0.clientID", "&redirect_uri=", "$L3", "&client_secret=", "$P0.clientSecret", "&code=", "$L2"],
      [ "create", "$L5", "Object"],
      [ "set", "$L5.url", "$L1"],
      [ "set", "$L5.method", "GET"],
      [ "http.requestCall", "$L6", "$L5"],
      [ "callFunc", "validateResponse", "$P0", "$L6"],
      [ "stream.streamToString", "$L7", "$L6.responseBody"],
      [ "json.parse", "$L8", "$L7"],
      [ "set", "$S0.accessToken", "$L8.access_token"],
      [ "create", "$L0", "Object"],
      [ "set", "$L0.method", "GET"],
      [ "string.concat", "$L0.url", "https://graph.facebook.com/v2.8/oauth/access_token?client_id=", "$P0.clientID", "&client_secret=", "$P0.clientSecret", "&grant_type=fb_exchange_token&fb_exchange_token=", "$S0.accessToken"],
      [ "http.requestCall", "$L1", "$L0"],
      [ "callFunc", "validateResponse", "$P0", "$L1"],
      [ "json.parse", "$L2", "$L1.responseBody"],
      [ "set", "$S0.accessToken", "$L2.access_token"],
      [ "create", "$L10", "Date"],
      [ "math.multiply", "$L9", 60, 24, 60, 60, 1000],
      [ "math.add", "$L9", "$L9", "$L10.time", -60000],
      [ "set", "$S0.expireIn", "$L9"]
      
    ],
  
    "validateResponse" => [
      [ "if>=than", "$P1.code", 400, 3],
      [ "stream.streamToString", "$L2", "$P1.responseBody"],
      [ "create", "$L3", "Error", "$L2", "Http"],
      [ "throwError", "$L3"]
      
    ]
  
}

Instance Method Summary collapse

Constructor Details

#initialize(redirect_receiver, client_id, client_secret, redirect_uri, state) ⇒ Facebook

Returns a new instance of Facebook.



327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
# File 'lib/cloudrail_si/services/Facebook.rb', line 327

def initialize(redirect_receiver, client_id, client_secret, redirect_uri, state)
    @interpreter_storage = {}
    @persistent_storage = [{}]
    @instance_dependency_storage = {
        redirect_receiver: redirect_receiver
    }

    ServiceCode::InitSelfTest.init_test('Facebook')

    @interpreter_storage['clientID'] = client_id
    @interpreter_storage['clientSecret'] = client_secret
    @interpreter_storage['redirectUri'] = redirect_uri
    @interpreter_storage['state'] = state
    

    

    # call init servicecode function
    ip = ServiceCode::Interpreter.new(ServiceCode::Sandbox.new(SERVICE_CODE, @persistent_storage, @instance_dependency_storage))
    # check and call the initialization function if is available

    ip.call_function_sync('init', @interpreter_storage) if (SERVICE_CODE['init'])
end

Instance Method Details

#advanced_request(specification) ⇒ Object



462
463
464
465
466
467
468
469
# File 'lib/cloudrail_si/services/Facebook.rb', line 462

def advanced_request(specification)
  ServiceCode::Statistics.add_call('Facebook', 'advanced_request')
  ip = ServiceCode::Interpreter.new(ServiceCode::Sandbox.new(SERVICE_CODE, @persistent_storage, @instance_dependency_storage))
  ip.call_function('AdvancedRequestSupporter:advancedRequest', @interpreter_storage, nil, specification)

  check_for_error(ip.sandbox.thrown_error)
  return nil || ip.get_parameter(1)
end

#check_for_error(error) ⇒ Object



351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
# File 'lib/cloudrail_si/services/Facebook.rb', line 351

def check_for_error(error)
  if (error)
    ServiceCode::Statistics.add_error('Facebook', '')
    case (error.type)
    when 'IllegalArgument'
      raise Errors::IllegalArgumentError.new(error.message)
    when 'Authentication'
      raise Errors::AuthenticationError.new(error.message)
    when 'NotFound'
      raise Errors::NotFoundError.new(error.message)
    when 'Http'
      raise Errors::HttpError.new(error.message)
    when 'ServiceUnavailable'
      raise Errors::ServiceUnavailableError.new(error.message)
    else
      raise Errors::StandardError.new(error.message)
    end
  end
end

#get_connectionsObject



498
499
500
501
502
503
504
505
# File 'lib/cloudrail_si/services/Facebook.rb', line 498

def get_connections()
  ServiceCode::Statistics.add_call('Facebook', 'get_connections')
  ip = ServiceCode::Interpreter.new(ServiceCode::Sandbox.new(SERVICE_CODE, @persistent_storage, @instance_dependency_storage))
  ip.call_function('Social:getConnections', @interpreter_storage, nil)

  check_for_error(ip.sandbox.thrown_error)
  return nil || ip.get_parameter(1)
end

#get_date_of_birthObject



417
418
419
420
421
422
423
424
# File 'lib/cloudrail_si/services/Facebook.rb', line 417

def get_date_of_birth()
  ServiceCode::Statistics.add_call('Facebook', 'get_date_of_birth')
  ip = ServiceCode::Interpreter.new(ServiceCode::Sandbox.new(SERVICE_CODE, @persistent_storage, @instance_dependency_storage))
  ip.call_function('Profile:getDateOfBirth', @interpreter_storage, nil)

  check_for_error(ip.sandbox.thrown_error)
  return nil || ip.get_parameter(1)
end

#get_descriptionObject



408
409
410
411
412
413
414
415
# File 'lib/cloudrail_si/services/Facebook.rb', line 408

def get_description()
  ServiceCode::Statistics.add_call('Facebook', 'get_description')
  ip = ServiceCode::Interpreter.new(ServiceCode::Sandbox.new(SERVICE_CODE, @persistent_storage, @instance_dependency_storage))
  ip.call_function('Profile:getDescription', @interpreter_storage, nil)

  check_for_error(ip.sandbox.thrown_error)
  return nil || ip.get_parameter(1)
end

#get_emailObject



390
391
392
393
394
395
396
397
# File 'lib/cloudrail_si/services/Facebook.rb', line 390

def get_email()
  ServiceCode::Statistics.add_call('Facebook', 'get_email')
  ip = ServiceCode::Interpreter.new(ServiceCode::Sandbox.new(SERVICE_CODE, @persistent_storage, @instance_dependency_storage))
  ip.call_function('Profile:getEmail', @interpreter_storage, nil)

  check_for_error(ip.sandbox.thrown_error)
  return nil || ip.get_parameter(1)
end

#get_full_nameObject



381
382
383
384
385
386
387
388
# File 'lib/cloudrail_si/services/Facebook.rb', line 381

def get_full_name()
  ServiceCode::Statistics.add_call('Facebook', 'get_full_name')
  ip = ServiceCode::Interpreter.new(ServiceCode::Sandbox.new(SERVICE_CODE, @persistent_storage, @instance_dependency_storage))
  ip.call_function('Profile:getFullName', @interpreter_storage, nil)

  check_for_error(ip.sandbox.thrown_error)
  return nil || ip.get_parameter(1)
end

#get_genderObject



399
400
401
402
403
404
405
406
# File 'lib/cloudrail_si/services/Facebook.rb', line 399

def get_gender()
  ServiceCode::Statistics.add_call('Facebook', 'get_gender')
  ip = ServiceCode::Interpreter.new(ServiceCode::Sandbox.new(SERVICE_CODE, @persistent_storage, @instance_dependency_storage))
  ip.call_function('Profile:getGender', @interpreter_storage, nil)

  check_for_error(ip.sandbox.thrown_error)
  return nil || ip.get_parameter(1)
end

#get_identifierObject



372
373
374
375
376
377
378
379
# File 'lib/cloudrail_si/services/Facebook.rb', line 372

def get_identifier()
  ServiceCode::Statistics.add_call('Facebook', 'get_identifier')
  ip = ServiceCode::Interpreter.new(ServiceCode::Sandbox.new(SERVICE_CODE, @persistent_storage, @instance_dependency_storage))
  ip.call_function('Profile:getIdentifier', @interpreter_storage, nil)

  check_for_error(ip.sandbox.thrown_error)
  return nil || ip.get_parameter(1)
end

#get_localeObject



426
427
428
429
430
431
432
433
# File 'lib/cloudrail_si/services/Facebook.rb', line 426

def get_locale()
  ServiceCode::Statistics.add_call('Facebook', 'get_locale')
  ip = ServiceCode::Interpreter.new(ServiceCode::Sandbox.new(SERVICE_CODE, @persistent_storage, @instance_dependency_storage))
  ip.call_function('Profile:getLocale', @interpreter_storage, nil)

  check_for_error(ip.sandbox.thrown_error)
  return nil || ip.get_parameter(1)
end

#get_picture_urlObject



435
436
437
438
439
440
441
442
# File 'lib/cloudrail_si/services/Facebook.rb', line 435

def get_picture_url()
  ServiceCode::Statistics.add_call('Facebook', 'get_picture_url')
  ip = ServiceCode::Interpreter.new(ServiceCode::Sandbox.new(SERVICE_CODE, @persistent_storage, @instance_dependency_storage))
  ip.call_function('Profile:getPictureURL', @interpreter_storage, nil)

  check_for_error(ip.sandbox.thrown_error)
  return nil || ip.get_parameter(1)
end

#load_as_string(saved_state) ⇒ Object



513
514
515
516
517
518
# File 'lib/cloudrail_si/services/Facebook.rb', line 513

def load_as_string(saved_state)
	sandbox = ServiceCode::Sandbox.new(SERVICE_CODE, @persistent_storage, @instance_dependency_storage)
	ip = ServiceCode::Interpreter.new(sandbox)
	ip.load_as_string(saved_state)
	@persistent_storage = sandbox.persistent_storage
end

#loginObject



444
445
446
447
448
449
450
451
# File 'lib/cloudrail_si/services/Facebook.rb', line 444

def ()
  ServiceCode::Statistics.add_call('Facebook', 'login')
  ip = ServiceCode::Interpreter.new(ServiceCode::Sandbox.new(SERVICE_CODE, @persistent_storage, @instance_dependency_storage))
  ip.call_function('Authenticating:login', @interpreter_storage)

  check_for_error(ip.sandbox.thrown_error)
  return nil
end

#logoutObject



453
454
455
456
457
458
459
460
# File 'lib/cloudrail_si/services/Facebook.rb', line 453

def logout()
  ServiceCode::Statistics.add_call('Facebook', 'logout')
  ip = ServiceCode::Interpreter.new(ServiceCode::Sandbox.new(SERVICE_CODE, @persistent_storage, @instance_dependency_storage))
  ip.call_function('Authenticating:logout', @interpreter_storage)

  check_for_error(ip.sandbox.thrown_error)
  return nil
end

#post_image(message, image) ⇒ Object



480
481
482
483
484
485
486
487
# File 'lib/cloudrail_si/services/Facebook.rb', line 480

def post_image(message, image)
  ServiceCode::Statistics.add_call('Facebook', 'post_image')
  ip = ServiceCode::Interpreter.new(ServiceCode::Sandbox.new(SERVICE_CODE, @persistent_storage, @instance_dependency_storage))
  ip.call_function('Social:postImage', @interpreter_storage, message, image)

  check_for_error(ip.sandbox.thrown_error)
  return nil
end

#post_update(content) ⇒ Object



471
472
473
474
475
476
477
478
# File 'lib/cloudrail_si/services/Facebook.rb', line 471

def post_update(content)
  ServiceCode::Statistics.add_call('Facebook', 'post_update')
  ip = ServiceCode::Interpreter.new(ServiceCode::Sandbox.new(SERVICE_CODE, @persistent_storage, @instance_dependency_storage))
  ip.call_function('Social:postUpdate', @interpreter_storage, content)

  check_for_error(ip.sandbox.thrown_error)
  return nil
end

#post_video(message, video, size, mime_type) ⇒ Object



489
490
491
492
493
494
495
496
# File 'lib/cloudrail_si/services/Facebook.rb', line 489

def post_video(message, video, size, mime_type)
  ServiceCode::Statistics.add_call('Facebook', 'post_video')
  ip = ServiceCode::Interpreter.new(ServiceCode::Sandbox.new(SERVICE_CODE, @persistent_storage, @instance_dependency_storage))
  ip.call_function('Social:postVideo', @interpreter_storage, message, video, size, mime_type)

  check_for_error(ip.sandbox.thrown_error)
  return nil
end

#resume_login(execution_state, callback) ⇒ Object



520
521
522
523
524
525
# File 'lib/cloudrail_si/services/Facebook.rb', line 520

def (execution_state, callback)
  sandbox = ServiceCode::Sandbox.new(SERVICE_CODE, @persistent_storage, @instance_dependency_storage)
  sandbox.load_state_from_string(execution_state)
  ip = ServiceCode::Interpreter.new(sandbox)
  ip.resume_function('Authenticating:login', @interpreter_storage, callback)
end

#save_as_stringObject



508
509
510
511
# File 'lib/cloudrail_si/services/Facebook.rb', line 508

def save_as_string
	ip = ServiceCode::Interpreter.new(ServiceCode::Sandbox.new(SERVICE_CODE, @persistent_storage, @instance_dependency_storage))
	return ip.save_as_string()
end