skipio_api 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/skipio.rb +10 -3
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3c3305ce4a0402dce9c16e33688669ff3eab59bf
4
- data.tar.gz: 304b6793e86940c2578a3dac43c266e478d47d87
3
+ metadata.gz: 552c39370a4c13280e4a21904ecf5dbcd2f1526b
4
+ data.tar.gz: 2e4606971f6629a0bf205d3722241d4bfdc96646
5
5
  SHA512:
6
- metadata.gz: 7801f6e979cfdecf258dbfab59adfcf86370884134b7fdcbc9912178c0f012cd5d303393946b48e5a60124a976bedf7f7c8c19f20e053a58e6c816e7a77f7227
7
- data.tar.gz: 600466c01cedb3460b1bddedd8403dca362cc9e8599628d937efc77ed183c46d0bb63036af580b2d165a1b4d9f56ac3684b8657c1aaf3f456ad1d9d099e2073d
6
+ metadata.gz: 549b6fed19176b211f5401d78876aee24076b1b003903865c35deb4cdd85c18c3b17626204982b42b97cfdd1fb5de94ebb366401b9808463e934b5be1baf601b
7
+ data.tar.gz: 262fef90284dccb311aa176b0c3044fb0d04b3219ab748a9ab3958011b92a28da75776748bd1351e7e8cfc9f1a7805784e58ddd6d38383f518721443c9f19692
@@ -5,10 +5,9 @@ require "addressable/uri"
5
5
  require 'open-uri'
6
6
 
7
7
  class Skipio
8
- API_SERVER = 'https://stage.skipio.com'
9
-
10
8
  def initialize(options)
11
9
  @token = options[:token]
10
+ @api_server = options[:api_server] || :dev
12
11
  end
13
12
 
14
13
  # params = { page: 1, per: 10 }
@@ -45,7 +44,7 @@ class Skipio
45
44
  # url = 'v1/contacts'
46
45
  # options = { params: { Hash: parameters }, json: { Hash: json } }
47
46
  def process_by_url(url, action, options = {})
48
- uri = URI.parse("#{API_SERVER}/api/#{url}?token=#{@token}&#{options[:params]}")
47
+ uri = URI.parse("#{api_server}/api/#{url}?token=#{@token}&#{options[:params]}")
49
48
  if action == :get
50
49
  response = Net::HTTP.get(uri)
51
50
  elsif action == :post
@@ -56,6 +55,14 @@ class Skipio
56
55
  response
57
56
  end
58
57
 
58
+ def api_server
59
+ if @api_server == :prod
60
+ 'https://app.skipio.com'
61
+ elsif :dev
62
+ 'https://stage.skipio.com'
63
+ end
64
+ end
65
+
59
66
  private
60
67
 
61
68
  def create_by_url(uri, json_data)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: skipio_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Psalmuel Aguilar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-01 00:00:00.000000000 Z
11
+ date: 2017-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport