Skip to content

Api V2 - #18

Merged
65 commits merged into
masterfrom
api_v2
Dec 11, 2017
Merged

65 commits merged into
masterfrom
api_v2

Conversation

@jtnegrotto

@jtnegrotto jtnegrotto commented Nov 8, 2017

Copy link
Copy Markdown
Contributor

This is a complete rewrite for v2. I've differed in a few ways from our SDK guidelines for the sake of an idiomatic API, e.g. having only one params hash for arguments so that Fax.create to: '...', api_key: '1234' would work without needing additional commas and braces.

Looks like the build is failing for 1.9.3 because the version of bundler they're running thinks dependencies on a particular version of Ruby are for a gem called ruby. Also, tests aren't being Run. Need to add a Rake task for running them.

@jtnegrotto
jtnegrotto requested review from a user and jnankin November 8, 2017 17:09
Comment thread .ruby-version Outdated
@@ -1 +1 @@
2.2
2.2.8

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the min required version? Should this even be checked in for a gem? Shouldn't we set required_ruby_version in gemspec instead?

Comment thread README.md Outdated
A Ruby gem for interacting with the [Phaxio API](https://www.phaxio.com/docs/api/v2).

**Note: This gem only runs on Ruby version 1.9.+**
**NOTE: Versions of this gem before 2.1.0.0 are considered "beta". Breaking changes may be more

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would we make breaking changes? :-) And why not version 2.0.0?

Comment thread README.md Outdated

gem 'phaxio'
``` ruby
gem 'phaxio', '2.1.0.0'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not '~>2.0.0' ?

Comment thread lib/phaxio/client.rb Outdated
# @api private

class Client
BASE_URL = 'https://api.phaxio.com/v2/'

@ghost ghost Dec 6, 2017

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice if it was possible to override this with something like Phaxio.api_endpoint so that we can point it to runscope, etc.

Comment thread README.md
config.api_secret = "12345678910"
end
``` ruby
Phaxio.api_key = '11111'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the ruby n00b who's using this as a tutorial, I'd include the require 'phaxio' line here too.

Comment thread lib/phaxio/resources/phone_number.rb Outdated
# A hash of parameters to send to Phaxio.
# - *country_code* [Integer] - An E.164 country code that you'd like to filter by.
# - *area_code* [Integer] - An area code that you'd like to filter by. If an area code is
# specified, then *country* is required.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/country/country_code/

Comment thread README.md Outdated
Get a list of supported countries.

``` ruby
Fax.supported_countries

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the other v2 client libs, we do something like Public::Country.list to more closely match the API path.

Comment thread README.md Outdated
# => true
```

##### `PhoneNumber.list_available_area_codes`

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about Public::AreaCode.list?

@jtnegrotto

Copy link
Copy Markdown
Contributor Author

@jpettettphaxio Those changes have been made.

Comment thread README.md Outdated
# => true
```

#### `Public::Country`

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be:

#### Countries

##### `Public::Country.list`

Comment thread README.md Outdated

#### Area Codes

##### `Public::AreaCode`

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be Public::AreaCode.list?

Comment thread README.md Outdated

``` ruby
area_codes = Public::AreaCode.list toll_free: true
# => Phaxio::Resource::Collection([Public::AreaCode(city: 'Chicago', ...), ...], page: 1)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is syntactically correct, but when toll_free is true, city will always be "Toll Free Service"

@@ -0,0 +1,77 @@
---

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file appears to be an unused duplicate of area_codes/list.yml

@ghost
ghost merged commit d6dd85d into master Dec 11, 2017
@ghost
ghost deleted the api_v2 branch December 11, 2017 21:37
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant