uboost-client 0.1.6 → 0.1.7
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.
- data/README.markdown +4 -2
- data/lib/uboost-client/uboost_client.rb +4 -4
- data/lib/uboost-client/version.rb +1 -1
- data/spec/simple_test.rb +1 -1
- metadata +1 -1
data/README.markdown
CHANGED
@@ -13,8 +13,10 @@ gem install 'uboost-client'
|
|
13
13
|
```ruby
|
14
14
|
require 'uboost-client'
|
15
15
|
|
16
|
-
client = UboostClient::Client.new(:subdomain => 'test_subdomain',
|
17
|
-
|
16
|
+
client = UboostClient::Client.new(:subdomain => 'test_subdomain',
|
17
|
+
:debug => true, # Print debug info. Defaults to false
|
18
|
+
:api_credentials =>
|
19
|
+
{:username => 'api_username', :password => 'api_password'})
|
18
20
|
|
19
21
|
# Examples
|
20
22
|
#
|
@@ -19,9 +19,9 @@ module UboostClient
|
|
19
19
|
def connection
|
20
20
|
url = "https://#{@api_credentials[:username]}:#{@api_credentials[:password]}@#{@subdomain}.uboost.com"
|
21
21
|
Faraday.new(url) do |faraday|
|
22
|
-
faraday.request :url_encoded
|
23
|
-
faraday.response :logger
|
24
|
-
faraday.adapter Faraday.default_adapter
|
22
|
+
faraday.request :url_encoded # form-encode POST params
|
23
|
+
faraday.response :logger if @debug # log requests to STDOUT
|
24
|
+
faraday.adapter Faraday.default_adapter # make requests with Net::HTTP
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
@@ -29,7 +29,7 @@ module UboostClient
|
|
29
29
|
url = "https://#{@subdomain}.uboost.com"
|
30
30
|
Faraday.new(url, {:headers=>{'Cookie'=> uboost_session_id}}) do |faraday|
|
31
31
|
faraday.request :url_encoded # form-encode POST params
|
32
|
-
faraday.response :logger
|
32
|
+
faraday.response :logger if @debug # log requests to STDOUT
|
33
33
|
faraday.adapter Faraday.default_adapter # make requests with Net::HTTP
|
34
34
|
end
|
35
35
|
end
|
data/spec/simple_test.rb
CHANGED
@@ -5,7 +5,7 @@ subdomain = ENV['UBOOST_SUBDOMAIN']
|
|
5
5
|
api_credentials = { :username => ENV['UBOOST_USERNAME'], :password => ENV['UBOOST_PASSWORD'] }
|
6
6
|
session = Hash.new
|
7
7
|
|
8
|
-
client = UboostClient::Client.new(:subdomain => subdomain, :api_credentials => api_credentials)
|
8
|
+
client = UboostClient::Client.new(:subdomain => subdomain, :api_credentials => api_credentials, :debug => false)
|
9
9
|
|
10
10
|
# puts client.account.create({ "user_name" => "test_user_2" })
|
11
11
|
# puts client.account.select(921679373)
|