Skip to content
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

V3 updates #50

Merged
merged 23 commits into from
Mar 31, 2017
Merged

V3 updates #50

merged 23 commits into from
Mar 31, 2017

Conversation

daria-lamberson
Copy link
Contributor

As according to V3 cleanup page; endpoint modification should not be done in the wrapper.

# "messages" => [],
# "carrier_account" => "4b1940bc69524163b669asd361842db",
# "test" => true
# {
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you add anything or modify anything or just adjust the syntax? If it is the former, could you please point out which one you added or modified?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

all that changed is 1. styling so it's more readable imo, and 2. fields for v3 were changed according to the confluence page

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fields that were changed:

  • servicelevel_[attr] go into a servicelevel dict
  • delete trackable
  • delete insurance fields (this info is in the shipment)
  • remove delivery_attempts, outbound_endpoint and inbound_endpoint


```ruby
ap @shipment.rates_list.first
ap @shipment.rates.first
Copy link
Contributor

Choose a reason for hiding this comment

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

So we change the key from rates_list to rates in the response?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yea

# "rates_url" => "https://api.goshippo.com/v1/shipments/a336daf87a8e442992a68daa6622758f/rates/",
# "messages" => [ ] # ommitted for brevity,
# "rates_list" => [ ] # ommitted for brevity.
# "carrier_accounts" => [],
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as my another comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah just the spacing seemed strange to me, and here's what changed apart from that:

  • address fields are expanded instead of being ids
  • submission_date --> shipment_date
  • return_of --> is_return
  • insurance and references inside extra
  • delete rates_url
  • rates_list --> rates

README.md Outdated
address_from: {
object_purpose: 'PURCHASE',
is_complete: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

Just to make sure. No more object_purpose in the payload, huh?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

right but also refresh to the last commit -- no is_complete, either.

README.md Outdated
# :created => 2016-07-06 20:44:47 UTC,
# :updated => 2016-07-06 20:44:47 UTC,
# :owner => "valued_customer@gmail.com",
# :state => #<Shippo::API::Category::State:0x007fd88be8aa38 @name=:state, @value=:valid>,

Choose a reason for hiding this comment

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

object_state and object_purpose should be removed from shipment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ooh thank you

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

@@ -94,66 +90,62 @@ params = { object_purpose: 'PURCHASE',
Let's take a quick look at what the `Shipment` object looks like:

Choose a reason for hiding this comment

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

should remove @shipment.state from here, 5 lines up ^

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

@@ -78,7 +74,7 @@ def mk_opts(property)

# list of allowed properties, of a given type.
PROPS_ID = %i(id).freeze
PROPS_CATEG = %i(state purpose source status results).freeze
PROPS_CATEG = %i(state status results).freeze
Copy link
Contributor Author

Choose a reason for hiding this comment

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

per Guozhen's notes: object_purpose and object_source are removed everywhere, object_state is removed from address, shipment and rates

README.md Outdated
# "content" => "",
# "provider" => "FEDEX"
# },
# "is_return" => nil,

Choose a reason for hiding this comment

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

we're looking to have is_return have a default False value (schema migration pending) - so it shouldn't ever end up being null

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

it 'should include Shippo-API-Version in header if one is specified' do
expect(api_request.headers[:'Shippo-API-Version']).to eql("2016-10-25")
expect(api_request.headers[:'Shippo-API-Version']).to eql("2017-03-29")
Copy link
Contributor

Choose a reason for hiding this comment

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

So the test should always use v3?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this one does to test the headers (see line 18 above)

Copy link
Contributor

Choose a reason for hiding this comment

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

Got you.

@@ -213,18 +201,15 @@ Finally, here is how we access the rest of the `object_` fields:
# ⤷ valued_customer@gmail.com
```

Here is the fully construted `ApiObject` instance, attached to our `@shipment`:
Here is the fully constructed `ApiObject` instance, attached to our `@shipment`:
Copy link
Contributor

Choose a reason for hiding this comment

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

Good catch. lolol

README.md Outdated
# "messages" => [ ] # ommitted for brevity,
# "rates_list" => [ ] # ommitted for brevity.
# "carrier_accounts" => [],
# "address_from" => [ ... ], # omitted for brevity
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we sure to omit the addresses? Maybe show one of them at least?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

in v3 they should be expanded fields and not object ids (which is why I removed them and put ...)
if you think there should be an example instead, I can put it in

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I think it would be better. :)

Copy link
Contributor

@wenwei1030 wenwei1030 left a comment

Choose a reason for hiding this comment

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

Over looks good. Just a couple small comments.

@wenwei1030
Copy link
Contributor

Also, one last thing, you want to update the version of the gem too.

@wenwei1030
Copy link
Contributor

Also, it might be out of scope your task, but we should update readme for v3 or at least mention the response are for v3? Did I miss that?

@wenwei1030
Copy link
Contributor

Just one comment on expanding parcel, but I am gonna approve now. Thanks for making the changes. :)

@daria-lamberson daria-lamberson merged commit 2486419 into master Mar 31, 2017
@daria-lamberson daria-lamberson deleted the v3-updates branch March 31, 2017 20:19
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.

3 participants