bloopi 0.1.7 → 0.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d857610acc3057255b0ed79488f64254cc3cad5d
4
- data.tar.gz: 1694c4a7969aa2b15c5fd844230eeef983781d9b
3
+ metadata.gz: 974057cb449f653dc4a503def062540024baa47a
4
+ data.tar.gz: eb93e170fbc533f2c32f3caf488f7acdd90eb32e
5
5
  SHA512:
6
- metadata.gz: eaa2fa45a7f9b2f3b146fe5efeb14ca096c81ec3147d9f8c3d7db5a15f741fafd1840391eebf7c62e6bb22c4b4c3052018f16952333366411763adb9c3bb5e39
7
- data.tar.gz: cd76ba70980c5023f328b22377875af905b9c8df1ad6c48c1452401b2770b9d85aa290a8089cd930483067027dac6aacfaf9890943991d4f3696cec36ea76494
6
+ metadata.gz: 3cd2939f5b756e4cc7fda551fa155fdc74e53ee4e98cf6c443eedfe1ea68b60babb84473adda80fc430f8c506628a52902aa672c9bafcaf98c3946810dc1306b
7
+ data.tar.gz: 4ba8ad2df732fdd8ff5cbc4bdf7b9cc622545e65d10d02a4556f0dc8b06b0eecf785fe2062a23935b67551ca2cd06e934c062dd0efc84a12365db67defc1e23a
@@ -2,34 +2,34 @@
2
2
  require 'openssl'
3
3
  require 'base64'
4
4
 
5
- module Blupee
5
+ module Bloopi
6
6
  module API
7
7
  class Auth
8
8
  attr_reader :client_id, :client_secret
9
9
 
10
10
  # Creates a new client.
11
11
  #
12
- # @param client_id [String, Integer] a Blupee client ID
13
- # @param client_secret a Blupee client secret
12
+ # @param client_id [String, Integer] a Bloopi client ID
13
+ # @param client_secret a Bloopi client secret
14
14
  def initialize(client_id = nil, client_secret = nil)
15
- @client_id = client_id || Blupee.config.client_id
16
- @client_secret = client_secret || Blupee.config.client_secret
15
+ @client_id = client_id || Bloopi.config.client_id
16
+ @client_secret = client_secret || Bloopi.config.client_secret
17
17
  end
18
18
 
19
19
  # access tokens
20
20
 
21
- # Fetches an access token, token expiration, and other info from Blupee.
21
+ # Fetches an access token, token expiration, and other info from Bloopi.
22
22
  # Useful when you've received an OAuth code using the server-side authentication process.
23
23
  # @see url_for_oauth_code
24
24
  #
25
25
  # @note (see #url_for_oauth_code)
26
26
  #
27
27
  # @param code (see #url_for_access_token)
28
- # @param options any additional parameters to send to Blupee when redeeming the token
28
+ # @param options any additional parameters to send to Bloopi when redeeming the token
29
29
  #
30
- # @raise Blupee::OAuthTokenRequestError if Blupee returns an error response
30
+ # @raise Bloopi::OAuthTokenRequestError if Bloopi returns an error response
31
31
  #
32
- # @return a hash of the access token info returned by Blupee (token, expiration, etc.)
32
+ # @return a hash of the access token info returned by Bloopi (token, expiration, etc.)
33
33
  def get_access_token_info(options = {})
34
34
  # convenience method to get a the application's sessionless access token
35
35
  get_token_from_server({}, true, options)
@@ -43,14 +43,14 @@ module Blupee
43
43
  # @return the application access token
44
44
  def get_access_token(options = {})
45
45
  if info = get_access_token_info(options)
46
- Blupee.config.access_token = info["access_token"]
46
+ Bloopi.config.access_token = info["access_token"]
47
47
  end
48
48
  end
49
49
 
50
50
  protected
51
51
 
52
52
  def get_token_from_server(args, post = false, options = {})
53
- # fetch the result from Blupee's servers
53
+ # fetch the result from Bloopi's servers
54
54
  response = fetch_token_string(args, post, "auth", options)
55
55
  parse_access_token(response)
56
56
  end
@@ -68,7 +68,7 @@ module Blupee
68
68
  def fetch_token_string(args, post = false, endpoint = "auth", options = {})
69
69
  raise ClientError if @client_id == nil
70
70
  raise ClientError if @client_secret == nil
