messenger_client 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c35746fe9e9f53199eb9ef6fbcb4dff1fcf06254
4
- data.tar.gz: 17f6f6861ecb67b2ab4bdc6998b722e9cfc1342c
3
+ metadata.gz: 6088f6bbd3711ae7efdeaf6410498abcdc0d21d0
4
+ data.tar.gz: 550e200908ed2db624eab4c54ca306ec000ab4eb
5
5
  SHA512:
6
- metadata.gz: 8c2b702d42926113d12f49469ab5127e42921197f06a52b0790385fe3f9079fe9907237f151c61a6c54a6e8744516a22c7e9d4a92cec524dfe5a90fbb858d148
7
- data.tar.gz: '088b983e8d0bb4d0fe767ce20611dde12808f0bd9426ef8d5d029c06d78dfae3a707f3c72d0c943ae2df454e4f746e201ce3ac86d128b1a93ec9407c2bd657ab'
6
+ metadata.gz: 1d417cfb9eba35ead6eb9d7bbdda17763d5d17f4f10a8ca8207b52b06e99f2d77b63bc85766fea41452459d052b5e44a844ae3457d5fd7dfcd67d2c0e2300df1
7
+ data.tar.gz: 6236d6611b1807b469e081755a26069ad15b6496705f54037daeac78653b09cff19e2a734e25f9c5153b416209bddfeae2215196eb045478adc9e886b3f5b31d
@@ -4,6 +4,7 @@ module MessengerClient
4
4
 
5
5
  def initialize(page_access_token)
6
6
  @page_access_token = page_access_token
7
+ @logger = MessengerClient::Config.logger
7
8
  end
8
9
 
9
10
  def setup_menu(buttons)
@@ -81,15 +82,19 @@ module MessengerClient
81
82
  payload.merge!(message: data) unless data.nil?
82
83
  payload.merge!(opts)
83
84
  res = Typhoeus.post(url, body: json(payload), headers: headers)
84
- p res.body if ENV["DEBUG"]
85
- p res.headers if ENV["DEBUG"]
85
+ @logger.debug(url) if ENV["DEBUG"]
86
+ @logger.debug(json(payload)) if ENV["DEBUG"]
87
+ @logger.debug(res.body) if ENV["DEBUG"]
88
+ @logger.debug(res.headers) if ENV["DEBUG"]
86
89
  res
87
90
  end
88
91
 
89
92
  def post(payload)
90
93
  res = Typhoeus.post(url, body: json(payload), headers: headers)
91
- p res.body if ENV["DEBUG"]
92
- p res.headers if ENV["DEBUG"]
94
+ @logger.debug(url) if ENV["DEBUG"]
95
+ @logger.debug(json(payload)) if ENV["DEBUG"]
96
+ @logger.debug(res.body) if ENV["DEBUG"]
97
+ @logger.debug(res.headers) if ENV["DEBUG"]
93
98
  res
94
99
  end
95
100
 
@@ -0,0 +1,11 @@
1
+ module MessengerClient
2
+ class Config
3
+ class << self
4
+ attr_writer :logger
5
+
6
+ def logger
7
+ @logger ||= Logger.new(STDOUT)
8
+ end
9
+ end
10
+ end
11
+ end
@@ -1,3 +1,3 @@
1
1
  module MessengerClient
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -3,6 +3,9 @@ require "typhoeus"
3
3
 
4
4
  require "messenger_client/version"
5
5
 
6
+ # Config
7
+ require "messenger_client/config"
8
+
6
9
  # Buttons
7
10
  require "messenger_client/button"
8
11
  require "messenger_client/call_button"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: messenger_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Cruz
@@ -88,6 +88,7 @@ files:
88
88
  - lib/messenger_client/button_template.rb
89
89
  - lib/messenger_client/call_button.rb
90
90
  - lib/messenger_client/client.rb
91
+ - lib/messenger_client/config.rb
91
92
  - lib/messenger_client/generic_template.rb
92
93
  - lib/messenger_client/get_started.rb
93
94
  - lib/messenger_client/location_template.rb