Skip to content
This repository was archived by the owner on Sep 30, 2022. It is now read-only.
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
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ruby-2.2.2
ruby-2.3
12 changes: 1 addition & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,17 @@
[![Build Status](https://travis-ci.org/PlugaDotCo/nfe_io-ruby.svg?branch=master)](https://travis-ci.org/PlugaDotCo/nfe_io-ruby)

# Nfe

Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/nfe`. To experiment with that code, run `bin/console` for an interactive prompt.

TODO: Delete this and the text above, and describe your gem

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'nfe'
gem 'nfe-io'
```

And then execute:

$ bundle

Or install it yourself as:

$ gem install nfe

## Usage

TODO: Write usage instructions here
Expand Down
3 changes: 2 additions & 1 deletion lib/nfe/api_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ def api_request(url, method, params=nil)
rescue RestClient::Exception => e
raise e
end
JSON.parse(response.to_str)
return { } if response == nil || response.empty?
JSON.parse(response)
end

def self.included(base)
Expand Down
9 changes: 4 additions & 5 deletions lib/nfe/nfe_object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,10 @@ def to_hash
list.push(obj.respond_to?(:to_hash) ? obj.to_hash : value)
end
result[key] = list
else if value.respond_to?(:to_hash)
result[key] = value.to_hash
else
result[key] = value
end
elsif value.respond_to?(:to_hash)
result[key] = value.to_hash
else
result[key] = value
end
result
end
Expand Down