Skip to content

Change client to webclient #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ The [Slack Web API](https://api.slack.com/web) is made up of HTTP RPC-style meth
You start by creating a `Client` with the access token you want to use. You can make calls to each [type](https://api.slack.com/types) using the [methods](https://api.slack.com/methods).

```
client = Slack.client(access_token: "your-access-token")
client = Slack.web_client(access_token: "your-access-token")
```

### Channels
Expand Down
6 changes: 3 additions & 3 deletions lib/laziness.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
require 'laziness/auth'
require 'laziness/channel'
require 'laziness/chat'
require 'laziness/client'
require 'laziness/web_client'

Choose a reason for hiding this comment

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

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

require 'laziness/errors'
require 'laziness/group'
require 'laziness/message'
Expand All @@ -17,8 +17,8 @@

module Slack
class << self
def client(attributes={})
Slack::Client.new(attributes[:access_token])
def web_client(attributes={})

Choose a reason for hiding this comment

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

Surrounding space missing in default value assignment.

Slack::WebClient.new(attributes[:access_token])
end
end
end
2 changes: 1 addition & 1 deletion lib/laziness/client.rb → lib/laziness/web_client.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Slack
class Client
class WebClient
attr_reader :access_token

def initialize(access_token=nil)
Expand Down
9 changes: 0 additions & 9 deletions spec/laziness/client_spec.rb

This file was deleted.

2 changes: 1 addition & 1 deletion spec/laziness/errors_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
describe 'API errors' do
let(:access_token) { "12345" }
subject { Slack::Client.new access_token }
subject { Slack::WebClient.new access_token }

# user_not_visible - The requested user is not visible to the calling user

Expand Down
9 changes: 9 additions & 0 deletions spec/laziness/web_client_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
describe Slack::WebClient do
it "returns a new client" do
expect(Slack.web_client(access_token: "blah")).to be_instance_of Slack::WebClient

Choose a reason for hiding this comment

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

Line is too long. [85/80]

end

it "assigns the access token" do
expect(Slack.web_client(access_token: "blah").access_token).to eq "blah"
end
end