plataforma_social 0.0.13 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. data/.DS_Store +0 -0
  2. data/.rspec +1 -0
  3. data/CHANGELOG.rdoc +4 -0
  4. data/Gemfile +4 -1
  5. data/lib/plataforma_social.rb +5 -0
  6. data/lib/plataforma_social/badge.rb +61 -0
  7. data/lib/plataforma_social/domains.rb +1 -1
  8. data/lib/plataforma_social/helpers.rb +9 -5
  9. data/lib/plataforma_social/ranking.rb +91 -0
  10. data/lib/plataforma_social/ranking/custom.rb +28 -0
  11. data/lib/plataforma_social/ranking/general.rb +22 -0
  12. data/lib/plataforma_social/request.rb +4 -14
  13. data/lib/plataforma_social/support.rb +25 -0
  14. data/lib/plataforma_social/version.rb +1 -1
  15. data/plataforma_social.gemspec +6 -0
  16. data/spec/.DS_Store +0 -0
  17. data/spec/cassettes/PlataformaSocial_Badge/CREATE_a_new_badge/when_request_is_successful.yml +51 -0
  18. data/spec/cassettes/PlataformaSocial_Badge/GIVE_points_to_user/when_request_is_successful_and_badges_is_array.yml +99 -0
  19. data/spec/cassettes/PlataformaSocial_Badge/GIVE_points_to_user/when_request_is_successful_and_badges_is_hash.yml +101 -0
  20. data/spec/cassettes/PlataformaSocial_Badge/return_INDEX_to_user/when_request_is_successful_and_user_has_already_earned_some_badge.yml +204 -0
  21. data/spec/cassettes/PlataformaSocial_Badge/return_INDEX_to_user/when_request_is_successful_but_user_hasnt_earned_any_badge.yml +202 -0
  22. data/spec/cassettes/PlataformaSocial_Ranking/GET_friends/when_request_is_successful/with_limit_param.yml +48 -0
  23. data/spec/cassettes/PlataformaSocial_Ranking/GET_friends/when_request_is_successful/with_page_and_limit_param.yml +48 -0
  24. data/spec/cassettes/PlataformaSocial_Ranking/GET_friends/when_request_is_successful/with_page_param.yml +48 -0
  25. data/spec/cassettes/PlataformaSocial_Ranking/GET_window/when_request_is_successful/with_date_params.yml +96 -0
  26. data/spec/cassettes/PlataformaSocial_Ranking/GET_window/when_request_is_successful/with_down_param.yml +48 -0
  27. data/spec/cassettes/PlataformaSocial_Ranking/GET_window/when_request_is_successful/with_friends_param.yml +192 -0
  28. data/spec/cassettes/PlataformaSocial_Ranking/GET_window/when_request_is_successful/with_limit_param.yml +48 -0
  29. data/spec/cassettes/PlataformaSocial_Ranking/GET_window/when_request_is_successful/with_up_and_down_param.yml +192 -0
  30. data/spec/cassettes/PlataformaSocial_Ranking/GET_window/when_request_is_successful/with_up_param.yml +192 -0
  31. data/spec/cassettes/PlataformaSocial_Ranking/GET_window/when_request_is_successful/without_up_and_down_param.yml +192 -0
  32. data/spec/cassettes/PlataformaSocial_Ranking/create_a_new_ranking/when_request_is_successful.yml +51 -0
  33. data/spec/cassettes/PlataformaSocial_Ranking/create_a_new_ranking/when_request_is_successful/for_custom_date_ranking.yml +51 -0
  34. data/spec/cassettes/PlataformaSocial_Ranking/create_a_new_ranking/when_request_is_successful/for_general_ranking.yml +51 -0
  35. data/spec/cassettes/PlataformaSocial_Ranking/create_a_new_ranking/when_request_is_successful/using_max_param_ranking.yml +51 -0
  36. data/spec/cassettes/PlataformaSocial_Ranking/create_a_new_ranking/when_request_is_successful/using_min_and_max_params_ranking.yml +51 -0
  37. data/spec/cassettes/PlataformaSocial_Ranking/create_a_new_ranking/when_request_is_successful/using_min_param_ranking.yml +51 -0
  38. data/spec/cassettes/PlataformaSocial_Ranking_Custom/GET_custom_ranking/when_request_is_successful/using_another_dates.yml +288 -0
  39. data/spec/cassettes/PlataformaSocial_Ranking_Custom/GET_custom_ranking/when_request_is_successful/using_corrects_params.yml +288 -0
  40. data/spec/cassettes/PlataformaSocial_Ranking_Custom/GET_custom_ranking/when_request_is_successful/using_params_user_reference_and_friends.yml +288 -0
  41. data/spec/cassettes/PlataformaSocial_Ranking_General/GET_full_ranking/return_all_ranking.yml +48 -0
  42. data/spec/dummy/.DS_Store +0 -0
  43. data/spec/dummy/.gitignore +16 -0
  44. data/spec/dummy/Gemfile +45 -0
  45. data/spec/dummy/README.rdoc +28 -0
  46. data/spec/dummy/Rakefile +6 -0
  47. data/spec/dummy/app/assets/javascripts/application.js +16 -0
  48. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  49. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  50. data/spec/dummy/{log/development.log → app/controllers/concerns/.keep} +0 -0
  51. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  52. data/spec/dummy/app/mailers/.keep +0 -0
  53. data/spec/dummy/app/models/.keep +0 -0
  54. data/spec/dummy/app/models/concerns/.keep +0 -0
  55. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  56. data/spec/dummy/bin/bundle +3 -0
  57. data/spec/dummy/bin/rails +4 -0
  58. data/spec/dummy/bin/rake +4 -0
  59. data/spec/dummy/config.ru +4 -0
  60. data/spec/dummy/config/application.rb +14 -0
  61. data/spec/dummy/config/boot.rb +4 -0
  62. data/spec/dummy/config/database.yml +25 -0
  63. data/spec/dummy/config/environment.rb +5 -0
  64. data/spec/dummy/config/environments/development.rb +37 -0
  65. data/spec/dummy/config/environments/production.rb +80 -0
  66. data/spec/dummy/config/environments/test.rb +44 -0
  67. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  68. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  69. data/spec/dummy/config/initializers/inflections.rb +16 -0
  70. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  71. data/spec/dummy/config/initializers/secret_token.rb +12 -0
  72. data/spec/dummy/config/initializers/session_store.rb +3 -0
  73. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  74. data/spec/dummy/config/locales/en.yml +23 -0
  75. data/spec/dummy/config/routes.rb +49 -0
  76. data/spec/dummy/db/seeds.rb +7 -0
  77. data/spec/dummy/keys/public.pem +5 -0
  78. data/spec/dummy/lib/assets/.keep +0 -0
  79. data/spec/dummy/lib/tasks/.keep +0 -0
  80. data/spec/dummy/log/.keep +0 -0
  81. data/spec/dummy/plataforma_social/keys/public.pem +5 -0
  82. data/spec/dummy/public/404.html +58 -0
  83. data/spec/dummy/public/422.html +58 -0
  84. data/spec/dummy/public/500.html +57 -0
  85. data/spec/dummy/public/favicon.ico +0 -0
  86. data/spec/dummy/public/robots.txt +5 -0
  87. data/spec/dummy/test/controllers/.keep +0 -0
  88. data/spec/dummy/test/fixtures/.keep +0 -0
  89. data/spec/dummy/test/helpers/.keep +0 -0
  90. data/spec/dummy/test/integration/.keep +0 -0
  91. data/spec/dummy/test/mailers/.keep +0 -0
  92. data/spec/dummy/test/models/.keep +0 -0
  93. data/spec/dummy/test/test_helper.rb +15 -0
  94. data/spec/dummy/vendor/assets/javascripts/.keep +0 -0
  95. data/spec/dummy/vendor/assets/stylesheets/.keep +0 -0
  96. data/spec/plataforma_social/.DS_Store +0 -0
  97. data/spec/plataforma_social/badge_spec.rb +83 -0
  98. data/spec/plataforma_social/ranking/custom_spec.rb +53 -0
  99. data/spec/plataforma_social/ranking/general_spec.rb +23 -0
  100. data/spec/plataforma_social/ranking_spec.rb +147 -0
  101. data/spec/spec_helper.rb +18 -0
  102. metadata +279 -6
