Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
## [UNRELEASED]
### Added

### Changed

### Deprecated

### Removed

### Fixed

### Security
This gem has been renamed to billwerk and the pactas_itero gem release has been deprecated.

## [0.3.0] - 2017-09-04
### Added
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
source 'https://rubygems.org'

# Specify your gem's dependencies in pactas_itero.gemspec
# Specify your gem's dependencies in billwerk.gemspec
gemspec
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[![Build Status](https://travis-ci.org/shipcloud/pactas_itero.svg)](https://travis-ci.org/shipcloud/pactas_itero)
[![Build Status](https://travis-ci.org/shipcloud/billwerk.svg)](https://travis-ci.org/shipcloud/billwerk)

# PactasItero
# Billwerk

TODO: Write a gem description

Expand All @@ -9,7 +9,7 @@ TODO: Write a gem description
Add this line to your application's Gemfile:

```ruby
gem 'pactas_itero'
gem 'billwerk'
```

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

Or install it yourself as:

$ gem install pactas_itero
$ gem install billwerk

## Usage

TODO: Write usage instructions here

## Contributing

1. Fork it ( https://github.com/[my-github-username]/pactas_itero/fork )
1. Fork it ( https://github.com/[my-github-username]/billwerk/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ end
task :console do
require 'irb'
require 'irb/completion'
require 'pactas_itero'
require 'billwerk'
ARGV.clear
IRB.start
end
Expand Down
18 changes: 9 additions & 9 deletions pactas_itero.gemspec → billwerk.gemspec
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'pactas_itero/version'
require 'billwerk/version'

Gem::Specification.new do |spec|
spec.name = 'pactas_itero'
spec.version = PactasItero::VERSION
spec.name = 'billwerk'
spec.version = Billwerk::VERSION
spec.authors = ['Simon Fröhler']
spec.email = "simon@shipcloud.io"
spec.summary = %q{pactas_itero provides a client mapping for accessing
the Pactas Itero API.}
spec.description = %q{pactas_itero provides a client mapping for accessing
the Pactas Itero API, making it easy to post your data to, adn read your
data from your Pactas account.}
spec.homepage = 'https://github.com/webionate/pactas_itero'
spec.summary = %q{billwerk provides a client mapping for accessing
the Billwerk API.}
spec.description = %q{billwerk provides a client mapping for accessing
the Billwerk API, making it easy to post your data to, adn read your
data from your Billwerk account.}
spec.homepage = 'https://github.com/webionate/billwerk'
spec.license = 'MIT'

spec.files = Dir["lib/**/*.rb"] + Dir["bin/*"]
Expand Down
14 changes: 7 additions & 7 deletions lib/pactas_itero.rb → lib/billwerk.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
require 'pactas_itero/client'
require 'pactas_itero/default'
require 'billwerk/client'
require 'billwerk/default'

module PactasItero
module Billwerk
class << self
include PactasItero::Configurable
include Billwerk::Configurable

# API client based on configured options {Configurable}
#
# @return [PactasItero::Client] API wrapper
# @return [Billwerk::Client] API wrapper
def client
PactasItero::Client.new(options)
Billwerk::Client.new(options)
end

def respond_to_missing?(method_name, include_private = false)
Expand All @@ -28,4 +28,4 @@ def method_missing(method_name, *args, &block)
end
end

PactasItero.setup
Billwerk.setup
20 changes: 20 additions & 0 deletions lib/billwerk/api.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
require 'billwerk/ext/hash/camelize_keys'
require 'billwerk/api/oauth'
require 'billwerk/api/rated_items'
require 'billwerk/api/customers'
require 'billwerk/api/contracts'
require 'billwerk/api/orders'
require 'billwerk/api/invoices'
require "billwerk/api/payment_transactions"

module Billwerk
module Api
include Billwerk::Api::OAuth
include Billwerk::Api::RatedItems
include Billwerk::Api::Customers
include Billwerk::Api::Contracts
include Billwerk::Api::Orders
include Billwerk::Api::Invoices
include Billwerk::Api::PaymentTransactions
end
end
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module PactasItero
module Billwerk
module Api
module Contracts
def customer_contracts(customer_id, options = {})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module PactasItero
module Billwerk
module Api
module Customers
def create_customer(options = {})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module PactasItero
module Billwerk
module Api
module Invoices

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

module PactasItero
module Billwerk
module Api
module OAuth
def token(options = {})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module PactasItero
module Billwerk
module Api
module Orders
def create_order(options = {})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

module PactasItero
module Billwerk
module Api
module PaymentTransactions
def payment_transaction(payment_transaction_id)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module PactasItero
module Billwerk
module Api
module RatedItems
def create_rated_item(contract_id, quantity, description, price_per_unit, tax_policy_id, options = {})
Expand Down
14 changes: 7 additions & 7 deletions lib/pactas_itero/client.rb → lib/billwerk/client.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
require 'base64'
require 'rash'
require 'pactas_itero/configurable'
require 'pactas_itero/api'
require 'billwerk/configurable'
require 'billwerk/api'

module PactasItero
module Billwerk
class Client
include PactasItero::Configurable
include PactasItero::Api
include Billwerk::Configurable
include Billwerk::Api

attr_accessor :bearer_token

def initialize(options = {})
PactasItero::Configurable.keys.each do |key|
instance_variable_set(:"@#{key}", options[key] || PactasItero.instance_variable_get(:"@#{key}"))
Billwerk::Configurable.keys.each do |key|
instance_variable_set(:"@#{key}", options[key] || Billwerk.instance_variable_get(:"@#{key}"))
end
end

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
module PactasItero
module Billwerk

module Configurable
attr_accessor :bearer_token, :client_id, :client_secret, :user_agent,
:default_media_type, :middleware, :production
attr_writer :api_endpoint
class << self

# List of configurable keys for PactasItero::Client
# List of configurable keys for Billwerk::Client
def keys
@keys ||= [
:bearer_token,
Expand All @@ -28,8 +28,8 @@ def configure

# Reset configuration options to default values
def reset!
PactasItero::Configurable.keys.each do |key|
send(:"#{key}=", PactasItero::Default.options[key])
Billwerk::Configurable.keys.each do |key|
send(:"#{key}=", Billwerk::Default.options[key])
end
self
end
Expand All @@ -43,17 +43,17 @@ def api_endpoint
end

def sandbox_api_endpoint
PactasItero::Default.sandbox_api_endpoint
Billwerk::Default.sandbox_api_endpoint
end

def production_api_endpoint
PactasItero::Default.production_api_endpoint
Billwerk::Default.production_api_endpoint
end

private

def options
Hash[PactasItero::Configurable.keys.map{|key| [key, send(:"#{key}")]}]
Hash[Billwerk::Configurable.keys.map{|key| [key, send(:"#{key}")]}]
end
end
end
26 changes: 13 additions & 13 deletions lib/pactas_itero/default.rb → lib/billwerk/default.rb
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
require 'pactas_itero/response/raise_error'
require 'pactas_itero/version'
require 'billwerk/response/raise_error'
require 'billwerk/version'
require 'faraday_middleware'

module PactasItero
module Billwerk

# Default configuration options for {Client}
module Default

SANDBOX_API_ENDPOINT = "https://sandbox.billwerk.com".freeze

PRODUCTION_API_ENDPOINT = "https://itero.pactas.com".freeze
PRODUCTION_API_ENDPOINT = "https://app.billwerk.com".freeze

PRODUCTION = false

USER_AGENT = "Pactas.Itero Ruby Gem #{PactasItero::VERSION}".freeze
USER_AGENT = "Billwerk Ruby Gem #{Billwerk::VERSION}".freeze

MEDIA_TYPE = "application/json"

MIDDLEWARE = Faraday::RackBuilder.new do |builder|
builder.request :json
builder.use PactasItero::Response::RaiseError
builder.use Billwerk::Response::RaiseError
builder.response :rashify
builder.request :url_encoded
builder.response :json, :content_type => /\bjson$/
Expand All @@ -30,11 +30,11 @@ module Default
class << self

def options
Hash[PactasItero::Configurable.keys.map{|key| [key, send(key)]}]
Hash[Billwerk::Configurable.keys.map{|key| [key, send(key)]}]
end

def api_endpoint
ENV['PACTAS_ITERO_ENDPOINT']
ENV['BILLWERK_ENDPOINT']
end

def sandbox_api_endpoint
Expand All @@ -50,27 +50,27 @@ def production
end

def client_id
ENV['PACTAS_ITERO_CLIENT_ID']
ENV['BILLWERK_CLIENT_ID']
end

def client_secret
ENV['PACTAS_ITERO_CLIENT_SECRET']
ENV['BILLWERK_CLIENT_SECRET']
end

def bearer_token
ENV['PACTAS_ITERO_BEARER_TOKEN']
ENV['BILLWERK_BEARER_TOKEN']
end

def default_media_type
ENV['PACTAS_ITERO_CLIENT_DEFAULT_MEDIA_TYPE'] || MEDIA_TYPE
ENV['BILLWERK_CLIENT_DEFAULT_MEDIA_TYPE'] || MEDIA_TYPE
end

def middleware
MIDDLEWARE
end

def user_agent
ENV['PACTAS_ITERO_USER_AGENT'] || USER_AGENT
ENV['BILLWERK_USER_AGENT'] || USER_AGENT
end
end
end
Expand Down
Loading