71
- response = Blupee.make_request("/#{endpoint}", {
71
+ response = Bloopi.make_request("/#{endpoint}", {
72
72
  :client_id => @client_id,
73
73
  :client_secret => @client_secret
74
74
  }.merge!(args), post ? "post" : "get", {:use_ssl => true, format: :json}.merge!(options))
@@ -1,7 +1,7 @@
1
1
  require 'faraday'
2
2
  require 'json'
3
3
 
4
- module Blupee
4
+ module Bloopi
5
5
  module API
6
6
  class Ether
7
7
  attr_reader :coin_symbol, :balance, :wallet, :transaction_hash
@@ -15,7 +15,7 @@ module Blupee
15
15
  # {:wallet_address=>""}
16
16
  def self.balance(args, options = {})
17
17
  wallet_address = args[:wallet_address]
18
- response = Blupee.make_request("/eth/#{wallet_address}", {}, "get", {:use_ssl => true}.merge!(options))
18
+ response = Bloopi.make_request("/eth/#{wallet_address}", {}, "get", {:use_ssl => true}.merge!(options))
19
19
  raise ServerError.new(response.status, response.body) if response.status >= 500
20
20
  raise OAuthTokenRequestError.new(response.status, response.body) if response.status >= 400
21
21
  response
@@ -23,7 +23,7 @@ module Blupee
23
23
 
24
24
 
25
25
  def self.new_wallet(args, options = {})
26
- response = Blupee.make_request("/eth/new",
26
+ response = Bloopi.make_request("/eth/new",
27
27
  {}.merge!(args),
28
28
  "post",
29
29
  {:use_ssl => true,
@@ -35,7 +35,7 @@ module Blupee
35
35
 
36
36
  # {:to_address=>"", :from_address=>"", :password=>"", :quantity=>0.001}
37
37
  def self.transfer(args, options = {})
38
- response = Blupee.make_request("/eth/send",
38
+ response = Bloopi.make_request("/eth/send",
39
39
  {}.merge!(args),
40
40
  "post",
41
41
  {:use_ssl => true,
@@ -1,7 +1,7 @@
1
1
  require 'faraday'
2
2
  require 'json'
3
3
 
4
- module Blupee
4
+ module Bloopi
5
5
  module API
6
6
  class OmiseGo
7
7
  attr_reader :coin_symbol, :balance, :wallet, :transaction_hash
@@ -15,7 +15,7 @@ module Blupee
15
15
  # {:wallet_address=>""}
16
16
  def self.balance(args, options = {})
17
17
  wallet_address = args[:wallet_address]
18
- response = Blupee.make_request("/omg/#{wallet_address}", {}, "get", {:use_ssl => true}.merge!(options))
18
+ response = Bloopi.make_request("/omg/#{wallet_address}", {}, "get", {:use_ssl => true}.merge!(options))
19
19
  raise ServerError.new(response.status, response.body) if response.status >= 500
20
20
  raise OAuthTokenRequestError.new(response.status, response.body) if response.status >= 400
21
21
  response
@@ -23,7 +23,7 @@ module Blupee
23
23
 
24
24
  # {:to_address=>"", :from_address=>"", :password=>"", :quantity=>0.001}
25
25
  def self.transfer(args, options = {})
26
- response = Blupee.make_request("/omg/send",
26
+ response = Bloopi.make_request("/omg/send",
27
27
  {}.merge!(args),
28
28
  "post",
29
29
  {:use_ssl => true,
@@ -1,7 +1,7 @@
1
1
  require 'faraday'
2
2
  require 'json'
3
3
 
4
- module Blupee
4
+ module Bloopi
5
5
  module API
6
6
  class Token
7
7
  attr_reader :coin_symbol, :balance, :wallet, :transaction_hash
@@ -16,7 +16,7 @@ module Blupee
16
16
  def self.balance(args, options = {})
17
17
  contract_id = args[:contract_id]
18
18
  wallet_address = args[:wallet_address]
19
- response = Blupee.make_request("/token/#{contract_id}/#{wallet_address}", {}, "get", {:use_ssl => true}.merge!(options))
19
+ response = Bloopi.make_request("/token/#{contract_id}/#{wallet_address}", {}, "get", {:use_ssl => true}.merge!(options))
20
20
  raise ServerError.new(response.status, response.body) if response.status >= 500
21
21
  raise OAuthTokenRequestError.new(response.status, response.body) if response.status >= 400
22
22
  response
@@ -24,7 +24,7 @@ module Blupee
24
24
 
25
25
  # {:to_address=>"", :from_address=>"", :password=>"", :quantity=>0.001, :contract_address=>""}
26
26
  def self.transfer(args, options = {})
27
- response = Blupee.make_request("/token/send",
27
+ response = Bloopi.make_request("/token/send",
28
28
  {}.merge!(args),
29
29
  "post",
30
30
  {:use_ssl => true,
@@ -1,5 +1,5 @@
1
- # Global configuration for Blupee.
2
- class Blupee::Configuration
1
+ # Global configuration for Bloopi.
2
+ class Bloopi::Configuration
3
3
  # The default access token to be used if none is otherwise supplied.
4
4
  attr_accessor :access_token
5
5
 
@@ -14,7 +14,7 @@ class Blupee::Configuration
14
14
  attr_accessor :api_version
15
15
 
16
16
  def initialize
17
- self.api_server = "api.blupee.io"
17
+ self.api_server = "api.bloopi.io"
18
18
  self.api_version = "v1"
19
19
  end
20
20
  end
@@ -1,18 +1,18 @@
1
- module Blupee
1
+ module Bloopi
2
2
 
3
- class BlupeeError < StandardError; end
3
+ class BloopiError < StandardError; end
4
4
 
5
5
  module API
6
6
 
7
7
  # The OAuth signature is incomplete, invalid, or using an unsupported algorithm
8
- class OAuthSignatureError < ::Blupee::BlupeeError; end
8
+ class OAuthSignatureError < ::Bloopi::BloopiError; end
9
9
 
10
10
  # Required for realtime updates validation
11
- class AppSecretNotDefinedError < ::Blupee::BlupeeError; end
11
+ class AppSecretNotDefinedError < ::Bloopi::BloopiError; end
12
12
 
13
13
  # Facebook responded with an error to an API request. If the exception contains a nil
14
14
  # http_status, then the error was detected before making a call to Facebook. (e.g. missing access token)
15
- class APIError < ::Blupee::BlupeeError
15
+ class APIError < ::Bloopi::BloopiError
16
16
  attr_accessor :http_status,
17
17
  :response_body,
18
18
  :error_type,
@@ -81,7 +81,7 @@ module Blupee
81
81
  end
82
82
 
83
83
  # Facebook returned an invalid response body
84
- class BadBlupeeAPIResponse < APIError; end
84
+ class BadBloopiAPIResponse < APIError; end
85
85
 
86
86
  # Facebook responded with an error while attempting to request an access token
87
87
  class OAuthTokenRequestError < APIError; end
@@ -1,4 +1,4 @@
1
- module Blupee
1
+ module Bloopi
2
2
  module HTTPService
3
3
  class Request
4
4
  attr_reader :raw_path, :raw_args, :raw_verb, :raw_options
@@ -11,7 +11,7 @@ module Blupee
11
11
  # @param options various flags to indicate which server to use.
12
12
  # @param options
13
13
  # @option options :use_ssl force https, even if not needed
14
- # @option options :json whether or not to send JSON to Blupee
14
+ # @option options :json whether or not to send JSON to Bloopi
15
15
  def initialize(path: path, verb: verb, args: {}, options: {})
16
16
  @raw_path = path
17
17
  @raw_args = args
@@ -19,20 +19,20 @@ module Blupee
19
19
  @raw_options = options
20
20
  end
21
21
 
22
- # Determines which type of request to send to Blupee. Blupee natively accepts GETs and POSTs, for others we have to include the method in the post body.
22
+ # Determines which type of request to send to Bloopi. Bloopi natively accepts GETs and POSTs, for others we have to include the method in the post body.
23
23
  #
24
24
  # @return one of get or post
25
25
  def verb
26
26
  ["get", "post"].include?(raw_verb) ? raw_verb : "post"
27
27
  end
28
28
 
29
- # Determines the path to be requested on Blupee, incorporating an API version if specified.
29
+ # Determines the path to be requested on Bloopi, incorporating an API version if specified.
30
30
  #
31
31
  # @return the original path, with API version if appropriate.
32
32
  def path
33
33
  # if an api_version is specified and the path does not already contain
34
34
  # one, prepend it to the path
35
- api_version = raw_options[:api_version] || Blupee.config.api_version
35
+ api_version = raw_options[:api_version] || Bloopi.config.api_version
36
36
  "/#{api_version}/#{raw_path}"
37
37
  end
38
38
 
@@ -73,11 +73,11 @@ module Blupee
73
73
  raw_options[:format] == :json
74
74
  end
75
75
 
76
- # The address of the appropriate Blupee server.
76
+ # The address of the appropriate Bloopi server.
77
77
  #
78
78
  # @return a complete server address with protocol
79
79
  def server
80
- uri = "#{options[:use_ssl] ? "https" : "http"}://#{Blupee.config.api_server}"
80
+ uri = "#{options[:use_ssl] ? "https" : "http"}://#{Bloopi.config.api_server}"
81
81
  end
82
82
 
83
83
  protected
@@ -1,9 +1,9 @@
1
- module Blupee
1
+ module Bloopi
2
2
  module HTTPService
3
3
  class Response
4
4
  attr_reader :status, :body, :headers
5
5
 
6
- # Creates a new Response object, which standardizes the response received by Blupee API for use within Blupee.
6
+ # Creates a new Response object, which standardizes the response received by Bloopi API for use within Bloopi.
7
7
  def initialize(status, body, headers)
8
8
  @status = status
9
9
  @body = body
@@ -11,7 +11,7 @@ module Blupee
11
11
  end
12
12
 
13
13
  def data
14
- # quirks_mode is needed because Blupee sometimes returns a raw true or false value --
14
+ # quirks_mode is needed because Bloopi sometimes returns a raw true or false value --
15
15
  # in Ruby 2.4 we can drop that.
16
16
  @data ||= JSON.parse(body, quirks_mode: true) unless body.empty?
17
17
  end
@@ -2,7 +2,7 @@ require 'faraday'
2
2
  require_relative 'http_service/request'
3
3
  require_relative 'http_service/response'
4
4
 
5
- module Blupee
5
+ module Bloopi
6
6
  module HTTPService
7
7
  class << self
8
8
  # A customized stack of Faraday middleware that will be used to make each request.
@@ -12,22 +12,22 @@ module Blupee
12
12
 
13
13
  @http_options ||= {}
14
14
 
15
- # Blupee's default middleware stack.
15
+ # Bloopi's default middleware stack.
16
16
  # and use whichever adapter has been configured for this application.
17
17
  DEFAULT_MIDDLEWARE = Proc.new do |builder|
18
18
  builder.request :url_encoded
19
19
  builder.adapter Faraday.default_adapter
20
20
  end
21
21
 
22
- # Makes a request directly to Blupee.
22
+ # Makes a request directly to Bloopi.
23
23
  # @note You'll rarely need to call this method directly.
24
24
  #
25
25
  #
26
- # @param request a Blupee::HTTPService::Request object
26
+ # @param request a Bloopi::HTTPService::Request object
27
27
  #
28
- # @raise an appropriate connection error if unable to make the request to Blupee
28
+ # @raise an appropriate connection error if unable to make the request to Bloopi
29
29
  #
30
- # @return [Blupee::HTTPService::Response] a response object representing the results from Blupee
30
+ # @return [Bloopi::HTTPService::Response] a response object representing the results from Bloopi
31
31
  def self.make_request(request)
32
32
  # set up our Faraday connection
33
33
  conn = Faraday.new(request.server, faraday_options(request.options), &(faraday_middleware || DEFAULT_MIDDLEWARE))
@@ -37,7 +37,7 @@ module Blupee
37
37
  response = conn.post do |req|
38
38
  req.path = request.path
39
39
  req.headers["Content-Type"] = "application/json"
40
- req.headers['Bearer'] = Blupee.config.access_token if Blupee.config.access_token
40
+ req.headers['Bearer'] = Bloopi.config.access_token if Bloopi.config.access_token
41
41
  req.body = request.post_args.to_json
42
42
  req
43
43
  end
@@ -45,13 +45,13 @@ module Blupee
45
45
  # response = conn.send(request.verb, request.path, request.post_args)
46
46
  response = conn.get do |req|
47
47
  req.path = request.path
48
- req.headers['Bearer'] = Blupee.config.access_token if Blupee.config.access_token
48
+ req.headers['Bearer'] = Bloopi.config.access_token if Bloopi.config.access_token
49
49
  end
50
50
  end
51
51
 
52
52
  # Log URL information
53
- # Blupee::Utils.debug "#{request.verb.upcase}: #{request.path} params: #{request.raw_args.inspect}"
54
- Blupee::HTTPService::Response.new(response.status.to_i, response.body, response.headers)
53
+ # Bloopi::Utils.debug "#{request.verb.upcase}: #{request.path} params: #{request.raw_args.inspect}"
54
+ Bloopi::HTTPService::Response.new(response.status.to_i, response.body, response.headers)
55
55
  end
56
56
 
57
57
 
@@ -0,0 +1,3 @@
1
+ module Bloopi
2
+ VERSION = "0.1.8"
3
+ end
data/lib/bloopi.rb ADDED
@@ -0,0 +1,28 @@
1
+ require_relative "bloopi/version"
2
+ require_relative 'bloopi/errors'
3
+ require_relative "bloopi/configuration"
4
+ require_relative "bloopi/http_service"
5
+ require_relative "bloopi/http_service/request"
6
+ require_relative "bloopi/http_service/response"
7
+ require_relative "bloopi/api/auth"
8
+ require_relative "bloopi/api/ether"
9
+ require_relative "bloopi/api/omise_go"
10
+ require_relative "bloopi/api/token"
11
+
12
+ module Bloopi
13
+
14
+ class << self
15
+ def configure
16
+ yield config
17
+ end
18
+
19
+ # See Bloopi::Configuration.
20
+ def config
21
+ @config ||= Configuration.new
22
+ end
23
+ end
24
+
25
+ def self.make_request(path, args, verb, options = {})
26
+ HTTPService.make_request(HTTPService::Request.new(path: path, args: args, verb: verb, options: options))
27
+ end
28
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bloopi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
- - Blupee Inc.
7
+ - Bloopi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-10 00:00:00.000000000 Z
11
+ date: 2017-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -160,23 +160,23 @@ dependencies:
160
160
  version: 1.8.3
161
161
  description: Ethereum, OmiseGo, ERC20 API
162
162
  email:
163
- - admin@blupee.io
163
+ - admin@bloopi.io
164
164
  executables: []
165
165
  extensions: []
166
166
  extra_rdoc_files: []
167
167
  files:
168
- - lib/blupee.rb
169
- - lib/blupee/api/auth.rb
170
- - lib/blupee/api/ether.rb
171
- - lib/blupee/api/omise_go.rb
172
- - lib/blupee/api/token.rb
173
- - lib/blupee/configuration.rb
174
- - lib/blupee/errors.rb
175
- - lib/blupee/http_service.rb
176
- - lib/blupee/http_service/request.rb
177
- - lib/blupee/http_service/response.rb
178
- - lib/blupee/version.rb
179
- homepage: https://github.com/fogonthedowns/blupee_ruby
168
+ - lib/bloopi.rb
169
+ - lib/bloopi/api/auth.rb
170
+ - lib/bloopi/api/ether.rb
171
+ - lib/bloopi/api/omise_go.rb
172
+ - lib/bloopi/api/token.rb
173
+ - lib/bloopi/configuration.rb
174
+ - lib/bloopi/errors.rb
175
+ - lib/bloopi/http_service.rb
176
+ - lib/bloopi/http_service/request.rb
177
+ - lib/bloopi/http_service/response.rb
178
+ - lib/bloopi/version.rb
179
+ homepage: https://github.com/Bloopi-Ethereum-API/bloopi_ruby
180
180
  licenses:
181
181
  - MIT
182
182
  metadata: {}
@@ -1,3 +0,0 @@
1
- module Blupee
2
- VERSION = "0.1.7"
3
- end
data/lib/blupee.rb DELETED
@@ -1,28 +0,0 @@
1
- require_relative "blupee/version"
2
- require_relative 'blupee/errors'
3
- require_relative "blupee/configuration"
4
- require_relative "blupee/http_service"
5
- require_relative "blupee/http_service/request"
6
- require_relative "blupee/http_service/response"
7
- require_relative "blupee/api/auth"
8
- require_relative "blupee/api/ether"
9
- require_relative "blupee/api/omise_go"
10
- require_relative "blupee/api/token"
11
-
12
- module Blupee
13
-
14
- class << self
15
- def configure
16
- yield config
17
- end
18
-
19
- # See Blupee::Configuration.
20
- def config
21
- @config ||= Configuration.new
22
- end
23
- end
24
-
25
- def self.make_request(path, args, verb, options = {})
26
- HTTPService.make_request(HTTPService::Request.new(path: path, args: args, verb: verb, options: options))
27
- end
28
- end