data/.DS_Store ADDED
Binary file
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/CHANGELOG.rdoc ADDED
@@ -0,0 +1,4 @@
1
+ == 0.0.14
2
+
3
+ * Adição da interface de Ranking e Badge para facilitar a comunicação com a plataforma.
4
+ Add interface to Ranking and Badge to facilitate communication with the platform.
data/Gemfile CHANGED
@@ -1,4 +1,7 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in plataforma_social.gemspec
4
- gemspec
4
+ gemspec
5
+
6
+ gem 'rails', '4.0.0.rc1'
7
+ gem 'sqlite3'
@@ -1,9 +1,14 @@
1
+ require "plataforma_social/support"
1
2
  require "plataforma_social/version"
2
3
  require "plataforma_social/configuration"
3
4
  require "plataforma_social/domains"
4
5
  require "plataforma_social/facebook"
5
6
  require "plataforma_social/request"
6
7
  require "plataforma_social/helpers"
8
+ require "plataforma_social/ranking"
9
+ require "plataforma_social/ranking/custom"
10
+ require "plataforma_social/ranking/general"
11
+ require "plataforma_social/badge"
7
12
 
8
13
  module PlataformaSocial
9
14
  class << self
@@ -0,0 +1,61 @@
1
+ #encoding: UTF-8
2
+ module PlataformaSocial
3
+ class Badge
4
+ include PlataformaSocial::Support
5
+ def initialize
6
+
7
+ end
8
+
9
+ # Método para retornar a url do módulo de badges na plataforma
10
+ def self.socialp_route
11
+ PlataformaSocial.domains(:badge)
12
+ end
13
+
14
+ # Método para criar uma nova badge na plataforma
15
+ # Esse método aceita como parâmetros:
16
+ # options = {
17
+ # :badge_reference => REFERENCIA_DA_BADGE, <- Obrigatório
18
+ # :badge_obj => OBJETO_DA_BADGE <- Obrigatório
19
+ # }
20
+ #
21
+ def create options = {}
22
+ options.symbolize_keys!
23
+ verify_if_has_all_required_parameters [:badge_reference, :badge_obj], options
24
+ post_request "users/badge/#{options[:badge_reference]}", { :badge => options[:badge_obj] }
25
+ rescue => e
26
+ return e.to_s
27
+ end
28
+
29
+ # Método para incrementar o número de eventos que um usuário fez em cima de uma badge
30
+ # Esse método aceita como parâmetros:
31
+ # options = {
32
+ # :user_reference => REFERENCIA_DO_USUARIO, <- Obrigatório
33
+ # :badges => ID_OU_HASH_COM_AS_INFOS_DA_BADGE <- Obrigatório
34
+ # Ex:
35
+ # a) [1,2] Nesse caso irá incrementar 1 evento a mais nas badges 1 e 2
36
+ # b) [{ 1 => 10, 2 => 4 }] Nesse caso irá incrementar 10 eventos a mais na badge 1 e 4 eventos a mais na badge 2
37
+ # }
38
+ #
39
+ def give options = {}
40
+ options.symbolize_keys!
41
+ verify_if_has_all_required_parameters [:user_reference, :badges], options
42
+ post_request "users/#{options[:user_reference]}/badges", { :badges => options[:badges] }
43
+ rescue => e
44
+ return e.to_s
45
+ end
46
+
47
+ # Método para retornar todas as badges de um aplicativo e marca as badges que o usuário em questão ja ganhou
48
+ # Esse método aceita como parâmetros:
49
+ # options = {
50
+ # :user_reference => REFERENCIA_DO_USUARIO, <- Obrigatório
51
+ # }
52
+ #
53
+ def index options = {}
54
+ options.symbolize_keys!
55
+ verify_if_has_all_required_parameters [:user_reference], options
56
+ get_request "users/#{options[:user_reference]}/badges"
57
+ rescue => e
58
+ return e.to_s
59
+ end
60
+ end
61
+ end
@@ -11,7 +11,7 @@ module PlataformaSocial
11
11
  :badge => 'badge',
