Skip to content

Commit

Permalink
Rename from BridgeClient to StellarClient
Browse files Browse the repository at this point in the history
  • Loading branch information
ramontayag committed Aug 21, 2018
1 parent 8fedf49 commit da8a80c
Show file tree
Hide file tree
Showing 21 changed files with 64 additions and 60 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]
### Changed
- Renamed from BridgeClient to StellarClient

## [0.4.0] - 2017-04-05
### Added
- Expose response's `code` (as `code_str`) and `message`
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source 'https://rubygems.org'

# Specify your gem's dependencies in bridge_client.gemspec
# Specify your gem's dependencies in stellar_client.gemspec
gemspec

gem "pry-byebug"
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# BridgeClient
# StellarClient

[![Build Status](https://travis-ci.org/imacchiato/bridge_client-ruby.svg?branch=master)](https://travis-ci.org/imacchiato/bridge_client-ruby)
[![Build Status](https://travis-ci.org/imacchiato/stellar_client-ruby.svg?branch=master)](https://travis-ci.org/imacchiato/stellar_client-ruby)

Ruby wrapper for Stellar's Bridge Server API

Expand All @@ -9,7 +9,7 @@ Ruby wrapper for Stellar's Bridge Server API
Add this line to your application's Gemfile:

```ruby
gem 'bridge_client'
gem 'stellar_client'
```

And then execute:
Expand All @@ -18,14 +18,14 @@ And then execute:

Or install it yourself as:

$ gem install bridge_client
$ gem install stellar_client

## Usage

Configure in an initializer:

```ruby
BridgeClient.configure do |c|
StellarClient.configure do |c|
c.host = ENV["BRIDGE_HOST"]
end
```
Expand All @@ -47,7 +47,7 @@ See `spec/acceptance` for detailed examples.

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/imacchiato/bridge_client-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
Bug reports and pull requests are welcome on GitHub at https://github.com/imacchiato/stellar_client-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.

## License

Expand Down
2 changes: 1 addition & 1 deletion bin/console
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env ruby

require "bundler/setup"
require "bridge_client"
require "stellar_client"

# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ services:
- ./spec/fixtures/bridge:/app
bridge_db:
image: postgres:9.6
expose:
- "5432"
ports:
- "5432:5432"
volumes:
- bridge_db:/var/lib/postgresql/data
volumes:
Expand Down
27 changes: 0 additions & 27 deletions lib/bridge_client.rb

This file was deleted.

27 changes: 27 additions & 0 deletions lib/stellar_client.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
require "active_support/core_ext/hash/indifferent_access"
require "api_client_base"
require "gem_config"
require "virtus"
require "stellar_client/version"
require "stellar_client/client"
require "stellar_client/coercers/indifferent_hash"
require "stellar_client/requests/base_request"
require "stellar_client/requests/send_payment_request"
require "stellar_client/responses/base_response"
require "stellar_client/responses/send_payment_response"

module StellarClient

include GemConfig::Base

with_configuration do
has :host, classes: String
end

def self.new(options={})
Client.new(
host: options[:host] || StellarClient.configuration.host,
)
end

end
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module BridgeClient
module StellarClient
class Client

include APIClientBase::Client.module(default_opts: :default_opts)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module BridgeClient
module StellarClient
module Coercers
class IndifferentHash < Virtus::Attribute

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module BridgeClient
module StellarClient
class BaseRequest

include APIClientBase::Request.module(default_opts: :default_opts)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module BridgeClient
module StellarClient
class SendPaymentRequest < BaseRequest

BODY_ATTRS = %i[
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module BridgeClient
module StellarClient
class BaseResponse

include APIClientBase::Response.module
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module BridgeClient
module StellarClient
class SendPaymentResponse < BaseResponse

attribute :body, Coercers::IndifferentHash, lazy: true, default: :default_body
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module BridgeClient
module StellarClient
VERSION = "0.4.0"
end
4 changes: 2 additions & 2 deletions spec/acceptance/pay_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

context "payment is successful" do
it "returns the response with the transaction and ledger info" do
client = BridgeClient.new
client = StellarClient.new
response = client.send_payment(
CONFIG.slice(:destination, :source).merge(
amount: 1,
Expand All @@ -22,7 +22,7 @@

context "payment is not successful" do
it "returns the response with the code and message" do
client = BridgeClient.new
client = StellarClient.new
response = client.send_payment(
CONFIG.slice(:destination, :source).merge(amount: 100_000_000_000)
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

module BridgeClient
module StellarClient
RSpec.describe Client, type: %i[virtus] do

describe "attributes" do
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

module BridgeClient
module StellarClient
RSpec.describe SendPaymentRequest, type: %i[virtus] do

it "inherits from BaseRequest" do
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

module BridgeClient
module StellarClient
RSpec.describe SendPaymentResponse, type: %i[virtus] do

it "inherits from BaseResponse" do
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
require "spec_helper"

describe BridgeClient do
describe StellarClient do
it "has a version number" do
expect(BridgeClient::VERSION).not_to be nil
expect(StellarClient::VERSION).not_to be nil
end

it "is configurable" do
Expand Down
6 changes: 3 additions & 3 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
require "virtus-matchers"
require "virtus/matchers/rspec"
require "pry-byebug"
require "pathname"
require "active_support/core_ext/hash/indifferent_access"
require "active_support/json"
require 'vcr'
require "bridge_client"
require "stellar_client"

SPEC_DIR = Pathname.new(File.dirname(__FILE__))
CONFIG_YML = SPEC_DIR.join("config.yml")
CONFIG = YAML.load_file(CONFIG_YML).with_indifferent_access

BridgeClient.configure do |c|
StellarClient.configure do |c|
c.host = CONFIG[:host]
end

Expand Down
12 changes: 6 additions & 6 deletions bridge_client.gemspec → stellar_client.gemspec
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'bridge_client/version'
require 'stellar_client/version'

Gem::Specification.new do |spec|
spec.name = "bridge_client"
spec.version = BridgeClient::VERSION
spec.name = "stellar_client"
spec.version = StellarClient::VERSION
spec.authors = ["Ramon Tayag"]
spec.email = ["[email protected]"]

spec.summary = %q{Ruby wrapper for Stellar's Bridge Server API}
spec.description = %q{Ruby wrapper for Stellar's Bridge Server API}
spec.homepage = "https://github.com/imacchiato/bridge_client-ruby"
spec.summary = %q{Ruby wrapper for Stellar's Stellar Server API}
spec.description = %q{Ruby wrapper for Stellar's Stellar Server API}
spec.homepage = "https://github.com/imacchiato/stellar_client-ruby"
spec.license = "MIT"

if spec.respond_to?(:metadata)
Expand Down

0 comments on commit da8a80c

Please sign in to comment.