smtp_lw 0.0.1 → 0.0.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: e4fdd978d2fc692d4534cbe4238a32e123a867f2
4
- data.tar.gz: 67ab29002efa96217c1bf518814d5cf5d89a41d5
3
+ metadata.gz: 1e7a01d7bdb2f90cbdf4be8e216484b73ddf09aa
4
+ data.tar.gz: 5638a3bc35a3e9eaefad7ca595a5a09d7970a1f0
5
5
  SHA512:
6
- metadata.gz: 7a25046824b51f6243f40da8dce0ac72ed57f9e62146ee53fc87474cd1ce2640e5f950532c8d5cf55dee91d017381c4cb620a1f4988c40afe9a357a754c9911b
7
- data.tar.gz: ee26d79bd8d10fb49e9f0e435b872ce6914f03526cc63d7b703cc682c4fe91e8214aec124bac2e52526f56528e68272b1c7273fd6257cf2594f0288368a631fe
6
+ metadata.gz: ff3a5aa32377e43ef7896d26c6d50ffc35a6e3709ec5f6d029667de2dda7b341123976b51bd15676193bb739a6348b1a4c0fbb3d3b84e9826e1dc8b769b79541
7
+ data.tar.gz: 0b21195fe892b625fd95d5d54a763a24bba3af8bc2aba3f31fb1e38a34b2d877f53d2c82f6a642f8524e9400c4c54ca3a2aaba4793b706c78315297f6442d7bb
@@ -3,7 +3,10 @@ module SmtpLw
3
3
  require "smtp_lw/default"
4
4
  require "smtp_lw/configurable"
5
5
  require "smtp_lw/client"
6
+ require 'dotenv'
7
+
6
8
  class << self
9
+ Dotenv.load
7
10
  include SmtpLw::Configurable
8
11
  end
9
12
 
@@ -52,21 +52,29 @@ module SmtpLw
52
52
 
53
53
  def paginate(options)
54
54
  page = options[:page] || 1
55
- per = options[:per] || SmtpLw.per_page
55
+ per = options[:per] || (@per_page || SmtpLw.per_page)
56
56
  options.merge(page: page, per: per)
57
57
  end
58
58
 
59
59
  def connection
60
- conn = Faraday.new(url: SmtpLw.api_endpoint, ssl: {verify: false}) do |c|
60
+ conn = Faraday.new(url: (@api_endpoint || SmtpLw.api_endpoint), ssl: {verify: false}) do |c|
61
61
  c.request :json
62
62
  c.response :json
63
63
  c.adapter Faraday.default_adapter
64
64
 
65
65
  end
66
66
  conn.headers['User-Agent'] = "SMTP LW Ruby API Client v#{VERSION}"
67
- conn.headers['x-auth-token'] = SmtpLw.api_token
67
+ conn.headers['x-auth-token'] = @api_token || SmtpLw.api_token
68
68
  conn
69
69
  end
70
70
 
71
+ def per_page
72
+ @per_page || SmtpLw.per_page
73
+ end
74
+
75
+ def api_endpoint
76
+ @api_endpoint || SmtpLw.api_endpoint
77
+ end
78
+
71
79
  end
72
80
  end
@@ -1,3 +1,3 @@
1
1
  module SmtpLw
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smtp_lw
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Locaweb