12
12
  :notification => 'notification'
13
13
  }
14
-
14
+
15
15
  if domains[module_name.to_sym].present?
16
16
  name = domains[module_name.to_sym]
17
17
 
@@ -36,11 +36,15 @@ module PlataformaSocial
36
36
 
37
37
  if(data){
38
38
  var splittedData = data.split('&');
39
- for(var i in splittedData){
40
- var param = splittedData[i].split('=');
39
+ var splittedDataLength = splittedData.length;
40
+
41
+ if(splittedDataLength){
42
+ for(var i = 0; i < splittedDataLength; i++){
43
+ var param = splittedData[i].split('=');
41
44
 
42
- params[param[0]] = param[1];
43
- } // for
45
+ params[param[0]] = param[1];
46
+ } // for
47
+ }
44
48
  } // if
45
49
 
46
50
  for(var i in defaultParams){
@@ -81,7 +85,7 @@ module PlataformaSocial
81
85
  end
82
86
 
83
87
  def from_facebook?
84
- request && request.referer && request.referer.index('facebook.com')
88
+ request.referer && request.referer.index('facebook.com')
85
89
  end
86
90
 
87
91
  def from_admin?
@@ -0,0 +1,91 @@
1
+ #encoding: UTF-8
2
+ module PlataformaSocial
3
+ class Ranking
4
+ include PlataformaSocial::Support
5
+
6
+ # Método para retornar a url do módulo de ranking na plataforma
7
+ def self.socialp_route
8
+ PlataformaSocial.domains(:ranking)
9
+ end
10
+
11
+ # Método para criar um novo ranking na plataforma
12
+ # Esse método aceita como parâmetros:
13
+ # options = {
14
+ # :user_reference => REFERENCIA_DO_USUARIO, <- Obrigatorio
15
+ # :points => PONTOS_DO_USUARIO, <- Obrigatorio
16
+ # :start_date => DATA_INICIO_DO_RANKING,
17
+ # :end_date => DATA_FIM_DO_RANKING,
18
+ # :min => MINIMO_DE_PONTOS_QUE_O_USUARIO_PODE_TER,
19
+ # :max => MAXIMO_DE_PONTOS_QUE_O_USUARIO_PODE_TER
20
+ # }
21
+ #
22
+ # Quando é passado a data iniciom é obrigado a ter a data fim.
23
+ # Quando os dois parâmetros de data são passados, é criado um ranking para aquele intervalo de tempo e também é computado no ranking geral do app.
24
+ #
25
+ def create options = {}
26
+ options.symbolize_keys!
27
+ verify_if_has_all_required_parameters [{ :start_date => :end_date }, { :end_date => :start_date }, :user_reference, :points], options
28
+ post_request "users/#{options[:user_reference]}/ranking", { :start_date => options[:start_date], :end_date => options[:end_date], :min => options[:min], :max => options[:max], :points => options[:points] }
29
+ rescue => e
30
+ return e.to_s
31
+ end
32
+
33
+ # Método para retornar os usuários e suas posições.
34
+ # Nesse método é possível retornar o ranking cortado. Ou seja, caso você queira pegar apenas 2 usuário acima e 2 abaixo de algum outro usuário é possível usando esse método
35
+ # Esse método aceita como parâmetros:
36
+ # options = {
37
+ # :start_date => DATA_INICIO_DO_RANKING,
38
+ # :end_date => DATA_FIM_DO_RANKING,
39
+ # :friends => SE_IREMOS_PEGAR_OS_AMIGOS_DO_USUARIO_EM_QUESTAO_OU_NAO(Boolean),
40
+ # :user_reference => REFERENCIA_DO_USUARIO, <- Obrigatório
41
+ # :up => NUMERO_DE_USUARIO_A_SEREM_PEGOS_QUE_ESTAO_ACIMA_DO_USUARIO_EM_QUESTAO,
42
+ # :down => NUMERO_DE_USUARIO_A_SEREM_PEGOS_QUE_ESTAO_ABAIXO_DO_USUARIO_EM_QUESTAO,
43
+ # :limit => NUMERO_MAXIMO_DE_REGISTROS_QUE_IRA_SER_LEVADO_EM_CONTA_NA_HORA_DE_PEGAR_O_USUARIO_E_A_JANELA
44
+ # }
45
+ #
46
+ def window options = {}
47
+ options.symbolize_keys!
48
+ verify_if_has_all_required_parameters [:user_reference], options
49
+ get_request "users/ranking/#{options[:up].to_i}/#{options[:down].to_i}/window", { :start_date => options[:start_date], :end_date => options[:end_date], :friends => options[:friends], :limit => options[:limit], :reference => options[:user_reference] }
50
+ rescue => e
51
+ return e.to_s
52
+ end
53
+
54
+ # Método para retornar o ranking completo de todos amigos do app
55
+ # Esse método aceita como parâmetro:
56
+ # options = {
57
+ # :user_reference => REFERENCIA_DO_USUARIO, <- Obrigatório
58
+ # :limit => NUMERO_MAXIMO_DE_REGISTROS_A_SEREM_RETORNADOS,
59
+ # :page => PAGINA_A_SER_RETORNADA_NA_PAGINACAO
60
+ # }
61
+ #
62
+ def friends options = {}
63
+ options.symbolize_keys!
64
+ verify_if_has_all_required_parameters [:user_reference], options
65
+ get_request "users/ranking", { :friends => true, :reference => options[:user_reference], :limit => options[:limit], :page => options[:page] }
66
+ rescue => e
67
+ return e.to_s
68
+ end
69
+
70
+ # Método para destruir todo o ranking do aplicativo
71
+ # Esse método não aceita nenhum parâmetro
72
+ #
73
+ def destroy_all
74
+ # Not implemented yet
75
+ return "Method not implemented yet"
76
+ end
77
+
78
+ # Método para destruir um ranking específico do aplicativo
79
+ # Esse método aceita como parâmetro:
80
+ # options = {
81
+ # :start_date => DATA_INICIO_DO_RANKING,
82
+ # :end_date => DATA_FIM_DO_RANKING,
83
+ # :user_reference => REFERENCIA_DO_USUARIO
84
+ # }
85
+ #
86
+ def destroy options = {}
87
+ # Not implemented yet
88
+ return "Method not implemented yet"
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,28 @@
1
+ module PlataformaSocial
2
+ class Ranking
3
+ class Custom < PlataformaSocial::Ranking
4
+ def initialize
5
+
6
+ end
7
+
8
+ # Método para retornar o ranking do app filtrado por uma data customizada
9
+ # Esse método aceita como parâmetros:
10
+ # options = {
11
+ # :start_date => DATA_INICIO_DO_RANKING, <- Obrigatório
12
+ # :end_date => DATA_FIM_DO_RANKING, <- Obrigatório
13
+ # :user_reference => REFERENCIA_DO_USUARIO, <- Obrigatório caso seja passado o parâmetro friends sendo true
14
+ # :friends => SE_IREMOS_PEGAR_OS_AMIGOS_DO_USUARIO_EM_QUESTAO_OU_NAO(Boolean),
15
+ # :limit => NUMERO_MAXIMO_DE_REGISTROS_A_SEREM_RETORNADOS,
16
+ # :page => PAGINA_A_SER_RETORNADA_NA_PAGINACAO
17
+ # }
18
+ #
19
+ def get options = {}
20
+ options.symbolize_keys!
21
+ verify_if_has_all_required_parameters [{ :friends => :user_reference }, :start_date, :end_date], options
22
+ get_request "/users/ranking", { :start_date => options[:start_date], :end_date => options[:end_date], :friends => options[:friends], :limit => options[:limit], :reference => options[:user_reference], :page => options[:page] }
23
+ rescue => e
24
+ return e.to_s
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,22 @@
1
+ module PlataformaSocial
2
+ class Ranking
3
+ class General < PlataformaSocial::Ranking
4
+ def initialize
5
+
6
+ end
7
+
8
+ # Método para retornar o ranking completo do app
9
+ # Esse método aceita como parâmetro:
10
+ # options = {
11
+ # :limit => NUMERO_MAXIMO_DE_REGISTROS_A_SEREM_RETORNADOS,
12
+ # :page => PAGINA_A_SER_RETORNADA_NA_PAGINACAO
13
+ # }
14
+ #
15
+ def get options = {}
16
+ get_request "/users/ranking", { :limit => options[:limit], :page => options[:page] }
17
+ rescue => e
18
+ return e.to_s
19
+ end
20
+ end
21
+ end
22
+ end
@@ -14,8 +14,8 @@ module PlataformaSocial
14
14
  end
15
15
 
16
16
  def self.request url, params = {}, method = "get"
17
- secret = params[:secret].present? ? params[:secret] : PlataformaSocial.secret
18
- platform_api_key = params[:platform_api_key].present? ? params[:platform_api_key] : PlataformaSocial.api_key
17
+ secret = PlataformaSocial.secret
18
+ platform_api_key = PlataformaSocial.api_key
19
19
  secret_key = OpenSSL::PKey::RSA.new(File.read("#{Rails.root}/plataforma_social/keys/public.pem")).public_encrypt secret
20
20
  params_name = method == 'get' ? :query : :body
21
21
  params = { :network_name => "fb", :platform_api_key => platform_api_key, :signature => secret_key }.merge(params)
@@ -28,18 +28,8 @@ module PlataformaSocial
28
28
 
29
29
  return nil if response.nil?
30
30
 
31
- if response.parsed_response["data"]
32
- response = response.parsed_response["data"]
33
-
34
- begin
35
- response = JSON.parse(response) if response.present? && response.is_a?(String)
36
- rescue JSON::ParserError => e
37
- response = response
38
- end
39
- elsif response.parsed_response["error"]
40
- response = { "error" => response.parsed_response["error"] }
41
- end
42
-
31
+ response = response.parsed_response["data"]
32
+ response = JSON.parse(response) if response.present? && response.is_a?(String)
43
33
  return response
44
34
  end
45
35
  end
@@ -0,0 +1,25 @@
1
+ #encoding: UTF-8
2
+ module PlataformaSocial
3
+ module Support
4
+ protected
5
+ def post_request path, params = {}
6
+ klass = self.class.methods(false).include?(:socialp_route) ? self.class : self.class.superclass
7
+ PlataformaSocial::Request.post "#{klass.socialp_route}/#{path}", params
8
+ end
9
+
10
+ def get_request path, params = {}
11
+ klass = self.class.methods(false).include?(:socialp_route) ? self.class : self.class.superclass
12
+ PlataformaSocial::Request.get "#{klass.socialp_route}/#{path}", params
13
+ end
14
+
15
+ def verify_if_has_all_required_parameters required_parameters, options
16
+ required_parameters.each do |parameter|
17
+ if parameter.is_a?(Hash)
18
+ raise "Quando temos o parâmetro #{parameter.keys.first}, temos que ter obrigatóriamente o parâmetro #{parameter.values.first}" if options[parameter.keys.first.to_sym].present? && options[parameter.keys.first.to_sym] != false && options[parameter.values.first.to_sym].nil?
19
+ else
20
+ raise "Faltando o parâmetro: #{parameter}" if options[parameter.to_sym].nil?
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -1,3 +1,3 @@
1
1
  module PlataformaSocial
2
- VERSION = "0.0.13"
2
+ VERSION = "0.0.14"
3
3
  end
@@ -22,4 +22,10 @@ Gem::Specification.new do |gem|
22
22
  gem.add_dependency 'rsa', '~> 0.1.4'
23
23
  gem.add_dependency 'koala', '~> 1.6.0'
24
24
  gem.add_dependency 'httparty', '~> 0.10.0'
25
+ gem.add_development_dependency(%q<json>, [">= 1.7.7"])
26
+ gem.add_development_dependency(%q<bundler>, [">= 1.1.0"])
27
+ gem.add_development_dependency(%q<rake>, ["~> 0.9.2.2"])
28
+ gem.add_development_dependency(%q<rspec>, ["~> 2.8.0"])
29
+ gem.add_development_dependency(%q<vcr>, ["~> 2.0.1"])
30
+ gem.add_development_dependency(%q<fakeweb>, ["~> 1.3.0"])
25
31
  end
data/spec/.DS_Store ADDED
Binary file
@@ -0,0 +1,51 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://badge.dev.plataformasocial.com.br/users/badge/1
6
+ body:
7
+ encoding: US-ASCII
8
+ string: network_name=fb&platform_api_key=MjAxMy0wMy0xMyAxNzoyMTo1MCArMDAwMERFViAtIFNreXkgVm9ka2EyMw&signature=R%12P%CE(%B5l%DD%06%FB%E6%E2~%FE%9A9%FDa%DE%13%BF%BD%0A%2F%F6%E9%CF%D3)%2C%15%97%20%16%9B%CD%2C%222A%A4o%96%D7F%2B%A7%03%86%D4%B4%F48%83V%9B%81W%5B%D1c%60L%FD%02%FE'%88%3F%FF%D4%EB%A0!%3B%A5w%7B%A3%3E%3Cn7%20%EB%7C1%97sN%0E%887%D2%E5%A0rH._%9D%D8%F2%E6%97%3C%19%B7.t%BB%8BgV.%CAZ%CC%D2%F2%D3%8CfM%08%A6%C0%3A&badge=%7B%22reference%22%3A%221432423423%22%2C%22updated_at%22%3A%222012-07-13T19%3A53%3A20Z%22%2C%22id%22%3A1%2C%22share_text%22%3A%22Parab%5Cu00e9ns%2C%20voc%5Cu00ea%20ganhou%20a%20Badge%20de%20Coloridos%20da%20Dito.%22%2C%22events_count%22%3A10%2C%22picture_url%22%3A%22http%3A%2F%2Fwww.jorge.com.br%2Fsergio%22%2C%22description%22%3A%22Essa%20badge%20%5Cu00e9%20dada%20para%20todos%20os%20Coloridos%20da%20Dito.%22%2C%22name%22%3A%22Dito%20Colorida%22%2C%22created_at%22%3A%222012-07-13T19%3A53%3A20Z%22%2C%22app_id%22%3A23%7D
9
+ headers:
10
+ connection:
11
+ - close
12
+ response:
13
+ status:
14
+ code: 200
15
+ message: OK
16
+ headers:
17
+ content-type:
18
+ - application/json; charset=utf-8
19
+ transfer-encoding:
20
+ - chunked
21
+ connection:
22
+ - close
23
+ status:
24
+ - '200'
25
+ x-powered-by:
26
+ - Phusion Passenger (mod_rails/mod_rack) 3.0.11
27
+ access-control-allow-origin:
28
+ - ! '*'
29
+ x-ua-compatible:
30
+ - IE=Edge,chrome=1
31
+ etag:
32
+ - ! '"a9f1136aafcb7e3f978ab689bf079317"'
33
+ cache-control:
34
+ - max-age=0, private, must-revalidate
35
+ set-cookie:
36
+ - _social_badge_session=BAh7BkkiD3Nlc3Npb25faWQGOgZFRkkiJTI3OTFmMDhjYzY3MmM3OTI0ODIwNTY3MjQyYjI5N2ExBjsAVA%3D%3D--a5f7f14e27766b52968032b9f311864e5fd1b03a;
37
+ path=/; HttpOnly
38
+ x-runtime:
39
+ - '0.034183'
40
+ date:
41
+ - Thu, 30 May 2013 19:17:56 GMT
42
+ x-rack-cache:
43
+ - invalidate, pass
44
+ server:
45
+ - nginx/1.0.10 + Phusion Passenger 3.0.11 (mod_rails/mod_rack)
46
+ body:
47
+ encoding: US-ASCII
48
+ string: ! '{"data":"http://appprova.sandbox.plataformasocial.com.br/badge?badge_reference=1&app_id=23"}'
49
+ http_version: '1.1'
50
+ recorded_at: Thu, 30 May 2013 19:17:56 GMT
51
+ recorded_with: VCR 2.0.1
@@ -0,0 +1,99 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://badge.dev.plataformasocial.com.br/users/badge/1
6
+ body:
7
+ encoding: US-ASCII
8
+ string: network_name=fb&platform_api_key=MjAxMy0wMy0xMyAxNzoyMTo1MCArMDAwMERFViAtIFNreXkgVm9ka2EyMw&signature=5%9C%BA%B2%EE%96_%80I%96%DE%2B4mv%A7%3A%9F%3B%F5%82F%96I%BF2%40%AD%A4x2%5C%0C%A6%15%20%83%B4%E1g%11%DE%91%F5%1E%95%97%20R%0D%82%1E.t'%AB%D4%5B%AA%1F%1B%5E%07%0BF%B6%3B%CB%94%DF%D0%D5%04SO%91(%0C%EA%F9%17%DB%D4%AF%60%26%25%95U%E2%A0%5E.%3E53w%D6%CB2%ACJ%0F%D4v%C8%7F!%B4%D9%CE*%87%AD%86%EE%18%96(m%8C%3ER%B4~%A4%3D%04&badge=%7B%22reference%22%3A%221%22%2C%22updated_at%22%3A%222012-07-13T19%3A53%3A20Z%22%2C%22id%22%3A1%2C%22share_text%22%3A%22Parab%5Cu00e9ns%2C%20voc%5Cu00ea%20ganhou%20a%20Badge%20de%20Coloridos%20da%20Dito.%22%2C%22events_count%22%3A10%2C%22picture_url%22%3A%22http%3A%2F%2Fwww.jorge.com.br%2Fsergio%22%2C%22description%22%3A%22Essa%20badge%20%5Cu00e9%20dada%20para%20todos%20os%20Coloridos%20da%20Dito.%22%2C%22name%22%3A%22Dito%20Colorida%22%2C%22created_at%22%3A%222012-07-13T19%3A53%3A20Z%22%2C%22app_id%22%3A23%7D
9
+ headers:
10
+ connection:
11
+ - close
12
+ response:
13
+ status:
14
+ code: 200
15
+ message: OK
16
+ headers:
17
+ content-type:
18
+ - application/json; charset=utf-8
19
+ transfer-encoding:
20
+ - chunked
21
+ connection:
22
+ - close
23
+ status:
24
+ - '200'
25
+ x-powered-by:
26
+ - Phusion Passenger (mod_rails/mod_rack) 3.0.11
27
+ access-control-allow-origin:
28
+ - ! '*'
29
+ x-ua-compatible:
30
+ - IE=Edge,chrome=1
31
+ etag:
32
+ - ! '"a9f1136aafcb7e3f978ab689bf079317"'
33
+ cache-control:
34
+ - max-age=0, private, must-revalidate
35
+ set-cookie:
36
+ - _social_badge_session=BAh7BkkiD3Nlc3Npb25faWQGOgZFRkkiJTdjOTdjNGVhODVlNWZmYzk3NmQzYThmOTdlMGYyZTdiBjsAVA%3D%3D--0411568e84f765759fcc435fcc816bb2e19f3472;
37
+ path=/; HttpOnly
38
+ x-runtime:
39
+ - '0.045582'
40
+ date:
41
+ - Thu, 30 May 2013 19:17:57 GMT
42
+ x-rack-cache:
43
+ - invalidate, pass
44
+ server:
45
+ - nginx/1.0.10 + Phusion Passenger 3.0.11 (mod_rails/mod_rack)
46
+ body:
47
+ encoding: US-ASCII
48
+ string: ! '{"data":"http://appprova.sandbox.plataformasocial.com.br/badge?badge_reference=1&app_id=23"}'
49
+ http_version: '1.1'
50
+ recorded_at: Thu, 30 May 2013 19:17:57 GMT
51
+ - request:
52
+ method: post
53
+ uri: http://badge.dev.plataformasocial.com.br/users/1/badges
54
+ body:
55
+ encoding: US-ASCII
56
+ string: network_name=fb&platform_api_key=MjAxMy0wMy0xMyAxNzoyMTo1MCArMDAwMERFViAtIFNreXkgVm9ka2EyMw&signature=U%B8%09%22%94%CE%17%83y%CE%A4%C0%C1%96%EA%93u%07M9%5C%81%A6%3EP%40%5E%1C%05%EB%A1%F7%D7%C6%0B%E8%B0x%8Fz%F3y%96%20%D4%A5%BD%3Ee%8D%88%C7L%DB%87p%3A%5D%B0Cl(J%F1%D9%85%DF%EC%B0%EC%24S%13V%C9%5E%DD%8F%04%B5%0C%BD%1C%2F%81%3E%A8%85nj%83%8B%DEm%FA%0B1%84(%24%C6gE%C8%97%ACa%BC'%C8%B9mk%B6%E9%D5%12%1F%DB%B1%F1%B2%87%82%CA%D4i%D5&badges[]=1
57
+ headers:
58
+ connection:
59
+ - close
60
+ response:
61
+ status:
62
+ code: 200
63
+ message: OK
64
+ headers:
65
+ content-type:
66
+ - application/json; charset=utf-8
67
+ transfer-encoding:
68
+ - chunked
69
+ connection:
70
+ - close
71
+ status:
72
+ - '200'
73
+ x-powered-by:
74
+ - Phusion Passenger (mod_rails/mod_rack) 3.0.11
75
+ access-control-allow-origin:
76
+ - ! '*'
77
+ x-ua-compatible:
78
+ - IE=Edge,chrome=1
79
+ etag:
80
+ - ! '"e0234245cb00aa260ccfa99a9a0b235e"'
81
+ cache-control:
82
+ - max-age=0, private, must-revalidate
83
+ set-cookie:
84
+ - _social_badge_session=BAh7BkkiD3Nlc3Npb25faWQGOgZFRkkiJTQzNDBhMWVhODJjNzM0NmZkYzU4NmJkOTQwNDcxNDQzBjsAVA%3D%3D--2f997b98b8a0a3389784a00643d0ced8d2e5e4d2;
85
+ path=/; HttpOnly
86
+ x-runtime:
87
+ - '0.007174'
88
+ date:
89
+ - Thu, 30 May 2013 19:17:57 GMT
90
+ x-rack-cache:
91
+ - invalidate, pass
92
+ server:
93
+ - nginx/1.0.10 + Phusion Passenger 3.0.11 (mod_rails/mod_rack)
94
+ body:
95
+ encoding: US-ASCII
96
+ string: ! '{"data":[]}'
97
+ http_version: '1.1'
98
+ recorded_at: Thu, 30 May 2013 19:17:57 GMT
99
+ recorded_with: VCR 2.0.1