Skip to content

Commit

Permalink
2.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Joey French committed Aug 4, 2016
1 parent 798a123 commit 10ce64e
Show file tree
Hide file tree
Showing 31 changed files with 748 additions and 200 deletions.
21 changes: 21 additions & 0 deletions lib/VBA-Dictionary/LICENSE
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2016 Tim Hall

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
1 change: 1 addition & 0 deletions lib/VBA-Dictionary/readme.md
Expand Up @@ -50,6 +50,7 @@ Dict("C") ' -> Empty
#### 1.4.0

- Fix indexing issues for `Keys` and `Items`
- __1.4.1__ Add descriptions for Object Browser

#### 1.3.0

Expand Down
12 changes: 12 additions & 0 deletions lib/VBA-Web/CHANGELOG.md
@@ -1,3 +1,15 @@
# 4.1.0

- Update `UrlEncode` behavior to target different encoding RFCs based on `UrlEncodingMode`
- Add `UrlEncodingMode` with support for `Strict`, `Form`, `Query`, `Cookie`, and `Path`
- `UrlEncodingMode.StrictUrlEncoding` uses [RFC 3986](https://tools.ietf.org/html/rfc3986) and is the default
- `UrlEncodingMode.FormUrlEncoding` uses HTML5 form url-encoding and is used with `WebFormat.FormUrlEncoded`
- `UrlEncodingMode.QueryUrlEncoding` uses subset of `Strict` and `Form` for default querystring encoding
- `UrlEncodingMode.CookieUrlEncoding` uses [RFC 6265](https://tools.ietf.org/html/rfc6265)
- `UrlEncodingMode.PathUrlEncoding` uses "pchar" from [RFC 3986](https://tools.ietf.org/html/rfc3986) and is the default
- Update VBA-JSON to v2.2.2
- __4.1.1__ Adjust `CookieUrlEncoding` mode to match value encoding in RFC 6265 (rather than name encoding)

# 4.0.0

Major Changes:
Expand Down
2 changes: 1 addition & 1 deletion lib/VBA-Web/LICENSE
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2015 Tim Hall
Copyright (c) 2016 Tim Hall

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion lib/VBA-Web/README.md
Expand Up @@ -6,7 +6,7 @@ VBA-Web (formerly Excel-REST) makes working with complex webservices and APIs ea
Getting started
---------------

- Download the [latest release (v4.0.22)](https://github.com/VBA-tools/VBA-Web/releases)
- Download the [latest release (v4.1.1)](https://github.com/VBA-tools/VBA-Web/releases)
- To install/upgrade in an existing file, use `VBA-Web - Installer.xlsm`
- To start from scratch in Excel, `VBA-Web - Blank.xlsm` has everything setup and ready to go

Expand Down
Binary file modified lib/VBA-Web/VBA-Web - Blank.xlsm
Binary file not shown.
Binary file modified lib/VBA-Web/VBA-Web - Installer.xlsm
Binary file not shown.
2 changes: 1 addition & 1 deletion lib/VBA-Web/authenticators/DigestAuthenticator.cls
Expand Up @@ -8,7 +8,7 @@ Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
''
' Digest Authenticator v3.0.0
' Digest Authenticator v3.0.8
' (c) Tim Hall - https://github.com/VBA-tools/VBA-Web
'
' Custom IWebAuthenticator for Digest Authentication
Expand Down
2 changes: 1 addition & 1 deletion lib/VBA-Web/authenticators/FacebookAuthenticator.cls
Expand Up @@ -8,7 +8,7 @@ Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
''
' Facebook Authenticator v3.0.0
' Facebook Authenticator v3.0.6
' (c) Tim Hall - https://github.com/VBA-tools/VBA-Web
'
' Custom IWebAuthenticator for Facebook
Expand Down
2 changes: 1 addition & 1 deletion lib/VBA-Web/authenticators/GoogleAuthenticator.cls
Expand Up @@ -8,7 +8,7 @@ Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
''
' Google Authenticator v3.0.0
' Google Authenticator v3.0.8
' (c) Tim Hall - https://github.com/VBA-tools/VBA-Web
'
' Custom IWebAuthenticator for "installed application" authentication for Google APIs
Expand Down
2 changes: 1 addition & 1 deletion lib/VBA-Web/authenticators/HttpBasicAuthenticator.cls
Expand Up @@ -8,7 +8,7 @@ Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
''
' Http Basic Authenticator v3.0.0
' Http Basic Authenticator v3.0.5
' (c) Tim Hall - https://github.com/VBA-tools/VBA-Web
'
' Custom IWebAuthenticator for Http Basic Authenticator
Expand Down
4 changes: 2 additions & 2 deletions lib/VBA-Web/authenticators/OAuth1Authenticator.cls
Expand Up @@ -8,7 +8,7 @@ Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
''
' OAuth1 Authenticator v3.0.0
' OAuth1 Authenticator v3.0.6
' (c) Tim Hall - https://github.com/VBA-tools/VBA-Web
'
' OAuth1 authenticator
Expand Down Expand Up @@ -188,7 +188,7 @@ Public Function CreateBaseString(auth_Nonce As String, auth_Timestamp As String,
auth_Base = VBA.Join(auth_Parameters, "&")

CreateBaseString = WebHelpers.MethodToName(auth_Request.Method) & "&" & _
WebHelpers.UrlEncode(GetRequestUrl(auth_Client, auth_Request), EncodeUnsafe:=False) & "&" & _
WebHelpers.UrlEncode(GetRequestUrl(auth_Client, auth_Request)) & "&" & _
WebHelpers.UrlEncode(auth_Base)
End Function

Expand Down
2 changes: 1 addition & 1 deletion lib/VBA-Web/authenticators/OAuth2Authenticator.cls
Expand Up @@ -8,7 +8,7 @@ Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
''
' OAuth2 Authenticator v3.0.0
' OAuth2 Authenticator v3.0.5
' (c) Tim Hall - https://github.com/VBA-tools/VBA-Web
'
' OAuth2 authenticator
Expand Down
48 changes: 24 additions & 24 deletions lib/VBA-Web/authenticators/TodoistAuthenticator.cls
Expand Up @@ -6,9 +6,9 @@ Attribute VB_Name = "TodoistAuthenticator"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Attribute VB_Exposed = True
''
' Todoist Authenticator
' Todoist Authenticator v3.0.8
' (c) Tim Hall - https://github.com/VBA-tools/VBA-Web
' Mauricio Souza (mauriciojxs@yahoo.com.br)
'
Expand Down Expand Up @@ -100,7 +100,7 @@ Public Sub Login()
If Me.AuthorizationCode <> "" Or Me.Token <> "" Then
Exit Sub
End If

Dim auth_Completed As Boolean
If Me.State = "" Then
Me.State = WebHelpers.CreateNonce
Expand All @@ -110,15 +110,15 @@ Public Sub Login()
' User retrieves and pastes token for Mac login
Dim auth_Response As String
auth_Completed = True

auth_Response = VBA.InputBox("To login to Todoist, insert your API token from" & vbNewLine & _
"todoist.com > Settings > Todoist Settings > Account > API token", _
Title:="Insert Todoist API Token")

If auth_Response = "" Then
Err.Raise 11040 + vbObjectError, "OAuthDialog", "Login was cancelled"
End If

' Success!
Me.Token = auth_Response
#Else
Expand All @@ -133,7 +133,7 @@ Public Sub Login()
auth_IE.AddressBar = False
auth_IE.Navigate Me.GetLoginUrl
auth_IE.Visible = True

Do While Not auth_LoginIsComplete(auth_IE)
DoEvents
Loop
Expand Down Expand Up @@ -163,7 +163,7 @@ auth_Cleanup:
auth_ErrorHandling:

Dim auth_ErrorDescription As String

auth_ErrorDescription = "An error occurred while logging in." & vbNewLine
If Err.Number <> 0 Then
If Err.Number - vbObjectError <> 11040 Then
Expand Down Expand Up @@ -197,11 +197,11 @@ Public Function GetLoginUrl() As String
' Use Request for Url helpers
Dim auth_Request As New WebRequest
auth_Request.Resource = auth_AuthorizationUrl

auth_Request.AddQuerystringParam "client_id", Me.ClientId
auth_Request.AddQuerystringParam "scope", Me.Scope
auth_Request.AddQuerystringParam "state", Me.State

GetLoginUrl = auth_Request.FormattedResource
Set auth_Request = Nothing
End Function
Expand All @@ -217,10 +217,10 @@ Private Sub IWebAuthenticator_BeforeExecute(ByVal Client As WebClient, ByRef Req
If Me.AuthorizationCode = "" Then
Me.Login
End If

Me.Token = Me.GetToken(Client)
End If

' Add token as querystring param
Request.AddQuerystringParam "token", Me.Token
End Sub
Expand Down Expand Up @@ -267,55 +267,55 @@ End Sub
''
Public Function GetToken(Client As WebClient) As String
On Error GoTo auth_Cleanup

Dim auth_TokenClient As WebClient
Dim auth_Request As New WebRequest
Dim auth_Body As New Dictionary
Dim auth_Response As WebResponse
Dim auth_Cookie As Variant

' Clone client (to avoid accidental interactions)
Set auth_TokenClient = Client.Clone
Set auth_TokenClient.Authenticator = Nothing
auth_TokenClient.BaseUrl = auth_BaseUrl

' Prepare token request
auth_Request.Resource = auth_TokenResource
auth_Request.Method = WebMethod.HttpPost
auth_Request.RequestFormat = WebFormat.FormUrlEncoded
auth_Request.ResponseFormat = WebFormat.Json

auth_Body.Add "code", Me.AuthorizationCode
auth_Body.Add "client_id", Me.ClientId
auth_Body.Add "client_secret", Me.ClientSecret
Set auth_Request.Body = auth_Body

Set auth_Response = auth_TokenClient.Execute(auth_Request)

If auth_Response.StatusCode = WebStatusCode.Ok Then
GetToken = auth_Response.Data(auth_TokenResource)
Else
Err.Raise 11041 + vbObjectError, "TodoistAuthenticator.GetToken", _
auth_Response.StatusCode & ": " & auth_Response.Content
End If

auth_Cleanup:

Set auth_TokenClient = Nothing
Set auth_Request = Nothing
Set auth_Response = Nothing

' Rethrow error
If Err.Number <> 0 Then
Dim auth_ErrorDescription As String

auth_ErrorDescription = "An error occurred while retrieving token." & vbNewLine
If Err.Number - vbObjectError <> 11041 Then
auth_ErrorDescription = auth_ErrorDescription & _
Err.Number & VBA.IIf(Err.Number < 0, " (" & VBA.LCase$(VBA.Hex$(Err.Number)) & ")", "") & ": "
End If
auth_ErrorDescription = auth_ErrorDescription & Err.Description

WebHelpers.LogError auth_ErrorDescription, "TodoistAuthenticator.GetToken", 11041 + vbObjectError
Err.Raise 11041 + vbObjectError, "TodoistAuthenticator.GetToken", auth_ErrorDescription
End If
Expand Down Expand Up @@ -345,7 +345,7 @@ Private Function auth_LoginIsDenied(auth_IE As Object) As Boolean
Dim auth_Querystring As Dictionary
Set auth_UrlParts = WebHelpers.GetUrlParts(auth_IE.LocationURL)
Set auth_Querystring = WebHelpers.ParseUrlEncoded(auth_UrlParts("Querystring"))

If auth_Querystring.Exists("error") Then
If auth_Querystring("error") = "access_denied" Then
auth_LoginIsDenied = True
Expand Down
2 changes: 1 addition & 1 deletion lib/VBA-Web/authenticators/TwitterAuthenticator.cls
Expand Up @@ -8,7 +8,7 @@ Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
''
' Twitter Authenticator v3.0.0
' Twitter Authenticator v3.0.5
' (c) Tim Hall - https://github.com/VBA-tools/VBA-Web
'
' Custom IWebAuthenticator for application-only authentication in Twitter's V1.1 REST API
Expand Down
Binary file modified lib/VBA-Web/examples/VBA-Web - Example.xlsm
Binary file not shown.
4 changes: 2 additions & 2 deletions lib/VBA-Web/specs/Specs_OAuth1Authenticator.bas
Expand Up @@ -60,7 +60,7 @@ Public Function Specs() As SpecSuite
Request.AddQuerystringParam "c", "Howdy!"
Request.AddQuerystringParam "d", 789

.Expect(Auth.GetRequestParameters(Client, Request)).ToEqual "a=123&b=456&c=Howdy!&d=789"
.Expect(Auth.GetRequestParameters(Client, Request)).ToEqual "a=123&b=456&c=Howdy%21&d=789"
End With

With Specs.It("should handle spaces in parameters correctly")
Expand All @@ -70,7 +70,7 @@ Public Function Specs() As SpecSuite
Request.AddQuerystringParam "a", "a b"

.Expect(Auth.GetRequestParameters(Client, Request)).ToEqual "a=a%20b"
.Expect(Client.GetFullUrl(Request)).ToEqual "http://localhost:3000/testing?a=a+b"
.Expect(Client.GetFullUrl(Request)).ToEqual "http://localhost:3000/testing?a=a%20b"
End With

With Specs.It("should sort querystring parameters")
Expand Down
2 changes: 1 addition & 1 deletion lib/VBA-Web/specs/Specs_WebClient.bas
Expand Up @@ -332,7 +332,7 @@ Public Function Specs() As SpecSuite

Set Response = Client.Execute(Request)
.Expect(Response.StatusCode).ToEqual 408
.Expect(Response.StatusDescription).ToEqual "Request Timeout"
.Expect(Response.StatusDescription).ToMatch "Request Timeout"
End With

' ============================================= '
Expand Down

0 comments on commit 10ce64e

Please sign in to comment.