Class: Top4R::Trade
- Inherits:
-
Object
- Object
- Top4R::Trade
- Includes:
- ModelMixin
- Defined in:
- lib/top4r/model/trade.rb
Overview
Trade model
Constant Summary collapse
- @@ATTRIBUTES =
[:id, :seller_nick, :buyer_nick, :title, :type, :created, :iid, :price, :pic_path, :num, :tid, :buyer_message, :sid, :shipping_type, :alipay_no, :payment, :discount_fee, :adjust_fee, :snapshot_url, :status, :seller_rate, :buyer_rate, :buyer_memo, :seller_memo, :pay_time, :end_time, :modified, :buyer_obtain_point_fee, :point_fee, :real_point_fee, :total_fee, :post_fee, :buyer_alipay_no, :receiver_name, :receiver_state, :receiver_city, :receiver_district, :receiver_address, :receiver_zip, :receiver_mobile, :receiver_phone, :consign_time, :buyer_email, :commission_fee, :seller_alipay_no, :seller_mobile, :seller_phone, :seller_name, :seller_email, :available_confirm_fee, :has_postFee, :received_payment, :cod_fee, :timeout_action_time, :orders]
Class Method Summary collapse
Instance Method Summary collapse
- #add_memo(memo) ⇒ Object
- #close(reason = "现关闭本交易!") ⇒ Object
- #confirm_fees ⇒ Object
- #deliver(options = {}) {|delivery| ... } ⇒ Object
- #unmarshal_other_attrs ⇒ Object
- #update_memo(memo) ⇒ Object
Methods included from ModelMixin
Class Method Details
.attributes ⇒ Object
61 |
# File 'lib/top4r/model/trade.rb', line 61 def attributes; @@ATTRIBUTES; end |
.default_public_fields ⇒ Object
63 64 65 66 67 |
# File 'lib/top4r/model/trade.rb', line 63 def default_public_fields ["buyer_nick", "seller_nick", "tid", "modified", "title", "type", "status", "created", "price", "sid", "pic_path", "iid", "payment", "alipay_no", "shipping_type", "pay_time", "end_time", "orders"] + Top4R::Order.default_public_fields end |
Instance Method Details
#add_memo(memo) ⇒ Object
74 75 76 77 |
# File 'lib/top4r/model/trade.rb', line 74 def add_memo(memo) valid_memo(memo) @client.trade(@tid, :add_memo, {:memo => memo}) end |
#close(reason = "现关闭本交易!") ⇒ Object
70 71 72 |
# File 'lib/top4r/model/trade.rb', line 70 def close(reason = "现关闭本交易!") @client.trade(@tid, :close, {:close_reason => reason}) end |
#confirm_fees ⇒ Object
84 85 86 |
# File 'lib/top4r/model/trade.rb', line 84 def confirm_fees @client.trade(@tid, :confirmfee, {:is_detail => "IS_FATHER"}) end |
#deliver(options = {}) {|delivery| ... } ⇒ Object
88 89 90 91 92 93 |
# File 'lib/top4r/model/trade.rb', line 88 def deliver( = {}, &block) delivery = Delivery.new() yield delivery if block_given? delivery.tid = @tid @client.deliver_trade(delivery) end |
#unmarshal_other_attrs ⇒ Object
95 96 97 98 99 100 101 |
# File 'lib/top4r/model/trade.rb', line 95 def unmarshal_other_attrs @id = @tid if @orders.is_a?(Array) @orders = @orders.map{|order| Order.new(order)} end self end |
#update_memo(memo) ⇒ Object
79 80 81 82 |
# File 'lib/top4r/model/trade.rb', line 79 def update_memo(memo) valid_memo(memo) @client.trade(@tid, :update_memo, {:memo => memo}) end |