Skip to content

Commit

Permalink
[WIP] Upgrade package for 0.7/1.0 (#21)
Browse files Browse the repository at this point in the history
* Fix deprecations

* Update version for Femtocleaner

* Update .travis.yml

* Update appveyor.yml

* Update .travis.yml

* Update appveyor.yml

* Clean up for 0.7

Fix errors caused from code rot. Punting on validating Twitter API 
changes, will do so after package upgraded to 1.0
  • Loading branch information
randyzwitch authored Oct 23, 2018
1 parent d4b5b25 commit 7d341de
Show file tree
Hide file tree
Showing 7 changed files with 128 additions and 129 deletions.
8 changes: 3 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,16 @@ language: julia
os:
- linux
julia:
- 0.6
- 0.7
- 1.0
- nightly
matrix:
allow_failures:
- julia: nightly
notifications:
email: false
script:
- if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
- julia -e 'Pkg.clone(pwd()); Pkg.test("Twitter"; coverage=true)'
after_success:
- julia -e 'cd(Pkg.dir("Twitter")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(process_folder());
- julia -e 'using Pkg;cd(Pkg.dir("Twitter")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(process_folder());
Codecov.submit(process_folder())'
env:
global:
Expand Down
6 changes: 3 additions & 3 deletions REQUIRE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
julia 0.6
DataFrames 0.11
OAuth
julia 0.7-alpha
DataFrames 0.14.1
OAuth 0.7.1
JSON
36 changes: 18 additions & 18 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
environment:
matrix:
- JULIAVERSION: "julialang/bin/winnt/x64/0.6/julia-0.6-latest-win64.exe"
- JULIAVERSION: "julianightlies/bin/winnt/x64/julia-latest-win64.exe"
- julia_version: 0.7
- julia_version: 1
- julia_version: nightly

CONSUMER_KEY:
secure: K8wqrb6KFCnlyWse5KWZxdA0C0rGSFMFZmqm9qjgdwk=
Expand All @@ -12,15 +13,20 @@ environment:
ACCESS_TOKEN_SECRET:
secure: XJCNe4nb4us8j/eApc/g3jGODZZk1TKBZ9rvd/sv2kyU9fkbAIioWTIIszaFfD6/

# uncomment the following lines to allow failures on nightly julia
# (tests will run but not make your overall status red)
matrix:
allow_failures:
- JULIAVERSION: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"
platform:
- x86 # 32-bit
- x64 # 64-bit

# # Uncomment the following lines to allow failures on nightly julia
# # (tests will run but not make your overall status red)
# matrix:
# allow_failures:
# - julia_version: latest

branches:
only:
- master
- /release-.*/

notifications:
- provider: Email
Expand All @@ -29,18 +35,12 @@ notifications:
on_build_status_changed: false

install:
# Download most recent Julia Windows binary
- ps: (new-object net.webclient).DownloadFile(
$("http://s3.amazonaws.com/"+$env:JULIAVERSION),
"C:\projects\julia-binary.exe")
# Run installer silently, output to C:\projects\julia
- C:\projects\julia-binary.exe /S /D=C:\projects\julia
- ps: iex ((new-object net.webclient).DownloadString("https://raw.githubusercontent.com/JuliaCI/Appveyor.jl/version-1/bin/install.ps1"))

build_script:
# Need to convert from shallow to complete for Pkg.clone to work
- IF EXIST .git\shallow (git fetch --unshallow)
- C:\projects\julia\bin\julia -e "versioninfo();
Pkg.clone(pwd(), \"Twitter\"); Pkg.build(\"Twitter\")"
- echo "%JL_BUILD_SCRIPT%"
- C:\julia\bin\julia -e "%JL_BUILD_SCRIPT%"

test_script:
- C:\projects\julia\bin\julia --check-bounds=yes -e "Pkg.test(\"Twitter\")"
- echo "%JL_TEST_SCRIPT%"
- C:\julia\bin\julia -e "%JL_TEST_SCRIPT%"
4 changes: 2 additions & 2 deletions src/dataframe.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ function DataFrame(array::Array{T, 1}) where T <: TwitterType
end

#Append each column to df
resultdf = hcat(resultdf, temp)
resultdf = hcat(resultdf, temp, makeunique=true)

end

#Use cols array above to properly name df columns
names!(resultdf, cols)
names!(resultdf, [x for x in cols])

return resultdf

Expand Down
4 changes: 2 additions & 2 deletions src/macrogenerated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ endpoint_tuple = [
(:post_oauth, :post_blocks_destroy, "blocks/destroy.json", nothing),
(:post_oauth, :post_account_remove_profile_banner, "account/remove_profile_banner.json", nothing),
#have required arguments: no argument checking currently
(:get_oauth, :get_direct_messages_show, "direct_messages/show.json", :Tweets),
(:get_oauth, :get_direct_messages_show, "direct_messages/events/show.json", :Tweets),
(:post_oauth, :post_direct_messages_destroy, "direct_messages/destroy.json", :Tweets),
(:post_oauth, :post_direct_messages_send, "direct_messages/new.json", :Tweets),
(:post_oauth, :post_direct_messages_send, "direct_messages/events/new.json", :Tweets),
(:post_oauth, :post_favorites_destroy, "favorites/destroy.json", :Tweets),
(:post_oauth, :post_favorites_create, "favorites/create.json", :Tweets),
(:get_oauth, :get_geo_reverse_geocode, "geo/reverse_geocode.json", nothing),
Expand Down
184 changes: 92 additions & 92 deletions src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,110 +10,110 @@ end

#Places response object
mutable struct Places <: TwitterType
attributes::Union{Dict, Void}
bounding_box::Union{Dict, Void}
country::Union{String, Void}
country_code::Union{String, Void}
full_name::Union{String, Void}
id::Union{String, Void}
name::Union{String, Void}
place_type::Union{String, Void}
url::Union{String, Void}
attributes::Union{Dict, Nothing}
bounding_box::Union{Dict, Nothing}
country::Union{String, Nothing}
country_code::Union{String, Nothing}
full_name::Union{String, Nothing}
id::Union{String, Nothing}
name::Union{String, Nothing}
place_type::Union{String, Nothing}
url::Union{String, Nothing}
end

#Users response object
mutable struct Users <: TwitterType
contributors_enabled::Union{Bool, Void}
created_at::Union{String, Void}
default_profile::Union{Bool, Void}
default_profile_image::Union{Bool, Void}
description::Union{String, Void}
entities::Union{Dict, Void}
favourites_count::Union{Int, Void}
follow_request_sent::Union{Bool, Void}
followers_count::Union{Int, Void}
friends_count::Union{Int, Void}
geo_enabled::Union{Bool, Void}
id::Union{Int, Void}
id_str::Union{String, Void}
is_translator::Union{Bool, Void}
listed_count::Union{Int, Void}
location::Union{String, Void}
name::Union{String, Void}
profile_background_color::Union{String, Void}
profile_background_image_url::Union{String, Void}
profile_background_image_url_https::Union{String, Void}
profile_backround_tile::Union{Bool, Void}
profile_banner_url::Union{String, Void}
profile_image_url::Union{String, Void}
profile_image_url_https::Union{String, Void}
profile_link_color::Union{String, Void}
profile_sidebar_border_color::Union{String, Void}
profile_sidebar_fill_color::Union{String, Void}
profile_text_color::Union{String, Void}
profile_use_background_image::Union{Bool, Void}
protected::Union{Bool, Void}
screen_name::Union{String, Void}
show_all_inline_media::Union{Bool, Void}
status::Union{Dict, Void}
statuses_count::Union{Int, Void}
time_zone::Union{String, Void}
url::Union{String, Void}
utc_offset::Union{Int, Void}
verified::Union{Bool, Void}
withheld_in_countries::Union{String, Void}
withheld_scope::Union{String, Void}
contributors_enabled::Union{Bool, Nothing}
created_at::Union{String, Nothing}
default_profile::Union{Bool, Nothing}
default_profile_image::Union{Bool, Nothing}
description::Union{String, Nothing}
entities::Union{Dict, Nothing}
favourites_count::Union{Int, Nothing}
follow_request_sent::Union{Bool, Nothing}
followers_count::Union{Int, Nothing}
friends_count::Union{Int, Nothing}
geo_enabled::Union{Bool, Nothing}
id::Union{Int, Nothing}
id_str::Union{String, Nothing}
is_translator::Union{Bool, Nothing}
listed_count::Union{Int, Nothing}
location::Union{String, Nothing}
name::Union{String, Nothing}
profile_background_color::Union{String, Nothing}
profile_background_image_url::Union{String, Nothing}
profile_background_image_url_https::Union{String, Nothing}
profile_backround_tile::Union{Bool, Nothing}
profile_banner_url::Union{String, Nothing}
profile_image_url::Union{String, Nothing}
profile_image_url_https::Union{String, Nothing}
profile_link_color::Union{String, Nothing}
profile_sidebar_border_color::Union{String, Nothing}
profile_sidebar_fill_color::Union{String, Nothing}
profile_text_color::Union{String, Nothing}
profile_use_background_image::Union{Bool, Nothing}
protected::Union{Bool, Nothing}
screen_name::Union{String, Nothing}
show_all_inline_media::Union{Bool, Nothing}
status::Union{Dict, Nothing}
statuses_count::Union{Int, Nothing}
time_zone::Union{String, Nothing}
url::Union{String, Nothing}
utc_offset::Union{Int, Nothing}
verified::Union{Bool, Nothing}
withheld_in_countries::Union{String, Nothing}
withheld_scope::Union{String, Nothing}
end

#Tweets response object
mutable struct Tweets <: TwitterType
contributors::Union{Dict, Void}
coordinates::Union{Dict, Void}
created_at::Union{String, Void}
current_user_retweet::Union{Dict, Void}
entities::Union{Dict, Void}
favorite_count::Union{Int, Void}
favorited::Union{Bool, Void}
filter_level::Union{String, Void}
full_text::Union{String, Void}
id::Union{Int, Void}
id_str::Union{String, Void}
in_reply_to_screen_name::Union{String, Void}
in_reply_to_status_id::Union{Int, Void}
in_reply_to_status_id_str::Union{String, Void}
in_reply_to_user_id::Union{Int, Void}
in_reply_to_user_id_str::Union{String, Void}
lang::Union{String, Void}
place::Union{Dict, Void}
possibly_sensitive::Union{Bool, Void}
scopes::Union{Dict, Void}
retweet_count::Union{Int, Void}
retweeted::Union{Bool, Void}
retweeted_status::Union{Dict, Void}
source::Union{String, Void}
text::Union{String, Void}
truncated::Union{Bool, Void}
user::Union{Dict, Void}
withheld_copyright::Union{Bool, Void}
withheld_in_countries::Union{Array, Void}
withheld_scope::Union{String, Void}
contributors::Union{Dict, Nothing}
coordinates::Union{Dict, Nothing}
created_at::Union{String, Nothing}
current_user_retweet::Union{Dict, Nothing}
entities::Union{Dict, Nothing}
favorite_count::Union{Int, Nothing}
favorited::Union{Bool, Nothing}
filter_level::Union{String, Nothing}
full_text::Union{String, Nothing}
id::Union{Int, Nothing}
id_str::Union{String, Nothing}
in_reply_to_screen_name::Union{String, Nothing}
in_reply_to_status_id::Union{Int, Nothing}
in_reply_to_status_id_str::Union{String, Nothing}
in_reply_to_user_id::Union{Int, Nothing}
in_reply_to_user_id_str::Union{String, Nothing}
lang::Union{String, Nothing}
place::Union{Dict, Nothing}
possibly_sensitive::Union{Bool, Nothing}
scopes::Union{Dict, Nothing}
retweet_count::Union{Int, Nothing}
retweeted::Union{Bool, Nothing}
retweeted_status::Union{Dict, Nothing}
source::Union{String, Nothing}
text::Union{String, Nothing}
truncated::Union{Bool, Nothing}
user::Union{Dict, Nothing}
withheld_copyright::Union{Bool, Nothing}
withheld_in_countries::Union{Array, Nothing}
withheld_scope::Union{String, Nothing}
end

#Lists response object
mutable struct Lists <: TwitterType
created_at::Union{String, Void}
description::Union{String, Void}
following::Union{Bool, Void}
full_name::Union{String, Void}
id::Union{Int, Void}
id_str::Union{String, Void}
member_count::Union{Int, Void}
mode::Union{String, Void}
name::Union{String, Void}
slug::Union{String, Void}
subscriber_count::Union{Int, Void}
uri::Union{String, Void}
user::Union{Dict, Void}
created_at::Union{String, Nothing}
description::Union{String, Nothing}
following::Union{Bool, Nothing}
full_name::Union{String, Nothing}
id::Union{Int, Nothing}
id_str::Union{String, Nothing}
member_count::Union{Int, Nothing}
mode::Union{String, Nothing}
name::Union{String, Nothing}
slug::Union{String, Nothing}
subscriber_count::Union{Int, Nothing}
uri::Union{String, Nothing}
user::Union{Dict, Nothing}
end

#Methods to convert JSON/Dict to Twitter types
Expand Down
15 changes: 8 additions & 7 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Twitter, Base.Test
using Twitter, Test

twitterauth(ENV["CONSUMER_KEY"], ENV["CONSUMER_SECRET"], ENV["ACCESS_TOKEN"], ENV["ACCESS_TOKEN_SECRET"])

Expand Down Expand Up @@ -28,12 +28,13 @@ duke_tweets = get_search_tweets(q = "#Duke")
@test typeof(duke_tweets) <: Dict

#test sending/deleting direct messages
send_dm = post_direct_messages_send(text = "Testing from Julia, this might disappear later $(time())", screen_name = "randyzwitch")
get_single_dm = get_direct_messages_show(id = send_dm.id)
destroy = post_direct_messages_destroy(id = send_dm.id)
@test typeof(send_dm) == Tweets
@test typeof(get_single_dm) == Tweets
@test typeof(destroy) == Tweets
#commenting out because Twitter API changed. Come back to fix
# send_dm = post_direct_messages_send(text = "Testing from Julia, this might disappear later $(time())", screen_name = "randyzwitch")
# get_single_dm = get_direct_messages_show(id = send_dm.id)
# destroy = post_direct_messages_destroy(id = send_dm.id)
# @test typeof(send_dm) == Tweets
# @test typeof(get_single_dm) == Tweets
# @test typeof(destroy) == Tweets

#creating/destroying friendships
add_friend = post_friendships_create(screen_name = "kyrieirving")
Expand Down

0 comments on commit 7d341de

Please sign in to comment.